LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

imaq question

I've got 7.1 and have the basic IMAQ stuff that comes with that. The
output of 'IMAQ snap.vi' is defined (via help and the wire tool) as
(typedef 'IMAQ Image.ctl'[non-strict]) and under that, (IMAQ image). Is
there a way to turn that into an array of uint8?

TIA,
Bruce


0 Kudos
Message 1 of 8
(4,862 Views)
Hi Bruce,

I think you can turn any data type to any other... but in your case could you explain why you want to turn an Imaq session to a U8 array Smiley Surprised ?
I'm not sure of what information you could get from this... typecast (to be found in the "Advanced" function palette :



Message Edité par TiTou le 04-30-2006 12:08 AM


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 8
(4,851 Views)
If you want to get the data of the picture as a byte array, you will presumably have to use an IMAQ function which returns the picture data (don't ask me which) - the IMAQ image is only a reference to the data (like a pointer) and does not hold the data itself. As TiTou points out, it is useless outside of the current LV instance.

___________________
Try to take over the world!
0 Kudos
Message 3 of 8
(4,844 Views)
OOOPS... sory about the bad shot above, please ignore my previous post Smiley Sad

tst is right, the image control is just a pointer to the image, to get the U8 array there is a function called : "IMAQ ImageToArray" (also the reverse operation exists)
in the function palette :
NI Measurements >> Vision >> Vision Utilities >> Pixel Manipulation


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 8
(4,842 Views)

If you have Vision installed you can use:

IMAQ ImageToArray
Extracts (copies) the pixels from an image, or part of an image, into a LabVIEW 2D array. This array is encoded in 8 bits, 16 bits, or floating point, as determined by the type of input image.

Matt

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 5 of 8
(4,831 Views)
HI Bruce -

It sounds like the other members have already answered your question, but I'll follow up just to be clear:

The IMAQ ImagetoArray function is indeed the one you're looking for.  This function will change your Image datatype (which is a pointer to the memory buffer holding the image -- though it's important to remember that the buffer contains header data in addition to the image pixels themselves) into a LV array.  This function is available with recent versions of the NI-IMAQ driver, including the current version (3.5.1).

The reverse function, IMAQ ArraytoImage, is only available as part of the Vision Development Module.
David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 6 of 8
(4,815 Views)

Hi:

 

I have a similar question to this thread, and have searched through the Discussion Forum but not finding a clear answer...

 

I have images streaming in from my GigE camera and wish to continue to display them in real-time as I have currently, but now would also like to trap the last 50 images acquired into an array. This is useful if my machine estop's for whatever reason, the user can then review the last 50 images to look for the cause of the problem. I only am displaying the images - no image analysis is currently required. I understand that the image data on the wire being passed are only pointers to the images in one memory location and not the actual image data itself, so using standard array building (copying) from the image wire will not work.

 

At the code level I'm having a problem inside the while loop copying the actual image data into some sort of an array [to a different memory location] suitable for displaying on the front panel so the user can just scroll through them. As I understand it, the IMAQ Copy function would be the one to use but is not found in the Vision Acquisition module - only the Vision Dev module.

 

Any ideas on how to copy images to an array without IMAQ Copy, or other ways to solve this problem, are welcome!

 

Rick 

0 Kudos
Message 7 of 8
(4,085 Views)

I don't have any real experience with IMAQ, so I'm not sure what the streaming code looks like, but if you can just generate a new reference for each image, you can presumably simply have the array of reference and close the references only as the exit the array (or even reuse them so you don't have to repeatedly open and close references).

 

If you can't do that, I presume that using the Image to Array function mentioned earlier in the thread should work. You can convert every single image into an array and push that array into a lossy queue with the size 50. If you need to review the images, you flush or preview the queue. This will probably have undesired performance implications, as it will require you to convert every single image, even if you're not going to use it.

 

This is the best I can do with any practical IMAQ experience.


___________________
Try to take over the world!
0 Kudos
Message 8 of 8
(4,049 Views)