LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Video image crop

I have a project using MyRIO and a Logitech c270 camera. During the image processing process the video images framerate gets way lower, unless I use low resolution. In the project i need high resoliton, because i examine an object far away, but i don't need the whole image, only relatively small part of it.

 

How can I crop my image? In MAX i can't modify the ROI. I tried to change the image height and width before the image processing using Property Note block, but in the properties the height and width values are all just readable.

 

What are your suggests to solve my problem? What are the other ways to crop video images?

 

Thanks a lot for your aswers.

0 Kudos
Message 1 of 10
(3,368 Views)
what is your fps rate now and what is your desired fps to achieve
also remember you could not force ccd camera to work in your ROI so you could not
force part of ccd for camera to work just you can corp image after you acquire image, so if your desired speed is faster than camera fps ability you could not do any thing just you should change your camera in this case
0 Kudos
Message 2 of 10
(3,350 Views)

Your Camera settings define the parameters of the Image Buffer -- when you specify the number of pixels that your camera should return (e.g. 1024 x 1280 vs 480 x 640), an internal buffer of that size is allocated, and will be where the camera places the image.  You can use the IMAQ Extract function (found on the Image Manipulation sub-Palette) to create a full-resolution "cropped" image specified by the top-left and bottom-right coordinates of the cropping rectangle.  Now you'll have a full-resolution, but smaller, Image basically at the "cost" of copying the number of pixels you specify for the crop from the Camera Image (buffer) to your Working Image (buffer).

 

Now do your processing using the cropped image.  If your original image was 1024 by 1280 pixels and you need the central 12.5% (1/8th) (from pixel 448, 1200 to 575, 1359, if I've done the math right in my head), your routines on the cropped image, since they're dealing with only 1/8 the number of points, should run at least 8 times faster.

 

Bob Schor 

0 Kudos
Message 3 of 10
(3,335 Views)

bob
also in this case that you told the camera will be capture image full size so if sleber desired speed is faster than camera fps your method will be not help him
and  relation between pixel amount and speed of algorithm work is not exactly linear
and it is vary in different algorithm for simple just displaying image 1 /8 the number of points could be run almost 7 or 6 time faster but with fps limitation

0 Kudos
Message 4 of 10
(3,318 Views)

@sleber wrote:

I have a project using MyRIO and a Logitech c270 camera. During the image processing process the video images framerate gets way lower, unless I use low resolution. In the project i need high resoliton, because i examine an object far away, but i don't need the whole image, only relatively small part of it.


I don't understand. When you're talking about resolution on a camera sensor it is not how finely something is resolved (like it is in some contexts), it is the number of pixels in either direction. So if you use a lower resolution, your pixels are not magically becoming more spaced apart, you are just using less of them... which you could also call cropping.

0 Kudos
Message 5 of 10
(3,295 Views)

Hatef,

 

     The camera is a Logitech c270 Web camera, capable of 720p at 30 fps.  There is nothing in the specifications to suggest that at lower resolutions, it is capable of higher frame rates.  Based on the Original Poster's question (titled "Video image crop"), and the assumption (based on information from Logitech's Web site) that 30fps was probably the (fixed) video frame rate, I answered the question in as clear and direct a manner as I could.

 

     If you have a better solution to the posted problem, feel free to post it here.  I apologize if I offended you by not being sufficiently precise.

 

Bob Schor

0 Kudos
Message 6 of 10
(3,293 Views)

Excellent point, Gregory.  I'd forgotten that on my Logitech 920, when I choose a lower resolution, the Camera "management software" gives me the ability to "pan" the image, which sounds like it's not only doing the "crop", but allowing me to set what part of the image to crop.  The only (minor) caveat is that the size of the cropped image is set by the manufacturer ...

 

Bob Schor

0 Kudos
Message 7 of 10
(3,283 Views)
Dear bob
your response is general right answer to the question but some times problem is in other way that we do not attention to it so ask that question to get to know if his problem is not one of that
for example if sleber want increase his algorithm speed up to 33 ms it is impossible and he should change his camera also if he use mode of camera in 15 fps it is better to change his camera fps mode to 30 fps to get almost 2 time faster (not exactly 2 times )
also in image processing using different algorithm could solve speed problem better so before just cropping image it is better to find out witch part algorithm waste more time to operate and try to change it
0 Kudos
Message 8 of 10
(3,252 Views)

When I have needed to do video processing I've had good luck using ffmpeg (https://www.ffmpeg.org/) and then writing a LabVIEW wrapper around different calls.

 

A quick google search returns this:

http://video.stackexchange.com/questions/4563/how-can-i-crop-a-video-with-ffmpeg

 

0 Kudos
Message 9 of 10
(3,246 Views)
it is good method but for video not camera based if your algorithm do not need information based on second neighborhood of pixels because it destroy them for example it is not good method to use morphology after that it is useless
0 Kudos
Message 10 of 10
(3,231 Views)