Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Use of GetPointsOnContour

Hi

I am studying machine vision, and I need to obtain one list with the values of the contour of a part and the respective curvature. Later I want to pick the point with larger curvature and try to reconstruct the image with less points. I made some tests using the function GetPointsOnContour, and it work pretty well, but in some cases the program shows points of one unique part as separeted points.  The  problem occours often with figures who have corners with small angles. Same problem occours with images with thickness larger than 1 pixel.

I am using LabView 8.20 with the latest IMAQ package (evaluation version downloaded from the NI site). There is the example I am working on, and one image.

There is a way to do it right?

Thanks for the help!

Marcelo Gaudenzi de Faria
0 Kudos
Message 1 of 9
(4,781 Views)
Hello Marcelo,

it is not clear for me what are you trying to do. But you get three segments from the function "Imaq GetsPointOnConture" and you use the third one. If you want the points from your imaq input you need the segment 0. I tested it out and it works fine. Please use the numeric input to change the colour of your input to see that you get the correct contour.


Kind regards,

Elmar
0 Kudos
Message 2 of 9
(4,747 Views)
Hi Elmar

First of all,  thank you for your reply my message.

What I am trying to do is to, from one binary image, get the contour of it and using the function GetPointOnContour, get all the pixels in the board. The problem is the function keeps splitting one unique figure in several parts. That is my problem. I could pick all the points in the result of the function and joint them to form one list, but in the case where I have two or more diferent parts to extract the contour, it will not work.

I do not understand your program. The Outputs  "Segment Information" and "cluster", just after the function block GetPointOnContour, keep showing different segments with only 2 points inside each.

It is a problem with the function at all, or could be a problem with my version of the software?

Thanks again!

Best Regards

Marcelo




0 Kudos
Message 3 of 9
(4,745 Views)
Hello Marcelo,

if you need the hole point you have to read out all point in the different segemts and store this point in an array. So that you have all point of your countour.
Another way is to convert the binary image in to an array. And use the array search function. Is the pixel greater 0 -> store the index of x and y.

Kind regards,

Elmar
0 Kudos
Message 4 of 9
(4,740 Views)
Hi Elmar!

Yes, I can search all the array for the point and than join all the points, but when I have more then one part, it will consider only one piece, so it is a huge problem for my project. The another way also works, but I need the point in the right order (chain), because later I want to use complex Fourier Descriptor in those points.

If the problem is with the function, I could consider to make one function to work in my problem.

Thanks!

Best Regard

Marcelo
0 Kudos
Message 5 of 9
(4,738 Views)
Hello Marcelo,

the problem is in the function you will always get segments. So you have to create your own functionality.

Kind regards,

Elmar
0 Kudos
Message 6 of 9
(4,732 Views)
You should look at the thread linked here: http://forums.ni.com/ni/board/message?board.id=200&message.id=14826#M14826

I think it should be helpful to you.

Kevin C.
National Instruments

0 Kudos
Message 7 of 9
(4,724 Views)
Hi Kevin

Yes, I works as the expected with all the examples I have here. The good thing in the GetPointsOnContour function is that it gave already the curvature os the points, but this is easy to do!

Thank uoy very much to you and Elmar for helping me!

Best Regards

Marcelo Gaudenzi
0 Kudos
Message 8 of 9
(4,714 Views)

MaskToROI seems to do a good job creating those uniform contours. I also have occasional problems when GetPointsOnContour leaves segments open and then interprets the curvature wrong. How did you associate a curvature profile with the contours from MaskToROI? I cannot seem to find a way.

0 Kudos
Message 9 of 9
(3,892 Views)