Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Adaptive threshold of blurry images

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