From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Simple Edge having trouble finding the edge

Hi all,

 

I'm using LabVIEW 2013 SP1, and Vision Assistant 2013 SP1.

I read gray scale images from a CameraLink camera, and save them to disk.

After I capture all the data, I go back and read from the file.

 

The images are 1400 pixels wide, by 500 pixels tall, 8 bit grayscale.

The images are of a biologic nature, so the brightness, contrast, reflectiveness, all vary from subject to subject (each file is of a single subject).

 

For each image, I find a reflection with pattern matching and that works well.

After I find the reflection, I calculate a region of interest (Rectangle, 3 pixels wide, 280 pixels tall, centered on the reflection).

I pass that ROI information to IMAQ ROI Profile (along with the image of course).

That VI returns the Pixel Coordinates.

I pass the Pixel Coordinates to IMAQ Simple Edge.

All that seems to be working well.

 

Within my defined ROI, I search for an edge (set to Get All Edges).

I pass in the parameters, Level Type 'Absolute', Threshold Level 40, Hysteresis 2 (for example)

From the returned edges, I sort the array, and take the one with the lowest Y value as the 'top' edge.

 

From frame to frame the feature that is the 'top edge' moves, as it should.

What I need to have happen is to find that same feature as the 'top edge' frame after frame, so I can track its movement over time.

 

I've tried changing the ROI so that it moves along with the previous location of the top edge (instead of always 280 pixels tall, it would be 50 pixels tall centered on the last location of the top edge).

That didn't help.

 

I've tried changing the threshold level from 20 to 100, and sometimes it's better, but sometimes it's worse (various biologic subjects).

 

I'm looking for suggestions to try for better edge detection.

Is there a tool I can use before I do the edge detection to help out?

Is there a better way to perform the edge detection?

 

Feedback and input are appreciated.

 

Thanks,
Jeff

 

 

 

 

 

0 Kudos
Message 1 of 4
(4,463 Views)

Hi Jeff, 

Its always difficlut to get an exact edge when the pixel intensities vary a lot from one image to another. 

From your post i understand that you are not doing any preprocessing on the image before finding the edges. Is that true? 

If so, then maybe you can try using some preprocessing techniques such as histogram equalization, Look-up table(IMAQ math lookup) to improve the contrast between the background and foreground. Then try using the auto threshold(imaq autoBthreshold) or local threshold(imaq local threshold) to decide on the threshold limit dynamically depending on the pixel intensities, rather than fixing the threshold value and using imaq threshold. 

The you can convert the mask to roi using imaq masktoROI and overlay them on the image to see the edges found. 

Let us know if this works. 

 

Regards

Aveo

0 Kudos
Message 2 of 4
(4,450 Views)

Hi Aveo,

 

Thank you for your reply.

 

No, I am not doing any preprocessing, just the steps that I mentioned.

 

Thank you for your suggestions on preprocessing steps, I did read about them.

After doing that research, I created a new indicator, showing the pixel brightness along the vertical box in which I'm search for edges.

By looking at the display of pixel variation, I can clearly see the edge that I want to find, the challenge was to have LabVIEW find the same edge.

So, I played around with the Threshold Level and Hysteresis a bunch.

I get pretty good results now.

 

I'm not sure exactly what the Threshold and Hysteresis do, the help file was woefully inadequate on that score.

 

It's working better at the moment.  If I run into  more difficulties, I'll try out some of the preprocessing options.

 

Thanks,

Jeff

0 Kudos
Message 3 of 4
(4,395 Views)
Please refer http://zone.ni.com/reference/en-XX/help/372916L-01/nivisionconcepts/edge_detection_concepts/ for simple edge detection how it detects edges and the use of threshold and hysteresis.... Also remember this "The simple edge detection method works well when there is little noise in the image and when there is a distinct demarcation between the object and the background".
Thanks
uday
Message 4 of 4
(4,389 Views)