Affine transformation
In the previous section, we successfully rotated images using warpAffine. In this section, we will try to perform an affine transformation using the same function.
First, we will create a new editing plugin project and use AffinePlugin as the project name and the plugin class name, and then use Affine as the action name (that is, we will return this string in the name method).
This time, in the edit method, we will use another method to obtain the transformation matrix for the warpAffine function. First, we prepare two triangles—one is for the input image, and the other is for the output image. In our code, we use the triangles that are shown in the following diagram:
The left one is for the input, while the right one ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access