How to get a clear image after low-frequency image suppression?

I suppress the low frequency DC current of several (unequal) blocks in an image in the Dicrete Cosine Transform (DCT) domain. After that, a reverse DCT is performed to return the image with the remaining parts of the high frequency.

cvConvertScale( img , img_32 ); //8bit to 32bit conversion cvMinMaxLoc( img_32, &Min, &Max ); cvScale( img_32 , img_32 , 1.0/Max ); //quantization for 32bit cvDCT( img_32 , img_dct , CV_DXT_FORWARD ); //DCT //display( img_dct, "DCT"); cvSet2D(img_dct, 0, 0, cvScalar(0)); //suppress constant background //cvConvertScale( img_dct, img_dct, -1, 255 ); //invert colors cvDCT( img_dct , img_out , CV_DXT_INVERSE ); //IDCT //display(img_out, "IDCT"); 

enter image description hereenter image description hereenter image description here

The goal is to identify and isolate elements that are present at high frequencies from previously detected areas of the image. However, in some cases, the text is very thin and weak (low contrast). In these cases, IDCT draws images that are so dark that even the high-frequency areas become too weak for further analysis.

What manipulations exist so that we can get a clearer image from IDCT after background suppression? CvEqualizeHist() gives too much noise.

EDIT:

The whole picture is uploaded here, as belisarius requested. Low-frequency suppression is not performed on the entire image, but with a small ROI, a minimum bounding box around the text / low-frequency parts is set.

+6
source share
3 answers

Based on your sample image. Let's start with one possible text highlighting strategy.

The code is in Mathematica.

 (* Import your image*) i1 = Import["http://i.stack.imgur.com/hYwx8.jpg"]; i = ImageData@i1 ; 

hYwx8.jpg

 (*Get the red channel*) j = i[[All, All, 1]] (*Perform the DCT*) t = FourierDCT[j]; (*Define a high pass filter*) truncate[data_, f_] := Module[{i, j}, {i, j} = Floor[Dimensions[data]/Sqrt[f]]; PadRight[Take[data, -i, -j], Dimensions[data], 0.] ]; (*Apply the HP filter, and do the reverse DCT*) k = Image[FourierDCT[truncate[t, 4], 3]] // ImageAdjust 

enter image description here

 (*Appy a Gradient Filter and a Dilation*) l = Dilation[GradientFilter[k, 1] // ImageAdjust, 5] 

enter image description here

 (*Apply a MinFilter and Binarize*) m = Binarize[MinFilter[l, 10], .045] 

enter image description here

 (*Perform a Dilation and delete small components to get a mask*) mask = DeleteSmallComponents@Dilation [m, 10] 

enter image description here

 (*Finally apply the mask*) ImageMultiply[mask, Image@i ] 

enter image description here

To be continued...

Edit

Answering questions in the comments:

The GradientFilter description is under the "additional information" here: http://reference.wolfram.com/mathematica/ref/GradientFilter.html .

The description of MinFilter is under the "additional information" here: http://reference.wolfram.com/mathematica/ref/MinFilter.html

+4
source

You can improve contrast by applying a simple positive force law transform before applying the discrete cosine transform or after IDCT. This will move the shades of gray further. Try the following:

 cvPow(img, img_hicontrast, 1.75); // Adjust the exponent to your needs cvConvertScale(img_highcontrast, img_32); 
+3
source

If a simple threshold (perhaps some morphological discovery) is not enough, I would suggest using a diffusion filter: it smoothes out noise in areas without edges, but keeps edges very well. After that, segmentation should become easier.

If the edges become too weak after filtering your frequency domain, redrawing them with the result of cvCanny() before filtering can help a lot, especially if you can find the right level of smoothing to get only useful edges.

+3
source

Source: https://habr.com/ru/post/890030/


All Articles