2

I have a binary image [0,1]. I want to use Python to find the edge of the image. I have tried sobel method on the binary but it provides a bad result. I expect the output like the image enter image description here

1 Answer 1

13

The best way is to apply a 1-pixel morphological erosion, then take the difference between the input image and the result. In pseudo-code:

edges = image - erosion(image)
Sign up to request clarification or add additional context in comments.

1 Comment

You saved my life. This is code edges = image - ndimage.morphology.binary_dilation(image)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.