Convert color photos of documents to good black-and-white images?

Posted by Norman Ramsey on Super User See other posts from Super User or by Norman Ramsey
Published on 2009-11-25T20:31:18Z Indexed on 2010/05/08 9:00 UTC
Read the original article Hit count: 312

Filed under:
|
|
|
|

Since I don't have a copier or scanner, I'm using an 8 megapixel camera to copy documents. This works pretty well except they need a lot of processing afterward. I'd like to get from a photo to a bitmap, but using

djpeg -grayscale -pnm photo.jpg |
pgmtopbm -threshold -value XXX

does not work so well, for two reasons:

  1. It's hard to guess what XXX should be, and XXX is different for different photos.

  2. Illumination varies, and sometimes a single threshold isn't what's right for the image.

How can I do better? The ideal solution will be fully automatic command-line program that I can run on Linux. (I have already written a program to remove dark pixels from the edges of images.)

© Super User or respective owner

Related posts about image

Related posts about processing