AffineTransform class and affinetransform class
In the field of image matching, affine transform images are an important object of study. Therefore, we need to have a basic understanding of the operation of affine transform in images. I learned some blogs and tutorials on the Internet and recorded them briefly:
The image's affine transformation mainly includes the following operations: Flip, Rotation, Translation, Scale, and Shear ).
The AffineTransform class describes a two-dimensional affine transformation function. It is a linear transformation between two-dimensional coordinates and two-dimensional coordinates to maintain the "straight" of two-dimensional images) that is, after the transformation, the straight line remains straight, the arc or the arc; "parallelism" (parallelness), that is, the relative positional relationship between two-dimensional pixels remains unchanged, parallel lines or parallel lines, and the intersection of the intersection line remains unchanged.
This type of transformation can be represented by a 3 × 3 matrix, and the last row is (0, 0, 1 ). This transformation matrix converts the original coordinates (x, y, 1) to the new coordinates (x', y', 1 ), here, the original coordinates and new coordinates are regarded as the three-dimensional column vector with the last line being 1. The left multiplication transformation matrix of the original column vector obtains the new column vector:
The following are the call methods for functions of affine transformations:
public static AffineTransform getTranslateInstance(double tx, double ty)
Translation transformation is a kind of "rigid body transformation", that is, it does not change the local shape of the image before and after the transformation. This function moves each point in the image from the original coordinate (x, y) to (x + tx, y + ty), the transformation matrix is:
public static AffineTransform getScaleInstance(double sx, double sy)
Scaling is also a typical rigid-body transformation. The above functions zoom in or out the abscissa of each point to sx times, ordinate to sy times, and transform the Matrix:
public static AffineTransform getShearInstance(double shx, double shy)
Unlike the preceding rigid-body transformation, a simple mistangent transformation converts a square into a parallelogram. Each mistangent transformation will cause image deformation. The function represents the following transformation matrix:
This function is equivalent to adding a horizontal cut to the image and a vertical cut:
public static AffineTransform getRotateInstance(double theta)
The Rotation Transformation is also a non-rigid-body transformation. The target image is centered around the origin (0, 0) and rotates the theta radian clockwise. The equivalent transformation matrix of this function is:
public static AffineTransform getRotateInstance(double theta, double x, double y)
Another promoted Rotation Transformation function is to rotate theta radians clockwise on the image with (x, y) as the axis, and the transformation matrix is:
This function is equivalent to the combination of two Translation Transformations and one origin Rotation Transformation:
Reference link: http://baike.baidu.com/link? Url = required _
Http://blog.csdn.net/hitwengqi/article/details/6888783