0% found this document useful (0 votes)
5 views7 pages

Lab Report (Debasish)

This lab report details various image processing techniques including RGB, grayscale, and black and white image conversions, as well as histogram analysis and noise addition/removal. It demonstrates image adjustments using methods like imadjust and adaptive histogram equalization, and explores HSV image processing. Additionally, it covers the application of Gaussian and salt & pepper noise, along with filtering techniques to enhance image quality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Lab Report (Debasish)

This lab report details various image processing techniques including RGB, grayscale, and black and white image conversions, as well as histogram analysis and noise addition/removal. It demonstrates image adjustments using methods like imadjust and adaptive histogram equalization, and explores HSV image processing. Additionally, it covers the application of Gaussian and salt & pepper noise, along with filtering techniques to enhance image quality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Lab Report : 01

Lab Name : Image Processing lab including (RGB Image,Gray Image,Black and
White Image, Adjusted Image, Histogram of the Image, HSV image, Adding noise
and removing Image

Image Show Code:


I=imread("Tiger.jpg");
imshow(I)

Output:

Image Convert Code

img=imread("Tiger.jpg");
subplot(3,2,1);
imshow(img);
title("Rgb Image");
whos img;
grayI=rgb2gray(img);
subplot(3,2,2);
imshow(grayI);
title("Gray Image");
blackI=im2bw(grayI);
subplot(3,2,2);
imshow(blackI);
title("Black & White Image");
adj=imadjust(grayI);
subplot(2,3,5);
imshow(adj);
title("Adjust Image");
new=img;
new=rgb2gray(new);
subplot(2,4,5);
imhist(new);
title("Histogram of the Image")

Output of Image Converting


Image Resize Code:
Img=imread("Tiger.jpg");
Img1=Img+80;
Img2=Img-80;
figure(2);
imshow(Img);
figure(3);
imshow(Img1);
fiure(4);
imshow(Img4);

Output of Resize of Image:


Adjustment Image Code:
Img=imread("Tiger.jpg");
Img=im2gray(Img);
Img1_imadjust=imadjust(Img);
Img1_histeq=histeq(Img);
Img1_adapthisteq=adapthisteq(Img);
montage({Img,Img1_imadjust,Img1_adapthisteq,Img1_histeq},"Size",[2 3])
title("Enhanced Image using imadjust,adaptisteq,histeq")

Output of Adjustment Image:


HSV Image Code:
I=imread("Tiger.jpg");

subplot(2,3,1);imshow(I)
hsvImage = rgb2hsv(I);

hueImage = hsvImage(:, :, 1);


subplot(2,3,2);imshow(hueImage)
saturationImage = hsvImage(:, :, 2);
subplot(2,3,3);imshow(saturationImage)
valueImage = hsvImage(:, :, 3);
subplot(2,3,4);imshow(valueImage)
someFactor = 1.5;
hueImage = hueImage * someFactor;

hueImage = mod(hueImage, 1);

hsvImage = cat(3, hueImage, saturationImage, valueImage);

rgbImage = hsv2rgb(hsvImage);

subplot(2, 3, 5);
imshow(rgbImage);

Output of HSV Image:


Adding Noise and Remove Image Code:
Img = imread("Tiger.jpg"); % Read original image
grayImg = im2gray(Img); % Convert to grayscale
noisyImg = imnoise(Img, "gaussian", 0, 0.0222); % Add Gaussian noise
filteredImg = wiener2(im2gray(noisyImg), [2,2]); % Apply Wiener filter

% Get image size safely


[rows, cols, ~] = size(Img);
start_row = 1;
end_row = min(500, rows);
end_col = min(500, cols);

% Display all images in subplots


figure;
subplot(1,3,1);
imshow(Img);
title("Original Image");

subplot(1,3,2);
imshow(noisyImg(start_row:end_row, 1:end_col, :));
title("Portion with Gaussian Noise");

subplot(1,3,3);
imshow(filteredImg(start_row:end_row, 1:end_col));
title("Portion after Wiener Filter");

Salt and Pepper Noise Code:


Img=imread("Tiger.jpg");
figure(1),imshow(Img)

J=imnoise(img,"salt & pepper",0.01);


figure(2),imshow(J)
title("Adding Salt & Pepper Noise")

Avg_filt=filter2(fspecial("average",3),J)/255;
figure(3),imshow(Avg_filt)
title("Image with salt pepper noise and removed by average filter");
Median_filter=medfilt2(J);
figure(4),imshowpair(Avg_filt,Median_filter,"montage");

title("Image with salt pepper noise and remove by median filter")

OutPut:

You might also like