02-11-2016 06:32 AM
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.
02-11-2016 07:07 AM
02-11-2016 07:21 AM
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
02-11-2016 07:47 AM - edited 02-11-2016 07:50 AM
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
02-11-2016 09:51 AM
@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.
02-11-2016 09:54 AM
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
02-11-2016 09:58 AM
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
02-12-2016 08:50 AM
02-12-2016 08:56 AM
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
02-12-2016 09:39 AM