I have a bunch of scans of the back sides of old photos. Some of them have handwritten notes; many are blank.
Is there a way to run them through IM and get some kind of report back to distinguish the blank ones from the nonblank ones?
Complication #1: many of the photos have a line or 2 of data printed by the photofinisher on the back, typically in a rather crude dot matrix font.
Complication #2: some of them have discolored patches or stains.
Complication #3: often the notes are written very lightly in pencil; readable to the eye but pretty low in contrast.
Enhancement: could IM generate a compressed, contrast-enhanced JPEG of nonblank images it finds? Readability and small file size are more important than image fidelity.
My idea was to assume that blank images would compress better than nonblank ones, and use the file size of the compressed image to tell whether it was blank or not.
Thanks.
Detecting blank scans
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Detecting blank scans
Do you consider complication 1 and 2 as blank or not blank?
Re: Detecting blank scans
Complication 2 is definitely a blank.fmw42 wrote:Do you consider complication 1 and 2 as blank or not blank?
Complication 1 (photofinisher imprint) should probably be treated as blank, at least as the default option, if possible.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Detecting blank scans
Not an easy problem unless it is absolutely blank.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Detecting blank scans
I would threshold the image first or other types of convertsion to pure black and white. Fred Weinhaus has a lot of scripts and alturnative to simple threshold too.
Once in black and white output a histogram report to get a count of the number of 'valid' pixels. That will give you a good measure of the amount of information on the page. If you have a speicific line or area that appears offten and you don't want included in the count, overlay a mask or draw white to blank that area before getting the pixel count.
Once in black and white output a histogram report to get a count of the number of 'valid' pixels. That will give you a good measure of the amount of information on the page. If you have a speicific line or area that appears offten and you don't want included in the count, overlay a mask or draw white to blank that area before getting the pixel count.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/