ghostman February 2016

Advise filters to improve text visibility on photo

I need filters to improve text visibility on photo, since it has some noise. Which filters (algorithms) do you know for this purpose?

Now, I use monochrome filter but it doesn't improve image quality. I need to filter can determine medium background of little area and make image monochrome depending on medium background.

For example almost all picture background is white and grey characters but some areas has darker color (grey) and black characters. I need to algorithm can understand that some area of image more darker and make level of black accepting lower.


For example, source image: Photo
And processed photo (median, monochrome filters) Processed photo

Answers


Piglet February 2016

You could provide an example image.

If you want to make an image black and white you can use a threshold operation as long as your text is darker than the darkest background value.

Compare every pixel vs the global threshold. If higher set it to new value a, if lower set it to new value b. For equals you have to choose one option.

If not you can use a so called local threshold. Here you calculate the threshold for every pixel from its sourrounding. There are many algorithms for calulating that local threshold value.

To name a few local thresholding algorithms: Bernsen Sauvola Mean Median MidGrey Niblack

They all calculate threshold values based on some limited area around your pixel.


George Profenza February 2016

Unfortunately I'm not able to provide an accurate and fast answer using an image processing package in code, but I can provide some hints based on some really quick tests done in Photoshop(sorry, visual thinker, slow typist). Worst case scenario, you can run Photoshop filters from Matlab, but the filters are used should be available or not to difficult to implement since I've constraint myself to:

  • Curves
  • Levels
  • High Pass

In simple terms, I recommend first getting read of the gradient dark to bright gradient: it will be easier to play with contrast/threshold on a more even image. In Photoshop I applied curves (which other people wondered about implementing in code)

curves curves settings

Not perfect, but it illustrates the idea of cancelling out a bit of that strong gradient.

On the resulting image I applied levels

levels levels settings

Afterwards, a high pass: high pass

You can use the high pass result and blend it (overlay) with the previous step which will emphasise the details

Post Status

Asked in February 2016
Viewed 2,782 times
Voted 14
Answered 2 times

Search




Leave an answer