Use the least square method in image transformation to solve the Affine Transformation Parameters

Source: Internet
Author: User

Set the original image to f (x, y), and the distorted image to f (x ', y ') to restore to f (x, y), you need to find the Conversion Relationship Between the (x', y') Coordinate and (x, y) Coordinate. This Conversion Relationship is called coordinate transformation, (x, y) = T (x', y ').

The distortion of a scene during imaging may cause the image to be out of proportion. The affine transform can be used to correct various distortion. First, calculate the coefficient of the coordinate transformation. The expression of the affine transformation is: R (x) = px + Q, x = (X, Y) is the plane position of the pixel, P is the rotation matrix of 2*2, q is the translation vector of 2*1, and p and q are the parameters of the affine transformation, that is:

X = AX '+ by' + c

Y = DX '+ ey' + F

Therefore, the correction of geometric distortion is ultimately the solution of the coordinate transformation coefficients A, B, C, D, E, F.

In order to prevent null pixels, reverse ing is generally adopted and obtained by the least square method:

Vec1 = inv ([x y I] '* [x y I]) * [x y I]' * U;
Vec2 = inv ([x y I] '* [x y I]) * [x y I]' * V;
Vec1 = [a B c] '; vec2 = [d e f]'; x y u v I are X, Y, x', y ', 1.

 

In addition, the cp2tform function or nlinfit function in MATLAB can implement similar functions.

 

Related Article

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.