mzucker / noteshrink

Convert scans of handwritten notes to beautiful, compact PDFs
https://mzucker.github.io/2016/09/20/noteshrink.html
MIT License
4.81k stars 351 forks source link

Doc photos taken by cameras #45

Open zqngetsu96 opened 3 years ago

zqngetsu96 commented 3 years ago

Hello,

First of all, gotta say that this work is insanely good. I've been trying to apply for pictures taken by cameras instead but as this work is mainly aimed at scanned documents, I've been having fairly noisy results(images below). I've wondered if you have any tips to handle documents that have fairly varying light distribution(not as uniform as the light from a scanner) would it possible to get a clean white background on the image?

Thank you in advance

original Saved_file copy 3

with noteshrink page0000

zvezdochiot commented 3 years ago
zqngetsu96 commented 3 years ago

@zvezdochiot Oh man thanks that's pretty cool actually it will help a lot in the BW scanning. But for now, I need the color scanning as well. Any leads on thresholding colored images (basically to get a full white background)?

zvezdochiot commented 3 years ago

@zqngetsu96

  1. Use PIL to average the original and bw images.
  2. Use T in IntegralThreshold not as a threshold, but as a normalizer: N=(128/(T+1)).
zqngetsu96 commented 3 years ago

Thank you, am gonna try this out :')