Hello,
I’ve got a directory filled with a couple of hundred images, similar to something like this:
The problem is a lot of these images aren’t centered or don’t take up a lot of the space (e.g. a lot of excess whitespace) so I’d like to crop them.
I tried to crop these images based at row r and column c where sum(img)[r, :] and sum(img[:, c]) exceed a certain threshold. This works in some cases but fails when the edge of the image has a line of black pixels (the images are scanned so a lot of them have this.)
When the image is a thin line drawing this heuristic fails completely.
Examples of hard cases due to thin lines
I’m looking for something along the lines of a filter that is invariant to thin lines, black paper edges…
I’ve already tried using felzenszwalb but that also recognizes the long thin lines along the edge as a blob.
Any help would be appreciated!
Thanks
Jules

