Ofi*_* A. 3 matlab image-processing
我需要知道如何使用Matlab清除图像中的噪声.
让我们看一下这个例子:

如你所见,数字看起来不太清楚.
那么如何清除噪音和非数字的像素,以便识别更容易.
谢谢.
Dr.*_*ius 22
让我们一步一步地在Mathematica中做到:
(*first separate the image in HSB channels*)
i1 = ColorSeparate[ColorNegate@yourColorImage, "HSB"]
Run Code Online (Sandbox Code Playgroud)

(*Let's keep the B Channel*)
i2 = i1[[3]]
Run Code Online (Sandbox Code Playgroud)

(*And Binarize it *)
i3 = Binarize[i2, 0.92]
Run Code Online (Sandbox Code Playgroud)

(*Perform a Thinning to get the skeleton*)
i4 = Thinning[i3]
Run Code Online (Sandbox Code Playgroud)

(*Now we cut those hairs*)
i5 = Pruning[i4, 10]
Run Code Online (Sandbox Code Playgroud)

(*Remove the small lines*)
i6 = DeleteSmallComponents[i5, 30]
Run Code Online (Sandbox Code Playgroud)

(*And finally dilate*)
i7 = Dilation[i6, 3]
Run Code Online (Sandbox Code Playgroud)

(*Now we can perform an OCR*)
TextRecognize@i7
-->"93 269 23"
Run Code Online (Sandbox Code Playgroud)
Amr*_*mro 17
由于这个问题被标记为MATLAB,我翻译了@belisarius的解决方案(我认为它优于当前接受的答案):
%# read image
I = imread('http://i.stack.imgur.com/nGNGf.png');
%# complement it, and convert to HSV colorspace
hsv = rgb2hsv(imcomplement(I));
I1 = hsv(:,:,3); %# work with V channel
%# Binarize/threshold image
I2 = im2bw(I1, 0.92);
%# Perform morphological thinning to get the skeleton
I3 = bwmorph(I2, 'thin',Inf);
%# prune the skeleton (remove small branches at the endpoints)
I4 = bwmorph(I3, 'spur', 7);
%# Remove small components
I5 = bwareaopen(I4, 30);
%# dilate image
I6 = imdilate(I5, strel('square',2*3+1));
%# show step-by-step results
figure('Position',[200 150 700 700])
subplot(711), imshow(I)
subplot(712), imshow(I1)
subplot(713), imshow(I2)
subplot(714), imshow(I3)
subplot(715), imshow(I4)
subplot(716), imshow(I5)
subplot(717), imshow(I6)
Run Code Online (Sandbox Code Playgroud)

最后,您可以应用某种形式的OCR来识别数字.遗憾的是,MATLAB没有相当于TextRecognize[]Mathematica的内置函数......同时,在文件交换中查看,我相信你会发现几十个提交填补空白:)
你是从双层(双色,黑色和白色)开始的吗?或者你自己对它进行了限制?
如果是后者,您可能会发现在阈值之前更容易执行降噪.在这种情况下,请上传阈值之前的图像.
如果它是前者,那么你将面临传统降噪的艰难时期.原因是许多降噪方法利用了噪声和实际自然图像之间的统计特性的区别.通过阈值处理,这种区别基本上被破坏了.
编辑
好的,从技术上讲,你的图像并不是真的很吵 - 它很模糊(字母相互碰撞)并且有背景干扰.
但无论如何,这是我将如何处理它:
绿色通道:

模糊(5x5高斯):

阈值图像(我在GIMP中使用了~93的阈值):

最后结果:

你可以看到中间6和9的差距消失了.不幸的是,我无法让左边3的间隙消失 - 它太大了.以下是导致此问题的原因:
| 归档时间: |
|
| 查看次数: |
9702 次 |
| 最近记录: |