Affine transformation of image and AffineTransform class

Source: Internet
Author: User

Affine transformation is an important research object in the field of image matching, so it is necessary to understand the operation of affine transformation in image. Learn some of the online blogs and tutorials, and simply record a bit:

An affine transformation of an image consists mainly of the following series of actions: Flip, rotate (Rotation), pan (translation), scale, and error-cut (Shear).

The AffineTransform class describes the function of a two-dimensional affine transformation, which is a linear transformation between two-dimensional coordinates and two-dimensional coordinates, maintaining the "straightness" (straightness) of the two-dimensional graph, i.e., the straight line remains straight after the transformation, and the arc or arc; "Parallelism" (parallelness), that is, the relative position relationship between two-dimensional pixels is constant, parallel lines or parallel lines, intersecting lines of the angle unchanged.

Such transformations can be represented by a 3x3 matrix, with its last behavior (0, 0, 1). The transformation matrix transforms the original coordinates (x, y, 1) to the new coordinates (x ', y ', 1), where both the original and the new coordinates are considered the three-dimensional column vectors of the last row 1, and the vector of the original column vectors to the left multiplication matrix to get the new column vectors:

The following are the function invocation forms of several affine transformations:

publicstaticgetTranslateInstance(doubledouble ty)

Translation transformation is a "rigid body transformation", that is, the transformation of the image does not change the local shape, the function of each point in the image from the original coordinates (x, y) to (X+tx, y+ty), the transformation matrix is:

publicstaticgetScaleInstance(doubledouble sy)

The scaling transformation is also a typical rigid-body transformation, where the above function enlarges (shrinks) the horizontal axis of each point to SX times, and the ordinate zooms (shrinks) to Sy times, and the transformation matrix is:

publicstaticgetShearInstance(doubledouble shy)

The wrong-cut transformation is different from the above rigid body transformation, a simple error-cutting transformation is to transform the square into parallelogram. Each error-cutting transformation causes the image to be deformed, and the function represents the following transformation matrix:

The function is equivalent to adding a transverse cut to the image plus a longitudinal cut:

publicstaticgetRotateInstance(double theta)

The rotation transformation also belongs to the non-rigid body transformation, the target graph takes the origin point (0, 0) as the center, rotates the theta radian clockwise, the function equivalent transformation matrix is:

publicstaticgetRotateInstance(doubledoubledouble y)

Another generalization of the rotation transformation function, that is, the image with (x, y) as the axis, clockwise rotation theta radians, the transformation matrix is:

This function acts as a composite of two translation transforms and one-time Origin rotation transformation:

Reference Link: http://baike.baidu.com/link?url=1soBhJJ5n1AqKmXybLT37kE427lzRpKVq5-3pHLYaH96nWjy_ 4vyymwvjuadvt4inpticrok20niqx6qgxjm3_

http://blog.csdn.net/hitwengqi/article/details/6888783

Affine transformation of image and AffineTransform class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.