Hello,
I am following this post an amazing blog post to create a Perspective Transform for an arbitrary image.
https://www.blogger.com/comment.g?blogID=7023576929606369407&postID=5089486422033834180
This works well for square images, but has a problem with the aspect ratio when it comes to rectangular images.
I suspect it is the Camera Intrinsics that uses the field of view.
cv::Mat A2 = (cv::Mat_<double>(3, 4) <<
f, 0, w / 2, 0,
0, f, h / 2, 0,
0, 0, 1, 0);
There are comments on the blog mentioning suggested values of f for 200-250 when using this method.
In the documentation for OpenCV, it is a a little more precise stating that it is in face fx and fy. Focal length can be found if the field of view is known, and vice versa.
fx, fy are the focal lengths expressed in pixel units.
What is the solution here?
Example image of the problem, look at how it is oddly stretched in the x axis. Works fine when they are stretched.
This is another solution that i have seen but it appears to involve more steps that the one above.