image-processing - 图像低频抑制后如何得到清晰的图像?

标签 image-processing opencv computer-vision

我正在抑制离散余弦变换 (DCT) 域中图像中几个(不相等的) block 的低直流频率。之后进行逆 DCT 以取回仅保留高频部分的图像。

  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 here enter image description here enter image description here

目标是从图像中先前检测到的区域中识别和隔离高频元素。然而,在某些情况下,文本非常细且模糊(低对比度)。在这些情况下,IDCT 产生的图像非常暗,以至于即使是高频部分也变得太微弱,无法进行进一步分析。

有哪些操作可以让我们在背景抑制后从 IDCT 中获得更清晰的图像? CvEqualizeHist() 给出了太多噪音。

编辑:

Whole picture按照 belisarius 的要求上传到这里。低频抑制不是在整个图像上进行的,而是在设置为文本/低频部分周围的最小边界矩形的小 ROI 上进行的。

最佳答案

根据您的示例图像,让我们从一种隔离文本的可能策略开始。

代码在 Mathematica 中。

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

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

待续...

编辑

回答评论中的问题:

GradientFilter 说明在“更多信息”下:http://reference.wolfram.com/mathematica/ref/GradientFilter.html .

MinFilter 说明在“更多信息”下:http://reference.wolfram.com/mathematica/ref/MinFilter.html

关于image-processing - 图像低频抑制后如何得到清晰的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6275206/

相关文章:

python - 如何平滑和减慢视频速度

python - 改进 LBP/HAAR 检测 XML 级联

opencv - 图像处理中的形状检测

opencv - 有没有办法检测中间的空心圆?

computer-vision - 计算机视觉问题(图像配准?)

matlab - 清除图像中的噪声

opencv - 使用 OpenCV 3.0 将颜色矩阵应用于 RGB 图像的最快方法?

image-processing - 曲线重建实现

c++ - 在不复制数据的情况下更改 opencv mat 中的列顺序

python - 使用 opencv 和 python 列出图像中的所有颜色