LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get Contours points in a logical ordering (e.g. clockwise)?

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

0 Kudos
Message 1 of 8
(3,020 Views)

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

0 Kudos
Message 2 of 8
(3,004 Views)

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):

   ....    . . .

  .    .     .    .

.       .  .    .

.             .

 ..........

0 Kudos
Message 3 of 8
(3,001 Views)

Hello J-Snow,

 

Do you have a data set that contains this contour points?

This would allow me to test some things with it.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 8
(2,979 Views)

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

0 Kudos
Message 5 of 8
(2,975 Views)

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?

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 6 of 8
(2,942 Views)

Thanks for looking into this problem!

 

Yes the contour is generated with: GetPointsOnContour.VI

 

I will send you the image.

 

 

0 Kudos
Message 7 of 8
(2,927 Views)

Hello J_Snow,

 

Did you send the image already?

I didn't receive anything through the forum.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 8 of 8
(2,907 Views)