CrazyEngineers
  • MATLAB : Median filter for image restoration.

    Srikz

    Member

    Updated: Oct 26, 2024
    Views: 989
    I'm trying to write a modified filter for image restoration. The code is
    %start
    A = imread('/*path name*/') ;
    A = im2double(A);
    [m n] = size(A);
    Med = [];
    %Modified filter
    for i=2:m-1
    for j=2:n-1
    Med(1) = A(i-1,j-1);
    Med(2) =A(i-1,j) ;
    Med(3) = A(i-1,j+1);
    Med(4) = A(i,j-1);
    Med(5) = A(i,j+1);
    Med(6) = A(i+1, j-1);
    Med(7) = A(i+1,j);
    Med(8) = A(i+1,j+1);
    A(i,j) = median(Med);
    end
    end
    imshow(A);

    The output should have been clear , but it appears much more blurred. can you please tell me the problem with the above code.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Home Channels Search Login Register