2009/4/22 Eduardo Ismael <ei...@hotmail.com>: > I'm asking because I scanned a bunch of pages from a book to .jpg. The > images are in grayscale, and some pages have tables with gray background > "underneath" black text, and I wanted to get rid of the background.
You'll probably find that the gray is a half-tone: zoom in and you'll see it's a pattern of tiny dots rather than a smooth gray. This is quite hard to remove well. One solution is to blur the image to remove the dots (you need a blur radius that's about twice the dot spacing, and you need a really high res scan), then find all pixels with about that grey level, and set all those pixels in the unblurred image to white. You'll find it doesn't work too well along the edges of text, and you may need to start using morphologies to shrink or grow the mask a bit. And even then it won't be great. You'd probably need to filter in Fourier space to really remove it, and that needs a hge amount of CPU and memory (minutes per page). John _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig