How vanishing points can help in restoring proper camera perspective?

4.7k views Asked by At

I'm trying to insert 3D object into a photo, that was not taken by me. Meta info is erased, so I can only guess camera parameters and dimensions of the objects in the scene. How can I set proper campoints in such case, is there any methodology?

I've seen that people are drawing helper lines, finding vanishing points, but while I understand the meaning of the vanishing point, I do not get how it can help in restoring the perspective. Any good writeup on the topic?

2

There are 2 answers

0
Sam On BEST ANSWER

To completely determine a scene 3D data from a given image, you need to know the perspective projection parameters that formed your image. They are:

  • camera intrinsics: focal length (a must!), and distortion parameters (if you want high precision)

    • camera extrinsic parameters (rotation/ translation on the three axes)

Detailed: Focal length can be obtained from viewing angle, with this formula: fx = imageWidth/(2*tan(alphaX)), and similar for the other dimension. If you have neither fx, nor aperture, you cannot reconstruct your 3D image.

Another way to extract them is to calibrate the camera. See http://opencv.itseez.com/modules/calib3d/doc/calib3d.html, but it seems you cannot use it (you said you don't have access to camera.)

The vanishing point (VP) is used to determine the angles at which camera was orientated. So, a difference between the image center and the VP gives you the rotation info:

yaw = ((camera.center.x (pixels) - VP.x)/image.x )* aperture.

pitch = similar.

The roll angle cannot be extracted from VP, but from the horizon line.

The last parameters you need are the translations. Depending of the application, you can set them all 0, or consider only the height as being relevant. None of them can be usually recovered from the image.

Now, having all this data, you can look here Opencv virtually camera rotating/translating for bird's eye view

to see how all this measures influence your perspective correction.

0
Derek Hoiem On

Not a very simple topic, but see the Feb 23 lecture here: https://courses.engr.illinois.edu/cs543/sp2017/

There is not a one-size-fits-all solution, but depending on scene structure, it is often possible to add objects to photos. See also: http://dl.acm.org/citation.cfm?id=2024191