Say we have a picture of a page with text on it. However, a threshold is not sufficient. On an example image, the page has a large shadow that covers half the image, such that at some points, there is paper that is darker than the lightest ink.
What's the best way to get a mask of the ink on the page? I'm thinking it's something like edge detection, although I wouldn't then know how to select the inner part of the ink.
I'm doing this in Python, so answers in that would be most helpful!