Вы находитесь на странице: 1из 19

See

discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/306480083

Digital Image Processing Laboratory Manual

Book November 2015

CITATIONS READS

0 517

1 author:

Bhaskar Mondal
National Institute of Technology, Jamshedpur
18 PUBLICATIONS 14 CITATIONS

SEE PROFILE

All content following this page was uploaded by Bhaskar Mondal on 25 August 2016.

The user has requested enhancement of the downloaded file.


Digital Image Processing
Laboratory Manual( V1.X)
Subject Code: CS70X
Semester: VII
Year: 2014- 15 (Spring Semester)

November 11, 2014

Faculty:
Mr. Bhaskar Mondal

Department of Computer Science and Engineering


National Institute of Technology Jamshedpur
Jamshedpur, Jharkhand, India- 831014
Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

Contents

1 Introduction 2
1.1 Course description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Books . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Fundamentals of Mat Lab/ Sci Lab 3


2.1 Some commands and programs in SCILAB . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Flow control in SCILAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Loops in SCILAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3 Point Processing and Pixel Operations 6


3.1 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

4 Image Arithmetic 7
4.1 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

5 logical operations on Digital Image 8


5.1 Watermarking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5.2 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

6 Histogram Calculation and Equalization 9


6.1 Pseudo code: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.2 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

7 Geometric Transformation 11
7.1 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

8 Image Restoration 12
8.1 Excercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

9 spatial filters 13
9.1 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

10 Frequency Domain Filtering 14


10.1 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

11 morphological operations 15
11.1 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

12 wavelet transform 16
12.1 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Version: 1.0 Page 1


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

1 Introduction
1.1 Course description
We will cover the following topics Digital image fundamentals, Transformation in Spatial Domain,
Transformation in Frequency Domain, Restoration and Reconstruction, Color Image Processing, Wavelets
and Multi-resolution Processing, Image compression, Morphological Processing, Segmentation.

1.2 Scope
One picture worth 1000 words!
Support visual communication
Facilitate inspection, diagnosis of complex systems like Human body
Manufacturing
Entertainment
Keep record, history
Managing multimedia information
Security,
monitoring,
watermarking, etc

1.3 Objective
Introduction to the basic concept and methodology of Digital image Processing like image acquisition,
enhancement, color image processing, restoration, compression, morphological processing, segmenta-
tion and its use in current systems that handle visual information, including television, photographs,
x-rays etc. and further study and research in this field.

1.4 Books
R1 Gonzalez and woods;Digital Image Processing with MatLab, TMH

Evaluation Scheme
EC Evaluation Data & Nature of
Duration Weightage
No. Component Time Component

1.5 Instructions
Write and execute all programs either in MATLAB or SCILAB.
Do not use standard MATLAB functions whenever specified. Write program yourself without
using standard functions

Version: 1.0 Page 2


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

2 Fundamentals of Mat Lab/ Sci Lab


You may downlod SCILAB from http://www.scilab.

2.1 Some commands and programs in SCILAB


1. Declaring matrices:
In SciLab, there is no need to declare variables; new variables are simply introduced as they are
required.
A = [123; 456; 789]

2. Keep following things in mind while declaring variables/matrices:


No spaces
Dont start with a number
Variable names are case sensitive
3. Populating matrix elements with zeros:
SciLab also provides a number of functions which can be used to populate a new matrix with
particular values. For example to make a matrix full of zeroes we can use the function zeros(m,
n) which creates an m*n matrix of zeros as follows:
B = zeros(3, 3)
4. Knowing size of matrix:
Syntax: [rows, cols] = size(A);
Above command gives result: rows=3, cols=3
5. Reading Image file
myImage=imread(File name with path)
If name of the image file is test.bmp and if it is in /home/chv folder above commands can be
written as: myImage=imread(/home/chv/test.bmp)
6. Displaying image
After reading image data using above function, we can display images in SciLab using imshow
function. This function simply takes the array storing the image values as its only parameter.
Syntax: imshow(<variable name>) Example: imshow(myImage);
7. Knowing size of image in pixels:
Size of the image in pixels can be found out by following command: [Rows, Cols] =
size(myImage)
8. Image resizing
Image resizing can be done by following command: imresize(Image,Parameters);

