Image Processing Lab
Image Processing Lab
Lab Name : Image Processing Lab including Read Image ,RGB Image, Gray Image, Black & White
Image, Adjusted Image, Historgram of the Image, HSV Image,Hue, Image,Saturation Image and
also adding noises and removing it using algorithm.
Introduction : Image processing involves the analysis and manipulation of digital images to improve their
quality or extract meaningful information. It is widely used in various applications such as medical imaging,
remote sensing, and computer vision. This lab focuses on implementing basic image processing techniques
such as filtering, enhancement, and edge detection to understand how digital images can be transformed
and analyzed using computational methods.
Code :
Image1=imread("image1.jfif");
imshow(Image1);
Output :
Code :
Image1=imread("image1.jfif");
subplot(2,3,1);
imshow(Image1); title('RGB Image')
imhist(Image1)
whos Image1
grayI=rgb2gray(Image1);
subplot(2,3,2);
imshow(grayI); title('Gray Image')
Black=im2bw(grayI);
subplot(2,3,3);
imshow(Black); title('Black and White Image')
adj=imadjust(grayI);
subplot(2,3,4);
imshow(adj); title('Adjusted Image')
new=Image1;
new=rgb2gray(new);
subplot(2,3,5);
imhist(new); title('Histogram of the Image')
Output :
Code :
I=imread("image1.jfif");
I1 = I+50;
I2=I-50;
figure(1) ; imshow(I) ;
figure(2) ; imshow(I1);
figure(3) ; imshow(I2);
I=imread("image1.jfif");
I=im2gray(I);
I1_imadjust=imadjust(I)
I1_histeq = histeq(I);
I1_adapthisteq = adapthisteq(I);
montage({I,I1_imadjust,I1_histeq,I1_adapthisteq},"Size",[1 4])
title("Original Image and Enhanced Images using imadjust, histeq, and adapthisteq")
Output :
Figure-1 Figure-2
Figure-3
Code :
I=imread("image1.jfif");
% Convert to HSV color space
subplot(2,3,1);imshow(I)
hsvImage = rgb2hsv(I);
Output :
Code :
I=imread('coin.jpg');
figure,imshow(I)
J=imnoise(I,"salt & pepper",0.05);
figure, imshow(J)
Avg_filt=filter2(fspecial('average',3),J)/255;
figure, imshow(Avg_filt)
title('Image with salt pepper noise and removed by average filter')
Median_filter=medfilt2(J);
imshowpair(Avg-filt,Median_filter,'montage');
title('Image with salt pepper noise and removed by median filter')
Output :
Figure-1 Figure-2
Code :
I=imread('saturn.png');
J=im2gray(I);
figure,imshow(J);
K=imnoise(I,"gaussian",0,0.0235);
figure,imshow(K(600:1000,1:600));
title('portion of the image with gaussian noise');
L=weiner2(J,[5,5]);
figure, imshow(L(600:1000,1:600));
title('Portion of the image with noise removed by weiner filter');
Output :
Figure-1 Figure-2