Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

The Theshold Data output of AutoMThreshold with 16 bit image results in 0-255

I have a an I16 image going into AutoMThreshold and what comes out is always 0-255 (as a single) when it should be 0-4095 (My camera has a bit depth of 12). Am I doing something wrong?

 

Assuming there's no way to get an I16 out of AutoMThreshold, do I bit shift the result by 4 bits or 8 to get the right answer? 

CLED (2016)
0 Kudos
Message 1 of 11
(4,980 Views)

Hello,

 

These are statements in the Detailed Help for the IMAQ AutoMThreshold function:

 "Number of Classes is the number of desired phases. This algorithm uses a clustering method and can use any value between 2 and 256. The default value is 2."

"Lookup Table is an array containing the values of the 256 transformed elements encoded between 0 and (n – 1), where n is the Number of Classes. You can connect this array to the IMAQ UserLookup VI to perform a threshold operation directly."

"Threshold Data out outputs an array containing the Number of Classes compatible with the IMAQ MultiThreshold VI. The results range from 0 to (n – 1), where n is the Number of Classes"

 

As you can see, the outputs of this function can only have a value that ranges from 0 - 255. I hope this helps.

 

 

 

Vivek Nath
National Instruments
Applications Engineer
Machine Vision
0 Kudos
Message 2 of 11
(4,949 Views)

Maybe I was not clear enough. I'm not talking about the number of elements in the Threshold Data output. I'm using the default number of classes (2) and I get an array of clusters with indices 0 and 1 as expected.

 

The upper value and lower value pixels inside the clusters are coming out wrong though. For example if I have a 12 bit image represented with an I16 image type and my noise floor is roughly 1000 I won't get 1000 for the upper value of the cluster with index 0. I'll get something on the order of 170  or something. Even if I get a mostly white image with the average pixel value around 3500, I still won't get anything above 255 for my upper value. I'll get something like 220 or something. 

Message Edited by InfiniteNothing on 12-29-2008 01:23 AM
Message Edited by InfiniteNothing on 12-29-2008 01:23 AM
CLED (2016)
0 Kudos
Message 3 of 11
(4,945 Views)

Can someone try out autothreshold for me with an I16 image and see what they get out for upper value of the first cluster coming out of Threshold Data output? Does that threshold value make sense for your particular image? 

TIA  

CLED (2016)
0 Kudos
Message 4 of 11
(4,891 Views)

I tried it out on my end and noticed the same behavior. We will look into this further on our end; look for another post sometime soon.

Vivek Nath
National Instruments
Applications Engineer
Machine Vision
0 Kudos
Message 5 of 11
(4,859 Views)
Thanks! I'm subscribed so I'll get an email to any updates to this thread.
CLED (2016)
0 Kudos
Message 6 of 11
(4,854 Views)
Upon investigating this further, it definitely looks like the AutoMThreshold function gives legitimate values only with U8 images, not I16. I do apologize for the inconvenience; I have informed the R&D department here about this.
Vivek Nath
National Instruments
Applications Engineer
Machine Vision
0 Kudos
Message 7 of 11
(4,823 Views)
Thanks for looking into this. If it helps, my impression is that the AutoMThreshold normalizes the image by bit shifting it only as many times as neccesary to  get all the values to U8s. I'm thinking as a work around I'm going to try and put a white pixel (4096) in the image so that the number of shifts is known.
Message Edited by InfiniteNothing on 01-13-2009 10:44 AM
CLED (2016)
0 Kudos
Message 8 of 11
(4,818 Views)

Has a CAR been issues/corrected, I have the same issue in LV 2009 currently.  I need to threshold a 16bit image into multiple classes and do not want to write my own if possible.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 9 of 11
(4,322 Views)

As a crude workaround you could use Image Cast to take it down to 8 bit and then use the autothreshold and then just multiply the results by 256.

Message Edited by InfiniteNothing on 03-15-2010 11:15 AM
CLED (2016)
0 Kudos
Message 10 of 11
(4,318 Views)