Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ does not support full U16 camera - how do I fix this?

I am trying to get U16 data from a 16-bit grayscale camera and IMAQ is reading it in as I16. This means that pixel values above 32767 are being converted from the range 32768 to 65535, to 0 to -32767. Is there a way to reconvert the data back without doing a pixel-by-pixel manipulation (which is too processor intensive and stops the acquisition)? 
0 Kudos
Message 1 of 6
(4,633 Views)

Hi Nasgul,

 

As a quick answer, this example: http://decibel.ni.com/content/docs/DOC-4759  Does what you would like, only in reverse.  So, instead of subtracting 32767, you would add 65535.  If this solution is too processor intensive, then we can look into your code structure and find a better way to do this (queues, producer/consumer, etc).  

 

Before doing this though, I wanted to make sure that you are using that IMAQ Create, and have the U16 (Grayscale) wired up to the Image Type.  If so, then what type of camera are you acquiring from?  What interface (CameraLink, Analog, etc)?  What version of the driver do you have?

 

Thanks, 

Marti 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 2 of 6
(4,603 Views)

Hi Nasgul,

 

 

As Marti indicated, you can do a conversion of the data using something like the link here: http://digital.ni.com/public.nsf/allkb/3C727E03F004EA528625714900706CA0

However, as you pointed out this may not be very fast since it requires modification of every pixel.

 

Currently the IMAQ 4.3.0 driver (included in Vision Acquisition 2009) does not support directly returning U16 image types. However, based on requests like yours, we will be adding true support into the IMAQ driver to directly return images with a U16 data type in an upcoming release. However, I cannot give any details at this point as to when it will be released.

 

Eric

 

0 Kudos
Message 3 of 6
(4,597 Views)

After a hiatus, this problem has reared its ugly head again.

 

The issue I am having is as though the conversion in the previous article has already happened - the camera is streaming U16, but it is being read bitwise by LabView as though it is I16, so the 2's complement error is already built in and I need to remove it. I can't conceive of a simple subtractive method to accomplish this - is there a mathematical solution apart from making a pixel-by-pixel adjustment?

 

The conversion that I'm trying to undo is attached.

0 Kudos
Message 4 of 6
(4,476 Views)

Hi Nasgul,

 

I'm not personally aware of a better way to do it, but you might want to keep an eye out for a future release that includes it as Eric pointed out.

Jeff | LabVIEW Software Engineer
0 Kudos
Message 5 of 6
(4,436 Views)

Hi Nasgul,

 

Upon some further reflection, I came up with a quick hack that will let you "reinterpret" an I16 image into a U16 image without having to touch the pixel data. This should allow you to work around this problem until IMAQ allows camera files to specify an unsigned 16-bit image type.

 

Please try out my attached file with the following caveats:

-The file will only work on 32-bit LabVIEW versions (8.2+) and is Windows-only. Please let me know if you need RT or 64-bit VIs (I can't make one that does everything without it being 2009+)

-The VI is password protected because it touches some internals in a very ugly way. You really don't want to see the code! 🙂 

 

Let me know how it works,

Eric 

Message Edited by BlueCheese on 01-12-2010 11:56 PM
0 Kudos
Message 6 of 6
(4,413 Views)