imresize(myImage,[256,256],nearest); This command will convert image of


any size into image of 256x256 using nearest neighbor technique.
9. Converting Color image into Grayscale image:
Color image can be converted into Grayscale image by matlab/scilab function rgb2gray. Exam-
ple: myGrayImage=rgb2gray(myImage)
10. Converting Color image into Binary Image:
Color image can be converted into Binary image using function im2bw: Example: myBWImage=im2bw(my
Where myImage is 2D image data.
11. Intensity profile along line given by two points on image
Drawing of intensity profile along single line on given image (Scan one line along the image and
draw intensity values (1-D signal)) can be done by function improfile()

Version: 1.0 Page 3


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

Example: improfile(myImage,[0,150],[200,150]); If given image is chess-board


pattern, profile graph would be square wave.
12. Separate color image into three separate R,G,B planes
If we read given color image using imread() function, we get 3-D matrix. To separate out R,G
and B planes, we can read each plane separately as follows:
Example: myImage=imread(RGBBar.bmp);
RED=myImage(:,:,1);
GREEN=myImage(:,:,2);
BLUE=myImage(:,:,3);
13. Combine three separate R,G,B planes to create color image
If we have three R,G and B planes separately and if we want to create color image from it, we
can use concatenate function: Example: newImage=cat(3,RED,BLUE,GREEN)

2.2 Flow control in SCILAB


If statements are simply used to make decisions in SciLab
Syntax:
if <condition> then
<do some work>
else
<do some other work>
end
If we wish to perform thresholding of an image we could use following statements in SCILAB Pro-
gram: if ImageData(r, c) > threshold then
ThresholdedImage(r, c) = 255;
else
ThresholdedImage(r, c) = 0;
end

2.3 Loops in SCILAB


There is for loop and while loop in SCILAB. While loop While loop repeat a piece of work as long as
a condition holds true. The while loop in SciLab uses the following syntax: while <condition>
<perform some work repeatedly...>
end
For loop in SCILAB is very popular for image processing because it is particularly useful for iterating
through the members of a matrix. The SCILAB for loop uses the following syntax: for index =
<start>:<finish>
<Perform some work...>
end
Example: Following SCILAB code iterates through each pixel of image, does summation of pixel
values, finds average pixel value which represents average brightness of the scene.
myImage=imread(/home/chv/test.bmp)
Rows, Cols
= size(myImage)
total = 0;
for rowIndex = 1:Rows
for colIndex = 1:Cols
total = total + ImageData(rowIndex, colIndex);

Version: 1.0 Page 4


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

end
end
average=total/(Rows*Cols)
1. Saving two dimensional matrix in Image file imwrite(ImageData, Testout.bmp,
bmp);
This command writes ImageData in file Testout.bmp. It also supports gif, jpg and png
file formats.
2. Create image of size 512x512 black square using monochrome, 256 gray-level using paint or
any other relevant software and save it file name black.bmp Read and display image using
SCILAB/MATLAB commands
3. Write MATLAB command for the following
(a) Read color image RGBBar.bmp given in working directory, convert it into Grey-scale
image.
(b) Read color image RGBBar.bmp given in working directory, Find size of the image, Resize
it to 256 256

Version: 1.0 Page 5


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

3 Point Processing and Pixel Operations


1. Obtain Negative image
2. Obtain Flip image
3. Threshold operation (Thresholding)
4. Contrast stretching
Introduction: Image enhancement can be done in two domain: Spatial Domain and Transform
domain. In Spatial domain Image processing, there are two ways:
Point processing (Single pixel is processed at a time)
Neighborhood processing (Mask processing) Convolution of 3 3 or 5 5 or other size of mask
with image
In point processing, Grey level transformation can be given by following equation

g(x, y) = T (f (x, y)) s = T (r) (1)

Where, f (x, y) is original image, g(x, y) is transformed image s = gray level of transformed image
r = gray level of original image.
Threshold operation: In threshold operation, Pixel value greater than threshold value is made white
and pixel value less than threshold value is made black.

s = 0ifr m (2)
s = 255ifr > m (3)

Where m = threshold
Thresholding Scan any document and use this method to make it clean

3.1 Exercise
1. You may scan your own signature and make it clean with thresholding)

