Question

I have a shape which you can imagine as a lake in a field observed from the top (2D). I determined the border pixels of the shape after an image processing, so that I have the coordinates of each border point.

Now I want to calculate the perimeter of this shape. My problem is that I have the points not in following order that would give a closed loop, but unordered.

How can a problem like this be solved in Matlab? (including Curve-Fitting-Toolbox etc.)

Thank you for any suggestions!

Was it helpful?

Solution

You can use the function regionprops for this.

Turn your image into a binary image with 1 inside your 'lake' and 0 outside (which you should be easily able to do, as you mention you extracted the boundaries).

Then use:

props=regionprops(YourBinaryImage, 'Perimeter');

You can then access the perimeter as follows: props.Perimeter

OTHER TIPS

If you have set of 3D points with (x,y,z) coordinates, you may set z to zero and use the 2D (x,y) points to find the convex hull using convhull regardless of their order .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top