I have used Canny edge detector to detect the edges of an image. The results are shown below:

Imgur1

I would like to remove everything except for the outline of the edges. The desired output is shown below:

Imgur1

I have tried a series of morphological transformations (specifically eroding/dilating and opening/closing), however, these transformations also removed the outline of the image. I tried using median blurring, but that also removed the outline edges.

1 Answers

1
Deep On

You can select the Region of Interest by selecting five points of a polygon like the one shown and use Numpy's polyfit function to fit lines of a polygon and meshgrid to find region inside, to mask the edges inside your selected region and obtain everything else from outside.

enter image description here