2. Run above program for different threshold values and find out optimum threshold value for which
you are getting better result. filename=input(Enter file name: ,s);
y=imread(filename);
T=input(Enter threshold value between 0 to 255: );
if(ndims(y)==3)
y=rgb2gray(y);
m,n end
=size(y);
imshow(y);
for i=1:m
for j=1:n
if(y(i,j)>T)
y(i,j)=255;
else
y(i,j)=0;
end
end
end

Version: 1.0 Page 6


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

figure;
imshow(y);

3. Write a program for Flip given image horizontally


4. Modify program of horizontal flipping for getting vertical flipping. Apply it on some image
5. In contrast stretching program take threshold values 50 and 100, Use slope 3 for gray levels
between 0 to 50, slope 2 for gray levels between 50 to 100 and slope 1 for rest gray levels.
Modify and write program again. Execute it for some image.
NOTE: Contrast Stretching means Darkening level below threshold value m and whitening level
above threshold value m. This technique will enhance contrast of given image. Thresholding is
example of extreme constrast stretching.

4 Image Arithmetic
Introduction: Arithmetic operations like image addition, subtraction, multiplication and division is
possible. If there is two images I1 and I2 then addition of image can be given by:
I(x,y) = I1(x,y) + I2(x,y)

Where I(x, y) is resultant image due to addition of two images. x and y are coordinates of image.
Image addition is pixel to pixel. Value of pixel should not cross maximum allowed value that is 255
for 8 bit grey scale image. When it exceeds value 255, it should be clipped to 255. To increase overall
brightness of the image, we can add some constant value depending on brightness required. In example
program we will add value 50 to the image and compare brightness of original and modified image.

To decrease brightness of image, we can subtract constant value. In example program, value 100 is
subtracted for every pixel. Care should be taken that pixel value should not less than 0 (minus value).
Subtract operation can be used to obtain complement (negative) image in which every pixel is sub-
tracted from maximum value i.e. 255 for 8 bit greyscale image.

Multiplication operation can be used to mask the image for obtaining region of interest. Black and
white mask (binary image) containing 1s and 0s is multiplied with image to get resultant image. To
obtain binary image function im2bw() can be used.

Multiplication operation can also be used to increase brightness of the image.

Division operation results into floating point numbers. So data type required is floating point
numbers. It can be converted into integer data type while storing the image. Division can be used
to decrease the brightness of the image. It can also used to detect change in image.
Calculate mean value: Mean value can be calculated by MATLAB function mean()

4.1 Exercise
1. Write Program to read any image, resize it to 256 256. Apply square mask shown in following
figure so that only middle part of the image is visible.
2. Write your own matlab function addbrightness() and use it to increase brightness of given image.

Version: 1.0 Page 7


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

5 logical operations on Digital Image


Introduction: Bitwise logical operations can be performed between pixels of one or more than one
image.

AND/NAND Logical operations can be used for following applications:

Compute intersection of the images


Design of filter masks
Slicing of gray scale images
OR/NOR logical operations can be used for following applications:
Merging of two images
XOR/XNOR operations can be used for following applications:
To detect change in gray level in the image
Check similarity of two images
NOT operation is used for:
To obtain negative image
Making some features clear

