Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

finding max intensity, threshold range


I have an image which I'm taking the intensity of.  I start my low value range high, then decrement until I am able to find a single particle.  My problem is that I'm not sure what to use for an absolute upper, and an absolute lower range.  In vision assistant, I'm finding that the ranges are varying on every image.
 
For instance, one of my ranges read from -247 to 185, while another one is reading from -79 to -1.  I originally thought the universal range was 0 -255, but apparently that isn't the case.  I want to be able to start from the highest threshold (if there is a distinct value), then lower it until I find 1 particle.  The range can vary with each image, I just need to apply a threshold filter on every one.  Original image type is a grayscale (U8).  I appreciate the help.
0 Kudos
Message 1 of 5
(3,798 Views)
Hello system_eng!

Thank you for using National Instruments discussion forums.  For an 8 bit intensity image the pixel values should all be between 0 and 255.  So when performing a threshold on an 8 bit image it is not possible to be outside of this range.  I am a little confused on where you are getting these other ranges.  If you wouldn't mind posting a screenshot and maybe your Vision Assitant Script I will be happy to take a look at it.  Thanks and have a great day.

Regards,
Mark T
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(3,779 Views)

Hi Mark,

I'm attaching two of the images that I'm trying to process, as well as two of the small screen shots from my Vision Assistant.  I'm only showing you a screen shot from the configuration window, since I only have two processes right now (open image, and grayscale > threshold).  As you can see the threshold range breaks the 0-255 bounds.  I'm not sure if you need to see any labview code, but this is pretty much all I'm working with at this point.  If you need to see anything else, please let me know.

threshold.jpg: 1 corresponds to the 01.jpg, while 2 goes with the 02.jpg

Download All
0 Kudos
Message 3 of 5
(3,775 Views)

Hello systems_eng,

According to the .jpg files you have attached you are actually working with signed 16 bit images (I16) not unsigned 8 bit images (U8).  The valid range of pixels in an I16 image is from -32,768 to +32,767.  So when you perform a threshold on an I16 image in Vision Assistant the upper and lower values that are shown on the histogram are the MAX and MIN values of the image.  This is done to show greater detail in the histogram so you can better determine a threshold point.  In LabVIEW you can still start at the maximum and minumum possible pixel values but there will be significantly more iterations as opposed to the U8 images.  Ideally you would do like Vision Assistant does and find the MAX and MIN pixel values of your image programmatically each time and then increment/decrement those values until you have isolated 1 particle.  This discards all the pixel values that are not represented in that particular image.  If you want you can also use IMAQ Cast to convert the image into U8 but you will lose some image information due to truncation.  For more information about image types and conversions please refer to the Vision Concepts Manual.  I hope this information has helped.  Let me know if anything is unclear.  Thanks and have a great day.

Regards,
Mark T
Applications Engineer
National Instruments

 
0 Kudos
Message 4 of 5
(3,757 Views)
Sorry that was my mistake.  I saw that the threshold output was (U8), instead what the input was (I16).  But I did take your advice to find the max intensity.  I used the histogram function to find the max and min.  Knowing my upper, I set the lower to the determined max found.  Now instead of mulitiple iterations, there is only one, while keeping the same functionality.  Thanks again.
0 Kudos
Message 5 of 5
(3,750 Views)