Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

frames average

HI
I am relatively new to lab view. I am getting frames from a camera . I want to take average of every 10 frames. Can anybody giv eme some hints in achieving it?
Thanks
Best Regards
Imran
 
0 Kudos
Message 1 of 11
(5,349 Views)
Hi Imran,

Thank you for using National Insturments Forums.  A good way to achieve this is to convert all the images to arrays, add the arrays and then divide the arrays by the number of images you averaged.  You need to make sure your arrays are of the proper type to average because if you have say an 8 bit image and add two numbers together, you will hit the 255 limit value and your average won't be made properly.  From there you would convert the arrays back to an image, to do this you will need Vision Development Module.

Hope this helps!

Justin Louie
Message 2 of 11
(5,338 Views)
HI Justin
Thanks for your reply. Yes we do need arrays. I can use "image to array " to convert images to array. I am using "IMAQ Grab Acquire" to capture frame. Now this module will give me 1 image at a time. I am not sure how to store 10 arrays before takeing their averages?
Another possibility is to use "IMAQ Sequence" which will give multiple frames at a time (i dont know how many) ...I am thinking of way to get an average from that...
What are your thoughts now???
I am grateful for your help...
Thanks
Best Regards
Imran 
0 Kudos
Message 3 of 11
(5,333 Views)
Thanks I have figured out how to add specified frames while using "IMAQ grab Acquire".
Thanks
Best Regards
Imran
0 Kudos
Message 4 of 11
(5,322 Views)
Hi Imran!

You actually don't have to convert the image to array, average and convert back to image. You can perform the averaging directly on the IMAQ image data type.
Assuming you are averaging an 8bit image, here is what you need to do:
- Create a buffer of 10 images with 16bit depth (to avoid an overflow due to adding multiple 8bit images)
- add all incoming images
- divide the resulting 16bit image by the number of added images (in your case :10)
- convert the 16bit image to 8bit image for display ( a standard monitor is an 8bit device)

Also, try to keep the code as flat as possible in order to avoid multiple copies of the image buffer.

Here a couple of examples:
http://zone.ni.com/devzone/cda/epd/p/id/474

I hope that helps.

Best,
Markus Tarin


Message 5 of 11
(5,303 Views)

Thanks for your suggestions. I am new in Lab View. Can you please tell me how to create the buffer of 10 images?

Thanks

Best Regards

Imran

0 Kudos
Message 6 of 11
(5,281 Views)
Hi!

Please find attached a couple of sample VIs.

a) Create Image Buffer.vi lets you create image buffers. Smiley Happy
Use 8-bit depth if you are using a monochrome camera with an 8-bit image output and a 16-bit for example for e.g. a 10-bit or 12-bit image.

b) Average image.vi then lets you average images, you guessed right.
In order to display the averaged images, they need to be converted back to 8-bit, since standard monitors are 8-bit display devices. However, the IMAQ image display control or indicator can adapt to the image bit depth by either shifting or dynamically shifting the bits. You can right click on the control or indicator and go to the "display 16-bit image" option to set that up.

The attached VIs have been written in LabVIEW 8.2.1

I hope that gets the job done.

Best,
Markus

Message 7 of 11
(5,267 Views)
Message 8 of 11
(5,260 Views)
I am grateful for your help. but version of my labview is 8.2 and it does not contain IMAQ add, divide etc...
Thanks for your help...
Best Regards,
Imran
0 Kudos
Message 9 of 11
(5,243 Views)
Hi!

In that case you could revert back to the idea of converting the IMAQ data type into a 2D-array and do the averaging there.
Do you have the Vision Development module installed, or do you only have LabVIEW 8.2?

Markus
0 Kudos
Message 10 of 11
(5,240 Views)