开发者

How to get clear image after low frequency suppression of image?

I'm suppressing the low DC frequencies of several (unequal) blocks in an image in the Dicrete Cosine Transform (DCT) domain. After that doing an inverse DCT to get back the image with only the high frequency portions remaining.

  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开发者_如何学Go_dct, -1, 255 ); //invert colors

cvDCT( img_dct , img_out , CV_DXT_INVERSE ); //IDCT
//display(img_out, "IDCT");

How to get clear image after low frequency suppression of image?

How to get clear image after low frequency suppression of image?

How to get clear image after low frequency suppression of image?

The objective is to identify and isolate elements which is present in high frequencies from previously detected regions in the image. However in several cases the text is very thin and faint (low contrast). In these cases the IDCT yeilds images which are so dark that even the high frequency portions become too faint for further analysis to work.

What manipulations are there so that we can obtain a clearer picture from the IDCT after background suppression? CvEqualizeHist() gives too much noise.

EDIT:

Whole picture uploaded here as belisarius asked. The low frequency suppression is not being done on the entire image, but on small ROI set to the smallest bounding rectangle around text/low frequency portions.


Based on your example image, Let's start with one possible strategy to isolate the text.

The code is in Mathematica.

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

How to get clear image after low frequency suppression of image?

(*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

How to get clear image after low frequency suppression of image?

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

How to get clear image after low frequency suppression of image?

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

How to get clear image after low frequency suppression of image?

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

How to get clear image after low frequency suppression of image?

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

How to get clear image after low frequency suppression of image?

To be continued ...

Edit

Answering questions in comments:

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

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


You can improve the contrast by applying a simple positive power law transformation prior to applying the discrete cosine transform, or after the IDCT. That will move the shades of gray farther apart. Try this:

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


If a simple threshold (+ maybe some morphological opening) is not enough, I would suggest to try using a diffusion filter: it smooths the noise in areas without edges, but preserves the edges very well. After that, the segmentation should become easier.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