Adaptive threshold of blurry images

asked 2017-02-17 09:33:47 -0500

alexander33 gravatar image

I have a data set of images and I want make a threshold of them, for this I’ve been using an adaptive threshold, and morphological operations but there are some images like this example with many blur, some idea for to make the digits as clear as possible. I proved the threshold with OTSU, local threshold and adaptive threshold and the results are not good. My code is

Mat plateFinal = imread(".../plate.bmp", 0);

    Mat medianPlate;
    medianBlur(plateFinal, medianPlate, 3);

    Mat clean_img, clean_open, clean_close;
    adaptiveThreshold(medianPlate, clean_img, 255,
        CV_ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY_INV, 27, 7); 


    Mat element = getStructuringElement(0, Size(3, 3), Point(1, 1));

    // Apply the morphology operation
    morphologyEx(clean_img, clean_open, MORPH_OPEN, element);
    morphologyEx(clean_open, clean_close, MORPH_CLOSE, element);

    imshow("image clean", clean_close);

and the result is:

plate1

plate2

edit retag flag offensive close merge delete

Comments

Problem with adaptive threshod is that threshold is relative to mean in each block. When block is homogen threshold is wrong

LBerger gravatar imageLBerger ( 2017-02-17 10:41:19 -0500 )edit