sonovice / smude

Sheet music dewarping, primarily for pictures taken with smartphones.
Other
92 stars 4 forks source link

Disable binarization #5

Closed gorgobacka closed 3 years ago

gorgobacka commented 3 years ago

I already performed some tests and it works good in most cases. It's a great tool.

Is it be possible to deactivate the binarization step or recover the original images after dewarping? I would prefer to do the binarization manually afterwards to get a better result.

sonovice commented 3 years ago

Thank you for the kudos. I'll see what it takes to achieve this. (Time is a rare resource right now due to my newborn daughter, though, so it will take a few days...)

Out of curiosity, which binarization method would you prefer?

EDIT: If you want to give it a try for yourself, the mesh for dewarping is computed here. Beware that the input image is cropped so you would have to apply the same cropping and border adding process to the original image as well, see these few lines.

sonovice commented 3 years ago

Done in 7aedf38. Beware that the output dimensions differ slightly from the binarized output since I am not adding a white border in the end.

I would still be interested in your choice of binarization method.

gorgobacka commented 3 years ago

Thanks a lot. I already played a bit around with the code. But I don't know much about image processing in Python. I think I was missing the part with the channels.

Your code works well. Thanks for the fast implementation even with a little child at home. :)

I think my sentence about the binarization method was a bit misleading. I prefer to use external tools that gave me more control about the applied parameters and additional "smoothing" to get better results. E.g. for books I use ScanTailor-Advanced.

But I think your binarization method and parameters work good.

For a few pictures, I ended up with something like this: smude For such cases, I would prefer to work with the original image instead of trying to modify the parameters in the code.