5.1 Watermarking
Watermarking using EX-OR operation:
To provide copy protection of digital audio, image and video two techniques are used: encryption and
watermarking.

Encryption techniques normally used to protect data during transmission from sender to receiver.
Once data received at receiver, it is decrypted and data is same as original which is not protected.

Watermarking techniques can compliment encryption by embedding secret key into original data.
Watermarking can be applied to audio, image or video data. Watermarking technique used for can
be visible or non-visible. For visible watermarking technique, watermark image is visible on original
image in light form. In non-visible watermarking technique, watermark image is hidden inside original
image.

In digital watermarking, watermarking key bits are scattered in the image and cannot be identified.
There are so many techniques being developed for secure and robust watermarking. Watermarking
using EX-OR operation is simplest technique.

5.2 Exercise
1. Write a program to demonstrate watermarking using EX-OR operation.
2. Prepare any two images of size 256 256 in paint. Save it in JPEG format 256 gray levels.
Perform logical NOR, NAND operations between two images. Write program and paste your
results.

Version: 1.0 Page 8


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

6 Histogram Calculation and Equalization


Introduction: Histogram is bar-graph used to profile the occurrence of each gray level in the image.
Mathematically it is represented as h(rk ) = nk Where rk is k th grey level and nk is number of pixel
having that Grey level.

Histogram can tell us whether image was scanned properly or not. It gives us idea about tonal
distribution in the image.

Histogram equalization can be applied to improve appearance of the image.

Histogram also tells us about objects in the image. Object in an image have similar gray levels so
histogram helps us to select threshold value for object detection.

Histogram can be used for image segmentation.

6.1 Pseudo code:


Calculate histogram:
Loop over ROWS of the image i = 1 to rows
Loop over COLS of then image j = 1 to cols
Pixel value k = data(i, j)
hist(k) = hist(k) + 1
End COLS loop
End ROW S loop
Calculate sum of the hist:
Loop over gray levels i = 0 to no. of gray levels
sum = sum + hist(i);
sumo fh ist(i) = sum;
End loop
Area of image = rows cols
Dm=Number of gray levels in the output image
Loop over ROW S
Loop over COLS
k = data(i, j)
data(i, j) = (Dm/area) sumo fh ist(k)
End COLS loop
End ROW S Loop

Standard MATLAB function for histogram and histogram equalization:

imhist function computes histogram of given image and plot


Example: myimage=imread(tier.jpg)
imhist(myimage);
histeq function computes histogram and equalize it.

Version: 1.0 Page 9


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

6.2 Exercise
1. Write a program to compute the histogram of an input image
2. Program for calculation and equalisation of the histogram
3. Take your own photograph in dark area. Improve its appearance using histogram equalization
technique.

Version: 1.0 Page 10


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

7 Geometric Transformation
Translation: Translation is movement of image to new position.
Scaling: Scaling means enlarging or shrinking. Mathematically scaling can be represented by:
Rotation: Image can be rotated by an angle , in matrix form it can be represented as:
Zooming : zooming of image can be done by process called pixel replication or interpolation.
Linear interpolation or some non-linear interpolation like cubic interpolation can be performed
for better result.
Matlab functions:
To rotate given image using standard Matlab function imrotate()
To transform image using standard Matlab function imtransform()

7.1 Exercise
1. In above program, modify matrix for geometric transformation and use imtransform() function
for modified matrix. Show the results and your conclusions.
2. Write and execute program for geometric transformation of image
(a) Translation
(b) Scaling
(c) Rotation
(d) Shrinking
(e) Zooming

Version: 1.0 Page 11


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

8 Image Restoration
Introduction: Image restoration is the process of removing or minimizing known degradations in the
given image. No imaging system gives perfect quality of recorded images due to various reasons.

