LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to fill convex in an image

I need help finding a away to fill in a convex in an image.  I tried using vision assistant, but did not find a feature to do so.  

What I want to do looks like the image in this link:

 

http://flylib.com/books/1/511/1/html/2/FILES/04fig74.gif

 

I found something called "IMAQ Convex Hull VI", but I'm not sure how to use it.  I can't find examples using this either.  Does anyone know how to fill in a convex?

0 Kudos
Message 1 of 6
(4,378 Views)

Hey EE_CS,

 

Here is an example that should help you get started;

 

EE_CS.png

 

The trick is to use thresholding to get a binary image, which you can then use the Convex Hull on. Here is a more complex example using the convex hull tools that you might find instructive. Hope that helps!

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 2 of 6
(4,359 Views)

Is there a way to better control where I want the convex filled?  If you look at my attached image, the left image becomes the right after trying convex hull.  However, I only wanted the small convexes in black to be filled with white (I do not want the zig zag path to be filled).

0 Kudos
Message 3 of 6
(4,332 Views)

If you are just trying to get a cleaner edge on that image near that zig zag path, you might have more luck using Close rather than trying to fill convexes. The zig zag path is a convex, so it is always going to be filled by that tool. Check out this code;

 

EE_CS2.png

 

That yields this image;

 

Capture.PNG

 

Hope that helps!

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 4 of 6
(4,312 Views)

Thanks. The close helped a little.  However, even though I used your provided example, the fill isn't nearly as nice looking as yours.  Here are my results of using close.

0 Kudos
Message 5 of 6
(4,294 Views)

I would recommend using the Vision Assistant to "prototype" your image processing. It allows you to iterate more quickly and test changes to certain parameters. You can also generate LabVIEW code with it. It is an express VI that you can find in Vision and Motion >> Vision Express >> Vision Assistant. That is how I prototyped the code I posted. Try experimenting in there to get the results you want.

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 6 of 6
(4,272 Views)