I'm new to Image Processing in Python and I'm trying to solve a common problem. I have an image having a signature of a person. I want to find the edges and crop it to fit the signature in the image.
Input Image
Expected Output
I tried Canny Edge Detection and cropping the image using a list of existing solutions (articles & answers) using PIL, CV2, but none seem to work. I'm looking for a working solution.
Some solutions I tried:
and many more... None worked although seems very simple. I encountered either errors or not expected output using any of the existing solutions.
What you need is thresholding. In OpenCV you can accomplish this using
cv2.threshold()
.I took a shot at it. My approach was the following:
Here was my attempt, I think it worked pretty well.
And here's the result: