MATLAB Answers

How to choose the fixed points in fitgeotrans method for image rectification

31 views (last 30 days)
Hello, help me please understand the fitgeotrans funcion in Matlab.
I have different images of various sizes of a square object, and in different perspective views; in all of this images I have detected the object and found its 4 corners. Now what I want to do is to make a perspective rectification of these images so that after I can get a "plan view" of this object and then crop the image around this object.
I have implemented this code in Matlab based on some search in the Web:
movingPoints = corners; %contains the 4 corners of the object in clockwise order
fixedPoints = [0 0; 500 0; 500 500; 0 500];
tform = fitgeotrans(movingPoints,fixedPoints,'projective');
warp = imwarp(image,tform);
And it's working, I get my object in "plan view". However the object rectified sometimes is very big(or near), and sometimes is small(or distant can we say); I suppose it's because of how much "work" has done the transformation.
How do I choose the fixedPoints so that after I can crop my object knowing the new corners position in the image rectified ?

Accepted Answer

Diwakar Ravichandran
Diwakar Ravichandran on 18 Jul 2018
Hi,
As I try to understand your problem, there remains a few things I am not yet clear on. So, fitgeotrans is a function that can be used to fix distortions in your images based on the fixed points and the moving points. As shown in the documentation, https://www.mathworks.com/help/images/ref/fitgeotrans.html
The method of choosing your fixedPoints is based on the non distorted image. So when you have a non distorted image, and you identify specific points on the image, and these become your fixed points. And the rest of your distorted images uses these fixed points to generate a transform to help your moving points to reach their fixed points.
Hope this helps,
Cheers!

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by