What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Preparing a photo for the OCR


gik25

New Member
Messages
1
Likes
0
I want to make grey pixel near to black pixel to be darker. And grey pixel near white pixel become lighter. I also want to make green and red pixel become white. How can I do? Which technique would you prefer? I've tried for weeks but I cannot find an idea that depends upon near pixel and levels and color.

imageshack.us/a/img35/6168/immagine1vkq.jpg

imageshack.us/a/img811/6304/imgwqf.png
 

Attachments

  • Immagine 1.jpg
    Immagine 1.jpg
    301.3 KB · Views: 1

Tom Mann

Guru
Messages
7,223
Likes
4,343
"I think stamp tool is the best solution for your problem." - I think one would get extremely tired after using the stamp tool at the pixel level on a page or two of text. :rolleyes:. You need something more automated.

Getting rid of the color is easy. The easiest approach is to simply desaturate the image, or, if the text is always black or gray, just select pixels with saturation more than 5 or 10% and turn them all white. You can do this using plugins such as Asiva "Select" or an old one called HSB/HSL (that still works fine in CS6) followed by some fiddling around with the S and L channels.

The second half of your question is a lot more involved. Take a look at the image processing operators, "open" and "close", e.g.,
http://en.wikipedia.org/wiki/Opening_(morphology)
http://en.wikipedia.org/wiki/Closing_(morphology)

If you are technically / mathematically inclined, for lots good background info on them, go to:
http://en.wikipedia.org/wiki/Mathematical_morphology

Such operators (including "erode" and "dilate"), are commonly used for tasks like this. Unfortunately, I don't know of any good implementations of them as photoshop plugins or easy image editors. They are certainly available in Matlab and, if memory serves me, Mathematica and also J-image (from NIH). The latter might be the most useful to you.

The only implementation of erode and dilate (no "close" and "open") that I know about in an easy-to-use image editing program is in Photoscape 3.6, but I don't consider their implementation very good / flexible. If anyone knows of good implementations of these operators somewhere else, I would love to hear about it.

Cheers,

Tom M
 
Last edited:

Tom Mann

Guru
Messages
7,223
Likes
4,343
Here are two examples. The first image is a small crop of your longer document for comparison purposes.

The 2nd image is the same image after using ASIVA Select (mentioned above) twice. First, to change the color of the lighter colored random pixels to white, then, on a 2nd pass to change the color of the darker (but colored) pixels to black.

I'm not at my work computer, so I didn't have access to any of the morphological image transformations mentioned in my earlier post, but I did have Medhi's Flat Median plugin on this computer. It is not as good as the correct mathematical operations, but it does help a bit: You can see that some of the white pixels in the letters are filled in by using it.

HTH,

Tom M
 

Attachments

  • imgwqf-01_ps02c_cropped-stacked_3_hi-01.jpg
    imgwqf-01_ps02c_cropped-stacked_3_hi-01.jpg
    344.7 KB · Views: 1

Top