Search code examples
matlabimage-processingedge-detection

How to smoothen edges found in a image using matlab


How to smoothen two line in below image using matlab ? So that it will look like 2 smooth curves.

Edge

I have try using imdilate and imclose functon as below

 imdilate(im_edge,strel('disk', 2))
 imclose(im_edge,strel('square', 2))

But edges just become delate or pixels become closer


Solution

  • I was trying to find a way to make it look like a curve.
    I think using morphological operations in the right directions.
    Example for morphological operations:

    dilate:

    I = imread('Rx1wSm.jpg');
    se = strel('disk',3);
    J = imdilate(I, se);
    

    enter image description here

    close:

    se = strel('disk',3);
    J = imclose(I, se);
    

    enter image description here

    close with threshold:

    se = strel('disk',3);
    J = imclose(I, se);
    J(J > 50) = 255;
    J(J<50)=0;
    

    enter image description here

    There are many more morphological operations supported by Matlab.
    Type doc bwmorph in Matlab command windows to view documentation.

    There is still a room for improvement, but you need to find a better expert.