0% found this document useful (0 votes)
2 views

lab3-img

The document outlines an image processing lab experiment conducted by Usif Omer Ali, focusing on downsampling and quantizing images. It details the procedures for downsampling the 'bigben.png' image by factors of 2, 8, and 16, as well as quantizing the 'onion.png' image to 16, 4, and 2 levels. Additionally, it explains the general methods for downsampling and quantizing color images.

Uploaded by

rojdar sorji
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)
2 views

lab3-img

The document outlines an image processing lab experiment conducted by Usif Omer Ali, focusing on downsampling and quantizing images. It details the procedures for downsampling the 'bigben.png' image by factors of 2, 8, and 16, as well as quantizing the 'onion.png' image to 16, 4, and 2 levels. Additionally, it explains the general methods for downsampling and quantizing color images.

Uploaded by

rojdar sorji
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/ 5

Image processing Lab.

Experiment No. 3
Name of student: Usif Omer ali

1-Down sample the bigben.png image by factors 2, 8 and 16

i-factor 2

Io = imread('bigban.jpeg');
if(size(Io,3)==3)
Io=rgb2gray(Io);
end
subplot(1, 2, 1)
imshow(Io),
title('Original image')
d_f = 2;
d_Io = downsample(Io,d_f);
d_Io = downsample(d_Io',d_f)';
subplot(1, 2, 2)
imshow(d_Io)
title('downsampled image')
ii-factor 8
Io = imread('bigban.jpeg');
if(size(Io,3)==3)
Io=rgb2gray(Io);
end
subplot(1, 2, 1)
imshow(Io),
title('Original image')
d_f = 8;
d_Io = downsample(Io,d_f);
d_Io = downsample(d_Io',d_f)';
subplot(1, 2, 2)
imshow(d_Io)
title('downsampled image')

iii-factor 16
Io = imread('bigban.jpeg');
if(size(Io,3)==3)
Io=rgb2gray(Io);
end
subplot(1, 2, 1)
imshow(Io),
title('Original image')
d_f = 16;
d_Io = downsample(Io,d_f);
d_Io = downsample(d_Io',d_f)';
subplot(1, 2, 2)
imshow(d_Io)
title('downsampled image')
2-Quantize uniformly the onion.png image to 16, 4 and 2 levels.

i-16 levels
Io = imread('onion.png');
if(size(Io,3)==3)
Io=rgb2gray(Io);
end
subplot(1, 2, 1)
imshow(Io)
title('Original image')
n_q = 16;
dd = linspace(256/n_q,256,n_q);
I_q = imquantize(Io,dd);
subplot(1, 2, 2)
imshow(I_q, [])
title('quantized image')
ii-4 levels
Io = imread('onion.png');
if(size(Io,3)==3)
Io=rgb2gray(Io);
end
subplot(1, 2, 1)
imshow(Io)
title('Original image')
n_q = 4;
dd = linspace(256/n_q,256,n_q);
I_q = imquantize(Io,dd);
subplot(1, 2, 2)
imshow(I_q, [])
title('quantized image')

iii-2 levels
Io = imread('onion.png');
if(size(Io,3)==3)
Io=rgb2gray(Io);
end
subplot(1, 2, 1)
imshow(Io)
title('Original image')
n_q = 2;
dd = linspace(256/n_q,256,n_q);
I_q = imquantize(Io,dd);
subplot(1, 2, 2)
imshow(I_q, [])
title('quantized image')
3-How to down sample color images?

reduce its resolution by decreasing the number of pixels in both dimensions


(width and height). This process is typically done using interpolation
methods that combine nearby pixel values to create a smaller image while
trying to preserve visual quality.
% Read the image
img = imread('the image');

% Downsample by a factor of 2 (reduce to half the size)


I0= imresize(img, 0.5);

% Display or save the result


imshow(I0);

4-How to quantize color images?

Quantizing a color image means reducing the number of distinct colors in


the image. This is often done to reduce file size, simplify processing, or
create artistic effects.

You might also like