How can I convert camera motion into zoom?

362 Views Asked by At

I try to reconstruct a camera of a video sequence via match moving techniques. After the reconstruction process all seemed to work as expected, but then I've realized my camera is moving forward instead of zooming into the 3d-scene like this:

enter image description here

Every dot of the path represents the position of the camera in 3d space (Frame 1 to 40)

I know that (initial situation):

  • focal length is 35mm at frame 1
  • focal length is 85mm at frame 40
  • the distance to the object is 0.8m

When I try to animate this values by hand (see the image below) it is unfortunately not accurate enough, because of the camera man's delay in turning the lens.

enter image description here

Desired effect (Frame 1 to 40)

Is it mathematically possible to convert the camera motion into a zoom to get the correct focal length for every single frame?

A point to start with or any suggestions would be appreciated.

2

There are 2 best solutions below

0
On BEST ANSWER

in short

You can calculate the focal length of the zooming camera $f_z$ $$ f_z = \frac{d_z f_m}{d_m} $$ with $d_z$ the distance to the object from the zooming camera. $f_m$ represents the focal length of the the moving camera and $d_m$ represents the distance to the object from the moving camera.

explanation

You can use the magnification formula to calculate the magnification $m$ with the focal length $f$ and the distance to the object $d$. $$ M = \frac{f}{d - f} $$ While you want to have the same magnification for the camera in motion and the camera in zooming mode $m_m = m_z$ the equation will look like this: $$ \frac{f_m}{d_m - f_m} = \frac{f_z}{d_z - f_z} $$ Solving this for $f_z$:

$$ f_z = \frac{d_z f_m}{d_m} $$

example

So if the camera that should zoom has a distance to the object of $800mm$ and the camera that is in motion has a focal length of $35mm$, the focus length of the zooming camera is $$f_z = \frac{800mm \times 35mm}{d_m}$$ while $d_m$ is the distance to the object from the moving camera in the current frame.

6
On

If you can identify items in the picture to find the width of the frame as a function of frame number you can do it. As the distance to the object is large compared to the focal lengths, the size of the object in the frame is inversely proportional to the focal length. If $W$ is the width of what you can see in frame $1$ and $W'$ is the width of what you can see in some other frame, you have $35W=fW'$ or $f=35\frac W{W'}$ where $f$ is the focal length in that frame in mm.