Dolly Zoom Effect

Dolly Zoom Effect
How to create dolly zoom effect in real time or to say vertigo effect in realtime.

why are you asking in a computer-vision forum for some game effect ?

Yes with computer-vision for cinematic view

what’s your input data?

can you show examples of what effect you mean?

and please present the results of your literature research (googling). don’t say there’s nothing. there is.

there is no magic behind zooming.

  • you pick a ROI to zoom in
  • you resize() it

A simple zoom is possible with a crop/resize, but for a dolly-zoom you need 3D data, as it changes the image based on the scene.

If you have full 3D data of the scene (it has been modeled in 3D), just use a 3D rendering engine, game engine etc. Change the position of the camera together with the field of view.

If you have partial 3D data (let’s say from a RGB-D camera), you can simulate this effect by projecting the point cloud with different camera positions and field of view; but you’ll have missing data (the part of the image that’s hidden in the original shot. It is possible to reconstruct some of this data using inpainting, but it will be guessed data, far from cinematic quality.

just like this

That’s not dolly zoom. It’s only a simple crop around the face of a guy walking around. For a dolly zoom you need a fixed subject and a moving/zooming camera. This is a classic dolly-zoom effect.

To achieve the effect from your video, no need for AI. Do a face detection, then instead of drawing a circle, just crop the image around the detected face.

//after detectMultiScale() function
//using the first detected face: get the center and the radius. 
Point center( faces[0].x + faces[0].width/2, faces[0].y + faces[0].height/2 );
int radius = (faces[0].width + faces[0].height)/4;
//crop the face with a certain border...
Mat dest = src(Rect(center.x-radius*8/3,center.y-radius*2,radius*16/3,radius*4);
//resize the cropped image to a constant size and display it
Mat dest2;

thanks for the reply , I want to request you again for same code in python.

Sorry, this is not a request / solve my homework forum.


I’m sorry if I used inappropriate language,
forgive me ,