Image restoration is used to improve quality of image by various methods in which it will try to
decrease degradations noise. Degradation of images can occur due to many reasons. Some of them
are as under:
Poor Image sensors
Defects of optical lenses in camera
Non-linearity of the electro-optical sensor;
Graininess of the film material which is utilised to store the image
Relative motion between an object and camera
Wrong focus of camera
Atmospheric turbulence in remote sensing or astronomy
Degradation due to temperature sensitive sensors like CCD
Poor light levels
Degradation of images causes:
Radiometric degradations;
Geometric distortions;
Spatial degradations.
Model of Image Degradation/restoration Process is shown in the following figure.
Spatial domain: g(x, y) = h(x, y) f (x, y) + (x, y)
Frequency domain: G(u, v) = H(u, v)F (u, v) + N (u, v)
G(x,y) is spatial domain representation of degraded image and G(u,v) is frequency domain represen-
tation of degraded image. Image restoration applies different restoration filters to reconstruct image to
remove or minimize degradations.

8.1 Excercise
1. To add noise in the image and apply image restoration technique using Wiener filter and median
filter
2. Explain algorithm used in Median filter with
3. Write mathematical expression for arithmetic mean filter, geometric mean filter, harmonic mean
filter and contra-harmonic mean filter
4. What is the basic idea behind adaptive filters?
5. To understand various image noise models write programs for image restoration
(a) Remove Salt and Pepper Noise
(b) Minimize Gaussian noise
(c) Median filter and Weiner filter
6. Write and execute programs to remove noise using spatial filters
(a) Understand 1-D and 2-D convolution process
(b) Use 3x3 Mask for low pass filter and high pass filter
7. Write a program to image restoration using the parametric wiener filter

Version: 1.0 Page 12


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

9 spatial filters
Introduction: Spatial Filtering is sometimes also known as neighborhood processing. Neighborhood
processing is an appropriate name because you define a center point and perform an operation (or ap-
ply a filter) to only those pixels in predetermined neighborhood of that center point. The result of the
operation is one value, which becomes the value at the center points location in the modified image.
Each point in the image is processed with its neighbors. The general idea is shown below as a sliding
filter that moves throughout the image to calculate the value at the center location.

In spatial filtering, we perform convolution of data with filter coefficients. In image processing, we
perform convolution of 3x3 filter coefficients with 2-D image data. In signal processing, we perform
convolution of 1-D data with set of filter coefficients.

9.1 Exercise
1. Program for 1D convolution (Useful for 1-D Signal Processing):
2. Program for 2D convolution:
3. Spatial filtering using standard MATLAB function To apply spatial filters on given image
4. Write mathematical expression of spatial filtering of image f(x,y) of size MN using mask W of
size ab.
5. What is need for padding? What is zero padding? Why it is required?
6. What is the effect of increasing size of mask?
7. Write a program for zooming and shrinking image by Pix replication.
8. Write a program for zooming and shrinking image by Bilinear Interpolation
9. Write a program to perform a special filtering of an image by taking different size of mask.

Version: 1.0 Page 13


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

10 Frequency Domain Filtering


Introduction: In spatial domain, we perform convolution of filter mask with image data. In frequency
domain we perform multiplication of Fourier transform of image data with filter transfer function.

Basic steps for filtering in frequency domain:


1. Pre-processing: Multiply input image f(x,y) by (-1)x+y to center the transform
2. Computer Discrete Fourier Transform F(u,v) of input image f(x,y)
3. Multiply F(u,v) by filter function H(u,v) Result: H(u,v)F(u,v)
4. Computer inverse DFT of the result
5. Obtain real part of the result
6. -Processing: Multiply the result by (1)x + y

10.1 Exercise
1. Write and execute programs for image frequency domain filtering
(a) Apply FFT on given image
(b) Perform low pass and high pass filtering in frequency domain
(c) Apply IFFT to reconstruct image
To write and execute program for wavelet transform on given image and perform inverse wavelet
transform to reconstruct image.

Version: 1.0 Page 14


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

