Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

binary threshold - U16 Image

Solved!
Go to solution

I have a simple example which I have attached (Vision 2013 but can save for previous if need be) in which I would like to apply binary thresholding to a range of values (minimum --> mean) in a U16 image.  This example is based on the particle analysis binary threshold example included with Vision for U8 images.  The thresholding does not appear to be working properly (to hilte the range of values red) and areas outside of the range appear to be getting thresholded as well.  Ultimately, what I would like to be able to do is actually display the gray scale (rather than binary) image and have the thresholded range show in red against the gray scale image.

 

Any thoughts.

0 Kudos
Message 1 of 5
(5,161 Views)

Try creating the binary image, then using it as a bitmap overlay on the original image.

 

You will need to use image to array to get the binary array.  You will need to multiply by a scaling constant to get the intensity you want, and you might need to multiply by 256 once or twice to switch the color to red.  One neat trick is you can OR it with the transparent color value to make the bitmap transparent - more like a highlighter instead of replacing the existing image.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 5
(5,139 Views)

Bruce -

 

Thanks for taking the time to reply.  The first question that needs to be answered is if the binary thresholding VI is properly working to hilite in red the range of values I have specified (non-zero min --> mean) for a U16 image.  The U8 version of this example VI works just fine.  I wanted someone to run my VI and see that what is getting hilited does not seem to match up with the non-zero min --> mean range.

 

In terms of thresholding on top of an actual gray scale image, another idea is to just find the pixels that fall within the range I have specified, and draw an overlay of points on top of the image.  That should work fine.  However, this is mainly for visualization purposes.

 

I really need the thresholding itself to work properly for 16-bit images in order to do a particle analysis.  So I needed a sanity check to see if somehow I am doing something wrong in the thresholding (this is a pretty simple VI, not sure what could be going wrong, so am wondering if it is not properly operating on U16 data).

 

Sincerely,

 

Don

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

Folks - thanks for taking a look at this.  I believe my problem lay in the fact that I was contrast expanding my image and therefore not feeding in the original image data for thresholding.  At this point, I believe that thresholding is working properly with U16 images.

0 Kudos
Message 4 of 5
(5,090 Views)
Solution
Accepted by topic author DonRothGE

Have some data here to support my last posts on the U16 binary threshold issue where I am thresholding between the non-zero minimum and another specific gray value.  Also used the overlay method for visualization purposes.  The threshold and overlay show slightly different results.  I am including both bounds in the overlay method so I would have thought it would match up exactly with thresholding method.

 

U16-thresh.PNG

0 Kudos
Message 5 of 5
(5,071 Views)