Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I acquire NI-IMAQ-LabVIEW images directly to arrays?

   Can I acquire images directly to arrays instead of to the image data type using NI-IMAQ and LabVIEW? This would save me a lot of memory not having to convert to arrays.
Thank you,
Charles Lasnier

0 Kudos
Message 1 of 9
(4,153 Views)
You can use IMAQ Get Image Data instead of IMAQ Get Image. This will give you a 1D array of raw image data, which you can reshape by Reshape Array to get a 2D image array.

View my profile on LinkedIn
0 Kudos
Message 2 of 9
(4,143 Views)

Hi, Lasnier,

 

From my point of view I will not recommend to use LabVIEW arrays as placeholder for acquired images, because:

- operations with LabVIEW arrays in most cases more slow in comparizon with IMAQ functions

- these arrays are not aligned in memory, so you will get more penalties

- overall memory usage may be bigger than expected by array buffer allocation

 

So, Image to Array is the operation which used pretty rarely. Which operation available for array and not available for images?

 

Andrey.

 

0 Kudos
Message 3 of 9
(4,140 Views)

Thanks Vladimir.  Actually I have NI-IMAQ and I don't have either of those functions (IMAQ Get Image or IMAQ Get Image Data) except for IMAQdx. I don't see them either in the list of functions for IMAQ Vision:

<http://www.alliancevision.com/us/products/software_ni/imaqvision.htm>

Where did you find those? 

 

-Charles Lasnier 

0 Kudos
Message 4 of 9
(4,124 Views)

Andrey,

  Thanks for your reply. I should consider getting IMAQ Vision and using the image arithametic. Most of my processing is extracting profiles and getting pixel values. In the end I need to get the numbers out for further processing outside of LabVIEW. The other applications don't understand the IMAQ Image data type, so I convert to arrays. Still, I may be able to save memory by working more with the images and less with arrays. This is desirable with the large amount of data I need.

 

-Charles Lasnier 

0 Kudos
Message 5 of 9
(4,123 Views)

If you make your image border 0 in the IMAQ Create VI, you can use the IMAQ GetImagePixelPtr VI to get the address of the first pixel and you can pass this address to C to analyze the image and treat the data like an array (if you don't have a border of 0, you'll need to take into account the extra pixels at the beginning and end of each row).

Hope this helps,

Brad

0 Kudos
Message 6 of 9
(4,117 Views)

Actually, even with a border of 0 you will still likely have to account for padding at the beginning and end of each line because the lines of Vision images are always 32-byte(?) aligned for better performance. The help file for GetImagePixelPtr explains this pretty well and how to account for it via the LineWidth output of that VI. Generally most code in C that deals with image manipulation should have a way to account for this padding, since it is a common mechanism in image analysis to have both aligned image data and also borders.

 

Eric

0 Kudos
Message 7 of 9
(4,115 Views)
Lasnier: Sorry I was reading too fast and assumed you were using NI-IMAQdx. There's probably no such VI for NI-IMAQ.

View my profile on LinkedIn
0 Kudos
Message 8 of 9
(4,099 Views)
Thanks all, good discussion.
0 Kudos
Message 9 of 9
(4,091 Views)