6
$\begingroup$

I try to run text cleaning process based on the camera captured image.

By using OpenCV adaptive threshold method with parameter (255.0D, AdaptiveThresholdType.MeanC, ThresholdType.Binary, 15, 10.0D), almost all gives satisfactory output but below example gives poor cleaning result (background is not removed well).

enter image description here

(Image from Fred's ImageMagick Scripts - Text Cleaner)

Question 1. I'd like to know which factor cause poor result in this example.

My Question 2 is, which approach can discriminate my attempt(OpenCV) is failed based on the above result? Or, which approach can help to decide whether AdaptiveThreshold will fail or not before running it?

IMO, the pass/fail factor can be a number of background particles but I don't know how to measure it.

I tried Erode method in OpenCV to remove particles, but it gave over whitened result and made too skinny text.

$\endgroup$

3 Answers 3

1
$\begingroup$

Some guidelines for using Thresholding:

  1. Stretch the image to use the whole Dynamic Range (DR).
  2. Apply some Denoising (Very very gentle).
    Median with small radius would be a good idea.
  3. Unless you hand tweak the Threshold, Otsu's Method generally yields good results for this kind of tasks (Text on background).
  4. If one use Adaptive Local Methods (Mean / Gaussian based) the Radius is another hyper parameter to tweak.
$\endgroup$
2
$\begingroup$

This binarization fails because the size of the filter is too small, so that some of the regions it processes are uniform. Increase the filter size and you'll see great improvement.

enter image description here

$\endgroup$
-1
$\begingroup$

Try using normal Thresholding function in OpenCV with type THRESH_BINARY.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.