LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Edge Detection to Help with Applying a Threshold to an Image

Hello,

 

    I am having a bit of an issue applying a threshold to an image and getting reliable results.  I am thinking using edge detection prior to doing any other image processing could make this work...  but I am at a loss for how to implement it.  

 

    If you look at the image below you will see the root of my problem.  The top set of images and bottom are only a second or 2 apart but the threshold sees them differently, yet the edge detection seems to correctly detect the edges the same.  

 

I only care about the range of pixels that usually makes up the brightest part of the image (hence the thresholding)  but the low end of that range changes from frame to frame and I am left with an incorrect determination.  

 

My question is, does anyone know of a good way to use edge detection (or maybe some other method that I am not aware of) to help me with this problem?

 

edge detect vs thresh.png

0 Kudos
Message 1 of 4
(3,379 Views)

What are you using the edge detection for? It seems that you only result you are interested in is the threshold image. If this is the case it will be very difficult because your threshold is not well defined due to the images you are working with. If you select a pixel value of 150 and the majority of your image lies around 150 you will see lots of flickering and different results as minute changes in pixel values drastically change the resulting binary image.

 

You may try some dilating after you threshold but I am not sure if this will negatively affect what you are trying to do.

 

Can you give us a bit more description on what you are trying to achieve with the images? 

0 Kudos
Message 2 of 4
(3,354 Views)

Thanks for the reply!  I have a couple different ROIs set up and I am measuring the amount of space inside the box that the "white stuff" occupies.  (see the image below)  I was a little vague about how I am actually doing the thresholding.  In short, I am not just using the threshold vi and hoping for the best.  I am trying to use an algorithm (using the Gaussian mixture model) that dynamically changes but with the lighting/contrast/brightness of the image always changing it does not always perform that well, whereas the edge detection seems to always find the correct edges.  

 

I suppose I was hoping I could use the edge detection as the base for some kind of mask or something...

 

9sjqlj9.png

0 Kudos
Message 3 of 4
(3,347 Views)

Cathair28,

 

Have you tried to use the IMAQ MagicWand VI? WIth this you should be able to create a threshold within an ROI based off of the edge detection to fill in the area inside of the edge detection. 

 

Let us know if you have any questions on how to use this or if you have any luck with this VI.

 

 

0 Kudos
Message 4 of 4
(3,316 Views)