clean noise from an image

后端 未结 4 1600
北荒
北荒 2020-12-15 15:06

I need to know how to clean noise from an image with Matlab.

lets look at this example:

\"enter

4条回答
  •  無奈伤痛
    2020-12-15 15:53

    Since this question is tagged MATLAB, I translated @belisarius's solution as such (which I think 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 to recognize the numbers. Unfortunately, MATLAB has no built-in function equivalent to TextRecognize[] in Mathematica... In the meanwhile, look in the File Exchange, I'm sure you will find dozens of submissions filling the gap :)

提交回复
热议问题