quartic
Posts: 2
Joined: Tue Aug 20, 2013 12:36 pm

raspivid crop video / digital zoom

Tue Aug 20, 2013 1:51 pm

Hi,
I'm really interested in streaming video with digital zoom ability. I digged in RaspiVid code and some mmal code.
There are some options brought out in RaspiVid.c

Code: Select all

   format->es->video.crop.x = 0;
   format->es->video.crop.y = 0;
   format->es->video.crop.width = state->width;
   format->es->video.crop.height = state->height;
But modifying them was unsuccessful. I was unable to complitely trace them in mmal code. I wonder is video crop implemented in mmal?

The objective is to have full 2592x1944 video as input, specify cropping area and crop it to 640x400 before encoder stage on order not to lose in performance.

Is there any reasonable options to perform video crop?

Thanks in advance,
Martti

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25977
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspivid crop video / digital zoom

Tue Aug 20, 2013 2:12 pm

I recently added ROI code to the apps - using this you can digital zomo in to the image. Use rpi-update to get the latest code. I think I updated the docs to include the roi options...

But, we still don't have the full resolution FOV for video yet - but you do in stills.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“My wife said to me `...you’re not even listening`.
I thought, that’s an odd way to start a conversation.."

sirkris
Posts: 4
Joined: Sat Mar 16, 2013 4:12 am

Re: raspivid crop video / digital zoom

Tue Aug 20, 2013 10:48 pm

FWIW, ROI means "region of interest". I had to look it up.

quartic
Posts: 2
Joined: Tue Aug 20, 2013 12:36 pm

Re: raspivid crop video / digital zoom

Wed Aug 21, 2013 6:31 am

Thanks a lot, I got roi working after updating sources.
Is it possible to change roi and other camera image parameters in realtime (with function mmal_port_parameter_set) or is it necessary to reinitialize camera connections when parameters are changed?

Greetings,
Martti

antonvh
Posts: 5
Joined: Wed Sep 17, 2014 8:56 pm

Re: raspivid crop video / digital zoom

Sat Oct 04, 2014 12:16 pm

Yes I want this too: a live change of ROI, while streaming. How can this be done?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25977
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspivid crop video / digital zoom

Sat Oct 04, 2014 3:50 pm

I believe ROI can be changed whilst streaming. You just need to mod the code to do it.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“My wife said to me `...you’re not even listening`.
I thought, that’s an odd way to start a conversation.."

antonvh
Posts: 5
Joined: Wed Sep 17, 2014 8:56 pm

Re: raspivid crop video / digital zoom

Sun Oct 12, 2014 8:32 am

What part of the code do I need to mod to do live ROI change (while streaming, that is)?

How do I interface with RaspiVid while it is streaming?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 25977
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspivid crop video / digital zoom

Sun Oct 12, 2014 9:04 am

You could send a signal to the app to change zoom levels. There is signal handling code already in there for turning recording on and off - you could mod that.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“My wife said to me `...you’re not even listening`.
I thought, that’s an odd way to start a conversation.."

jegranado
Posts: 1
Joined: Wed Oct 15, 2014 6:47 pm

Re: raspivid crop video / digital zoom

Wed Oct 15, 2014 6:56 pm

Hello all,

If I use ROI to record a 10x480px cropped video (yes, just a vertical, small, strip of video), can I acheive higher framerates?

Regards,
Jeff

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8425
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: raspivid crop video / digital zoom

Wed Oct 15, 2014 9:37 pm

jegranado wrote:If I use ROI to record a 10x480px cropped video (yes, just a vertical, small, strip of video), can I acheive higher framerates?
No. The frame read from the sensor always remains the same and it is cropped in the GPU.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

hbradlow
Posts: 1
Joined: Tue Dec 03, 2013 9:58 pm

Re: raspivid crop video / digital zoom

Thu Mar 12, 2015 11:31 pm

Hi antonvh,

Did you successfully do this? I would like to do the same thing.

-Henry

Return to “Camera board”