11 morphological operations
Morphology is a branch of biology that deals with form and structure of animal and plant. In im-
age processing, we use mathematical morphology to extract image components which are useful in
representation and description of region shape such as Boundaries, Skeletons, Convex hull, Thinning,
Pruning etc.

Two Fundamental morphological operations are: Erosion and dilation


Dilation adds pixels to the boundaries of objects in an image, while erosion removes pixels on
object boundaries.
Erosion and dilation are two fundamental image morphological operations. Dilation adds pixels
to the boundaries of objects in an image, while erosion removes pixels on object boundaries.
Dilation operation: The value of the output pixel is the maximum value of all the pixels in the
input pixels neighborhood. In a binary image, if any of the pixels is set to the value 1, the output pixel
is set to 1.

Erosion operation: The value of the output pixel is the minimum value of all the pixels in the
input pixels neighborhood. In a binary image, if any of the pixels is set to 0, the output pixel is set to
0.

Opening and closing operations can be done by combination of erosion and dilation in different
sequence.

11.1 Exercise
1. Program to demonstrate Erosion and Dilation
2. Write a program in C and MATLAB/SCILAB for edge detection using different edge detection
mask
3. Write and execute program for image morphological operations erosion and dilation.
4. Implement Morphological smoothing using opening and closing

Version: 1.0 Page 15


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

12 wavelet transform
Wavelet transform is relatively recent signal and image processing tool which has many applications.
Basis functions of Fourier transform is sinusoids while basis functions of wavelet transform is wavelets.
Wavelets are oscillatory functions vanishing outside the small interval hence, they are called
wavelets. wave-let (small fraction of wave).
Wavelets are building blocks of the signal.
Wavelets are the functions which are well suited to the expansion of real time non-stationary
signals.
Wavelets can be used to de-correlate the correlations present in real time signal such as speech/audio,
video, biomedical, seismic etc.
Following standard matlab functions are used in this experiment.
wavedec2 : Function for multi-level decomposition of 2D data using wavelet transform.
[C,S] = WAVEDEC2(X,N,wname) returns the wavelet decomposition of the matrix X
at level N, using the wavelet named in string wname (wavelet name can be Daubechies wavelet
db1, db2, db3 or any other wavelet).
Outputs are the decomposition vector C and the corresponding bookkeeping matrix S. N is level
of decomposition which must be positive integer.
appcoef2: This function utilize tree developed by wavelet decomposition function and constructs
approximate coefficients for 2D data.
A = APPCOEF2(C,S,wname,N) computes the approximation coefficients at level N us-
ing the wavelet decomposition structure [C,S] which is generated by function wavedec2.
detcoef2: This function utilize tree develet by wavelet decomposition function and generates
detail coefficients for 2D data. D = DETCOEF2(O,C,S,N) extracts from the wavelet de-
composition structure [C,S], the horizontal, vertical or diagonal detail coefficients for O = h or
v or d, for horizontal, vertical and diagonal detail coefficients respectively.
waverec2: Multilevel wavelet 2D reconstruction (Inverse wavelet transform), WAVEREC2 per-
forms a multilevel 2-D wavelet reconstruction using wavelet named in string wname (wavelet
name can be Daubechies wavelet db1, db2, db3 or any other wavelet).
X = WAVEREC2(C,S,wname) reconstructs the matrix X based on the multilevel wavelet
decomposition structure [C,S] which is generated by wavedec2

12.1 Exercise
1. Write analysis low pass and high pass wavelet filter coefficients for Daubechies-2,4 and 8 wavelets.
(Hint: use matlab function wfilters() to find filter coefficients)
2. Write a program to image segmentation based on region growing approach

Version: 1.0 Page 16


Faculty: Bhaskar Mondal, Email:bm6779@gmail.com Digital Image Processing Lab. Manual

You May Meet Me:Every day 5:00pm.


You may mail me at bm.6779@gmail.com; (always mention your Roll Number followed by Subject at
the subject field.)

Version: 1.0 Page 17

View publication stats

Вам также может понравиться