Prayuktibid
Posts: 11
Joined: Wed Aug 30, 2017 10:08 am

How to zoom Rpi camera v2 ?

Fri Sep 06, 2019 11:07 am

Hello folks,

I want to zoom the camera while video recording. Rpi Camera module V2 is 8 megapixel that means 3280 x 2464 pixel resolution. I am recording a video in 720P resolution that I am using almost 2 megapixels so I can further zoom the camera upto 8 megapixels.

My question is How to implement zooming features while recording video? Suppose I want to control digital zoom using some potentiometer which is connected with GPIOs of Rpi, by varying the pot resistance I want to zoom in and zoom out or I want to control using the keyboard input.

Whatever the way of control(hardware or software) the main mechanism is the same means I have to give some value by hardware or software input, according to this value I have to generate the resolution or zooming area and apply to this resolution to camera module so that it can focus on that resolution or zooming area while recording video.

How to implement this total procedure? Please give some idea to implement this thing. Thank you.

User avatar
HermannSW
Posts: 1658
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: How to zoom Rpi camera v2 ?

Fri Sep 06, 2019 4:01 pm

Zooming can be done, I once tested a picamera script from @ethanol100 using camera.zoom()
https://www.raspberrypi.org/forums/view ... 4#p1417423

and was really impressed (I seldom use picamera).
In my response posting you can find a sample .webm and youtube video I took with that script.
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

Prayuktibid
Posts: 11
Joined: Wed Aug 30, 2017 10:08 am

Re: How to zoom Rpi camera v2 ?

Sun Sep 08, 2019 3:28 pm

Thank you @HermannSW for this help. I will try this script. Please clear me one thing that "If I record video @720p resolution and I dynamically zoom the camera while recording the resolution won't be changed? I meant the camera resolution will remain @720P or resolution also change with respect to the camera zooming?"

User avatar
HermannSW
Posts: 1658
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: How to zoom Rpi camera v2 ?

Sun Sep 08, 2019 4:32 pm

Please see the video in the posting I pointed to, it kept at 640x480 resolution the whole time while camera moving and zooming. So your 720p resolution will not change by using camera.zoom().
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

Prayuktibid
Posts: 11
Joined: Wed Aug 30, 2017 10:08 am

Re: How to zoom Rpi camera v2 ?

Thu Sep 12, 2019 3:45 pm

Thank You @HermannnSW for the help.

Return to “Camera board”