Clear image noise

I need to know how to clear sound from an image using Matlab.

let's look at this example:

enter image description hereenter image description here

As you can see, the numbers do not look clear.

since I can clear the noise and pixels that are not numbers to make identification easier.

thanks.

+3
source share
4 answers

You started with a two-level (two-color, black and white)? Or did you spawn yourself?

If this is the last, it may be easier for you to perform noise reduction to a threshold. In this case, upload the image that you have before the threshold.

If this is the first, then it will be difficult for you to carry out traditional noise reduction. The reason is that many noise reduction approaches take advantage of the differences in statistical properties between noise and the actual natural way. At the threshold value, this distinction is essentially destroyed.

EDIT

OK, technically, your image is not very noisy - it is blurry (letters are pressed against each other) and has background noise.

But anyway, this is how I will deal with this:

  • Select a color channel for operation (RGB - three channels, usually one is enough). I chose green because it looked the easiest.
  • Image Blur (I used the 5x5 Gaussian kernel in GIMP)
  • Threshold using an empirically determined threshold (basically, try each threshold until you get a decent result). This is normal if some of the numbers have spaces - we can close them in the next step.
  • Morphological image processing (erosion and expansion)

Green channel:

enter image description here

Blur (5x5 Gauss):

enter image description here

The generated image (I used the ~ 93 threshold in GIMP):

enter image description here

Final result:

enter image description here

You can see that the spaces in the middle of 6 and 9 have disappeared. Unfortunately, I could not get a gap in left 3 to leave - it is just too big. Here are the problems causing this:

  • The line at the top of the image is much darker than some parts of 3. If you use a threshold to delete a line, then a space will be created. If you somehow deleted this line (for example, by more diligent trimming), the result of the threshold value would be much better than 3.
  • In addition, middle 2 and 6 work together. To prevent them from forming the same block after the threshold, an intensive threshold value is required.
+7
source

Take it step by step in Mathematica:

(*first separate the image in HSB channels*) i1 = ColorSeparate[ ColorNegate@yourColorImage , "HSB"] 

enter image description here

 (*Let keep the B Channel*) i2 = i1[[3]] 

enter image description here

 (*And Binarize it *) i3 = Binarize[i2, 0.92] 

enter image description here

 (*Perform a Thinning to get the skeleton*) i4 = Thinning[i3] 

enter image description here

 (*Now we cut those hairs*) i5 = Pruning[i4, 10] 

enter image description here

 (*Remove the small lines*) i6 = DeleteSmallComponents[i5, 30] 

enter image description here

 (*And finally dilate*) i7 = Dilation[i6, 3] 

enter image description here

 (*Now we can perform an OCR*) TextRecognize@i7 -->"93 269 23" 

Done!

+22
source

Since this question is marked as MATLAB, I translated the @belisarius solution as such (which, in my opinion, is superior to the currently accepted answer):

 %# 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) 

enter image description here

Finally, you can apply some form of OCR for number recognition. Unfortunately, MATLAB does not have a built-in function equivalent to TextRecognize[] in Mathematica ... At the same time, look at File Exchange , I "Of course you will find dozens of applications filling the gap :)

+17
source

I think there are two things you could do to make them more visible:

  • Delete patches smaller than a certain number of pixels (this will remove spots between sets of numbers)
  • The numbers must be "closed" forms, so you need an algorithm for detecting pixels (at the top of each number), which must be changed to black in order to "close" the number of the "figure".

You also have linear functions that are part of a noise signal that can be detected by boundary / line detection.

Finding adjacent "zones" and calculating characteristics, such as compactness or length / height, can also help determine which structures to keep ...

0
source

All Articles