RobertoRD
Posts: 2
Joined: Tue Sep 12, 2017 12:26 am

Clip Video to circular area of interest

Tue Sep 12, 2017 12:33 am

Good Day

Toda y was muy first Day using Raspberry 3 and the raspberry camera (8MP). I have a project that I will used the camera with 720 x 720 resolution, and that was easy, but I didn't find information on how can I do to make the video on circle shape... I need the video in a circle or 720p of diameter, all the other will be ignored (black pixels), this is because where the camera will be installed it only see this shape (will be inside a tube) and I want this because maybe ignoring all the pixels that I doesn't need the process will be faster.... Some idea on how to kill all the pixels that I don't need? On how can I get a video in circle shape?

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: Video

Tue Sep 12, 2017 6:39 am

I would suggest in your software to only process the pixel area (region of interest) needed regardless what is coming from the camera

PiGraham
Posts: 3971
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Video

Tue Sep 12, 2017 8:14 am

Simplest option - put a mask over the screen that has a circular cutout in it.You only see the circular image. If you have a tube anyway doesn't that mask out the corners?

You could create a mask graphic as a DispmanX layer above the camera preview.
You could look at picamera.http://picamera.overlay.renderer:
readthedocs.io/en/release-1.10/api_renderers.html?highlight=overlay.renderer

You could paint the camera image a line at a time in a circle but that will most likely be slower than letting the GPU update the square.

Alternatively you could just snip off the corners with a sharp pair of scissors. [JOKE]

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

Re: Video

Tue Sep 12, 2017 8:37 am

I think you need to look at the region of interest flag. --roi in raspistill. See the docs.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

PiGraham
Posts: 3971
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Video

Thu Sep 14, 2017 9:16 am

jamesh wrote:
Tue Sep 12, 2017 8:37 am
I think you need to look at the region of interest flag. --roi in raspistill. See the docs.
That doesn't help with circular area of interest, does it?
It seems -roi is already used:
RobertoRD wrote: I will used the camera with 720 x 720 resolution, and that was easy, but I didn't find information on how can I do to make the video on circle shape...

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

Re: Video

Thu Sep 14, 2017 10:23 am

PiGraham wrote:
Thu Sep 14, 2017 9:16 am
jamesh wrote:
Tue Sep 12, 2017 8:37 am
I think you need to look at the region of interest flag. --roi in raspistill. See the docs.
That doesn't help with circular area of interest, does it?
It seems -roi is already used:
RobertoRD wrote: I will used the camera with 720 x 720 resolution, and that was easy, but I didn't find information on how can I do to make the video on circle shape...
I think the OP is simply using the x and y resolution at 720x720, so the output from the sensor is that (or near). Then he will need to use the -roi flag to clip that down to the area around the circle. If he is pointing down a tube, he already has the circular mask.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

RobertoRD
Posts: 2
Joined: Tue Sep 12, 2017 12:26 am

Re: Clip Video to circular area of interest

Thu Oct 12, 2017 5:21 pm

Thanks all for yours comments, sorry for the date that i'm responding, the program need to be on python. Can some one can give me an example of the -roi? I a newbie using raspberry, linux and python

Return to “Python”