# Mock Camera Intrinsics

Hello,

I am following this post an amazing blog post to create a Perspective Transform for an arbitrary image.

https://jepsonsblog.blogspot.co.nz/20...

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 little more precise stating that it is in fact 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 which becomes more severe as the rotation increases. Works fine when they are square images.

Can you just calibrate the camera? Other than that I'm not sure of a good way of estimating that. If you can measure the truth, you can alter the f values and see if you get better or worse. Note that most cameras have very similar if not identical f_x and f_y values.

@Tetragramm Nope. It's an arbitrary image from an unknown camera. Should work for all imagew, i.e. even downloaded from the internet etc. What if it was a drawing from photoshop etc? The camera intrinsics may not be available. Interesting problem, right? :)

What do you mean by oddly stretched? Isn't the "stretch" occuring simply due to the perspective distortion? If you don't want this distortion, then you might want to try an affine transformation?