0% found this document useful (0 votes)
27 views3 pages

Image Sampling and Quantization Lab

The document outlines Experiment No. 3 in the Image Processing Lab at the University of Duhok, focusing on image sampling and quantization. It explains the processes of downsampling and quantization using MATLAB functions, providing examples for each. Additionally, it includes exercises for students to practice downsampling and quantizing images with specified factors and levels.

Uploaded by

Beyan Rezan
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)
27 views3 pages

Image Sampling and Quantization Lab

The document outlines Experiment No. 3 in the Image Processing Lab at the University of Duhok, focusing on image sampling and quantization. It explains the processes of downsampling and quantization using MATLAB functions, providing examples for each. Additionally, it includes exercises for students to practice downsampling and quantizing images with specified factors and levels.

Uploaded by

Beyan Rezan
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

University of Duhok Image Processing Lab

College of Engineering Class: Third Year


Biomedical Engineering Department 2022-2023
2024-2025

Experiment No. 3

Image Sampling and Quantization:

Object:
The purpose of this experiment is to be familiar with the concept of image sampling and quantization.

Introduction:
Sampling of a signal is a process of creating a discrete signal from the continuous one, in a way that the
values (samples) are taken only in the certain places (or with certain time steps) from the original continuous
signal.
Nowadays, digital images are dense sampled signals while many of the image processing algorithm need to
deal with images sampled at smaller frequency (sample rate), this process is called subsampling because it
denotes taking a subset from the existing samples. If we want to subsample an image, we simply take every
N-the pixel.

Quantization is the process that involves representing the sampled signal by a finite number of levels based
on some criteria such as minimization of the quantizer distortion, which must be meaningful or hardware
considerations.

Procedure:
1. Image down sampling: Matlab provides a direct function to down sample signals, with the ability to
decide the down sampling factor.
y = downsample(x,n) where:
x: is the vector to be down sample, n:
is the down sampling factor.

Example 1:
In this example the original image is down sampled by factor 4

Io = imread('[Link]'); if(size(Io,3)==3)
Io=rgb2gray(Io); end subplot(1, 2, 1), imshow(Io),
title('Original image')
d_f = 4; % downsampling factor

(1 - 3)
University of Duhok Image Processing Lab
College of Engineering Class: Third Year
Biomedical Engineering Department 2020-2021

d_Io = downsample(Io,d_f); % downsample in row direction


d_Io = downsample(d_Io',d_f)'; % downsample in column direction
subplot(1, 2, 2), imshow(d_Io), title('downsampled image')

2. Image quantization: the Matlab function that used for image quantization is imquantize.

quant_A = imquantize(A,n)

where:
A: is the original image, n:
is the quantization levels.

Example 2:
In this example the original image is uniformly quantized into 8 levels.
Io = imread('[Link]'); if(size(Io,3)==3) Io=rgb2gray(Io); end
subplot(1, 2, 1), imshow(Io), title('Original image')
n_q = 8; % specify the number of quantization levels

(2 - 3)
University of Duhok Image Processing Lab
College of Engineering Class: Third Year
Biomedical Engineering Department 2020-2021

dd = linspace(256/n_q,256,n_q); % specify the quantization levels


I_q = imquantize(Io,dd); subplot(1, 2, 2), imshow(I_q, []), title('quantized
image')

Exercise: do the following:


1. Down sample the [Link] image by factors 2, 8 and 16.
2. Quantize uniformly the [Link] image to 16, 4 and 2 levels.
3. How to down sample color images?
4. How to quantize color images?

(3 - 3)

You might also like