10-24-2013 05:52 AM - edited 10-24-2013 05:54 AM
I am using contours to analyze the form of a irregular shape. To do this the list of contour points should be in a logical order (e.g. clockwise). The contours I get from "GetPointsOnContours.vi" are not (always) arranged in a logical order. Can anyone help me with either ordering the contour points (which is not trivial) or getting the contours in a ordered way out of the VI?
Curious if anyone ran into the same problem!
Jeroen
10-24-2013 07:52 AM
Hi
I believe that the points are found on a raster scan basis and not angular. To convert between the two
1) Average all of your points, to find a centre.
2) Apply that as an offset to every point(subtract from the array)
3) For each point treat X and Y as real and imaginary and convert to Polar. bundle these as a cluster with angle first
4) Sort the array that this creates
5) For each point convert back to X and Y
6) Add the offset back on
All of your points should now be in angular order
Mike
10-24-2013 08:13 AM
Yes I think this works for most shapes, but shapes with lobs curving backward (or so) this probably will not work.
maybe something like this (two funny lobs pointing upward, connected at the base):
.... . . .
. . . .
. . . .
. .
..........
10-28-2013 04:43 AM
Hello J-Snow,
Do you have a data set that contains this contour points?
This would allow me to test some things with it.
10-28-2013 05:34 AM
Hello Thierry,
here is a contour that shows what I want to solve. 2 times the row of points switch to an other side of the contour. If it does not make sence, please let me know.
Thanks a lot,
J
10-30-2013 06:10 AM
Thanks for this information!
As far as I have understood you are using the IMAQ GetPointsOnContour VI, correct?
If you are using another VI, then please elaborate on where it is from.
Do you also have the original image where you start from?
10-31-2013 07:41 AM
Thanks for looking into this problem!
Yes the contour is generated with: GetPointsOnContour.VI
I will send you the image.
11-05-2013 04:51 AM
Hello J_Snow,
Did you send the image already?
I didn't receive anything through the forum.