Search code examples
c#opencvimage-processingedge-detection

Extracing Outer Points On Edge of a Shape


I need a good method for demonstrating outside of a shape using points. I need an algorithm to give me some points located on the outside of a shape.

What's a good start?

enter image description here


Solution

  • OpenCV has solution for you, but it depends on accuracy. You can start from approximate chain -- it will approximate your shape by polygonal curve and gives you vertex coordinates. You can always make it more precise testing it bypointpolygontest OpenCV function or fitting by fitLine function. Sure you need first to find edges (openCV has Canny edge detection etc) and countours first (see links above for findContours function description). So your steps are:

    1. find Edges
    2. find contour
    3. approximate contour by polygonal curve
    4. fit polygonal curve