Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Unsigned 12-bit Images

I've been testing my app happily using 8-bit grayscale, and now it's time to step up to 12-bit. I find the Vision buffers and various displays and functions in NI-Vision support only a SIGNED 16-bit grayscale format.
 
What the?  Surely a lot of users would want to input 16-bit unsigned data without going through the conversion nightmare outlined in
 
(you can't be serious)
 
I'm a newb. I don't want to frig around doing all sorts of unnecessary casting on my 12-bit images (and waste loads of performance) - is there a simple way to do this?
 
regards,
Lamb
0 Kudos
Message 1 of 5
(3,565 Views)

Hi, Lamb,

If you working with 12 bit, then - you're lucky. Just don't worry about signed representation. In your case black is zero, and white is 4095 gray values. You don't need to cast unsigned/signed and back in this case.

best regards,
Andrey.

 

0 Kudos
Message 2 of 5
(3,558 Views)
Thanks Andre - absolutely right for using 12-bit; I guess I was jumping ahead to when I start using 16-bit inputs.
 
From your expression "you're lucky", I assume the news is not good in that case and I'm stuck with this nasty scheme of conversions - so it's a good reason to avoid 16-bit graphics in LabVIEW (?)
 
As I said though, I'm a newb - excuse my ignorance but why would anybody want to use a signed 16-bit grayscale? It seems to me a grayscale would always be more useful as a contiguous positive range. Is this some whacky historical thing?
(In which case I would expect NI would have provided Gray-U16 for simplicity going forward).
0 Kudos
Message 3 of 5
(3,536 Views)

Hi, RichLamb,

I mean that up to 15 bit you have no problems with signed representation. But if you have full 16 bit range, then in some cases you should fugure out how to handle such images. For example, some my customers frustrated with histogram with range -32768...32767, Image Info also contained negative values, and I should correct these values every time and so on. Also acquisition devices usually deliver unsigned 16 bits, and they must be converted to signed representation for IMAQ Vision... In some cases for me more easy to cut low significant bit, than dealing with signed representation.

Andrey.

0 Kudos
Message 4 of 5
(3,529 Views)

OK - thanks. Limiting to 15-bit sounds like the approach. Chopping off the lsb is a good idea too.

cheers

0 Kudos
Message 5 of 5
(3,515 Views)