Search This Blog

Morphological Filtering | Digital Image Processing | MATLAB with code

Image Copyright  https://www.lenshorizon.com/

For gray scale image. 

clc

clear all

close all

warning off

x=rgb2gray(imread('owl.jpg'));

imshow(x);

title('Original Image');

se=ones(3,3);

I=imnoise(x,'salt & pepper',0.5);

figure;

imshow(I);

title('Image with Salt & Pepper Noise');

figure;

imshow(imclose(imopen(x,se),se));

title('Morphological Filtered Image');

           




  For Color image 


clc

clear all

close all

warning off

c=imread('owl.jpg');

imshow(c);

c=imnoise(double(c),'salt & pepper');

figure;

imshow(c);

se=ones(3,3);

figure;

imshow(imclose(imopen(c,se),se));

                                 





Join us on Telegram: https://t.me/matlabcastor

Video Explanation: 

No comments