Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lab 8 DSP

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

-------------------------LAB 08----------------------

TO LEARN THE BASICS OF IMAGE


PROCESSING USING MATLAB
Objective:

To perform Image Processing using MATLAB.

Lab Exercise:
Task #1: Type in the command window

>> help imdemos

This will give you a list of, amongst other things; the entire sample TIFF images which come
with the Image Processing Toolbox. Make a list of these sample images, and for each image

(a) Determine its type (binary, grayscale or true color),

(b) Determine its size (in pixels)

(c) Give a brief description of the picture

SOLUTION:

MATLAB CODE:

help imdemos

Image Processing Toolbox --- demos

iptdemos - Index of Image Processing Toolbox demos.

RegisterAerialPhotoExample - Registering an Aerial Photo to an Orthophoto.

MeasureAngleExample - Measuring Angle of Intersection.

RotationFeatureMatchingExample - Find Image Rotation and Scale Using Automated Feature


Matching

DEPARTMENT OF TELECOMMUNICATION ENGINEERING SIR SYED


UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

BatchProcessImageExample - Batch Processing Image Files in Parallel.

BlindImageDeblurringExample - Deblurring Images Using a Blind Deconvolution Filter.

BlockProcessLargeImageExample - Block Processing Large Images.

BlockProcessStatisticsExample - Computing Statistics for Large Images.

CellSegmentationExample - Detecting a Cell Using Image Segmentation.

GalleryTransformedImagesExample - Creating a Gallery of Transformed Images.

DetectCirclesExample - Detect and Measure Circular Objects in an Image.

ConformalMappingImageExample - Exploring a Conformal Mapping.

ContrastEnhancementExample - Contrast Enhancement Techniques.

LabColorSegmentationExample - Color-based Segmentation Using the L*a*b* Color Space.

KMeansSegmentationExample - Color-based Segmentation Using K-Means Clustering.

RegisterMultimodalImagesExample - Registering Multimodal MRI Images

MultispectralImageEnhancementExample - Enhancing Multispectral Color Composite Images.

LucyRichardsonImageDeblurringExample - Deblurring Images Using a Lucy-Richardson Filter.

MRISliceExample - Exploring Slices from a 3-Dimensional MRI Data Set

MultispectralVegetationSegmentationExample - Finding Vegetation in a Multispectral Image.

(A) x=imread('macaw.jfif');
imshow(x)
imfinfo ('macaw. jfif')
OUTPUT:

Filename: 'C:\Program Files\MATLAB\R2015b\bin\macaw.jfif'


FileModDate: '13-Dec-2022 00:06:04'
FileSize: 6182
Format: 'jpg'
FormatVersion: ''
Width: 191
Height: 127
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
CodingMethod: 'Huffman'
CodingProcess: 'Sequential'
Comment: {}

DEPARTMENT OF TELECOMMUNICATION ENGINEERING SIR SYED


UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

impixel(x)

ans =

NaN NaN NaN

Task #2: Pick any grayscale image. Using the imwrite function, write it to files of type JPEG,
PNG and BMP. What are the sizes of those files?

SOLUTION:

MATLAB CODE:
y=imread('grayscale.png');

imshow(y)

imfinfo('grayscale.png')

OUTPUT:

Filename: 'C:\Program Files\MATLAB\R2015b\bin\grayscale.png'

FileModDate: '13-Dec-2022 00:51:47'

FileSize: 20418

Format: 'png'

FormatVersion: []

Width: 150

Height: 200

BitDepth: 8

DEPARTMENT OF TELECOMMUNICATION ENGINEERING SIR SYED


UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

ColorType: 'grayscale'

FormatSignature: [137 80 78 71 13 10 26 10]

Colormap: []

Histogram: []

InterlaceType: 'none'

Transparency: 'none'

SimpleTransparencyData: []

BackgroundColor: []

RenderingIntent: []

Chromaticities: []

Gamma: []

XResolution: []

YResolution: []

ResolutionUnit: []

XOffset: []

YOffset: []

OffsetUnit: []

SignificantBits: []

ImageModTime: []

Title: []

Author: []

Description: []

Copyright: []

CreationTime: []

Software: []

Disclaimer: []

Warning: []

Source: []

DEPARTMENT OF TELECOMMUNICATION ENGINEERING SIR SYED


UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

Comment: []

OtherText: []

Task #3: Import any color image and extract out the red, green and blue color from it.

SOLUTION:

MATLAB CODE:

a=imread('macaw colorful.jpg');

r=a(:,:,1);g=a(:,:,2);b=a(:,:,3);

subplot(2,2,1);imshow(a);title('ORIGINAL IMAGE');

subplot(2,2,2);imshow(r);title('RED COLOUR EXTRACTION');

subplot(2,2,3);imshow(g);title('GREEN COLOUR EXTRACTION');

subplot(2,2,4);imshow(b);title('BLUE COLOUR EXTRACTION');

DEPARTMENT OF TELECOMMUNICATION ENGINEERING SIR SYED


UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

Task #4: Design the following images through MATLAB, by using loops, trigonometric
functions and matrices:

(b)SOLUTION:
MATLAB CODE:
for m=1:50; for n=1:50;
if m-n==0; z(m,n)=0;
elseif abs(m-n)==1 z(m,n)=0.5;
else z(m,n)=1;end
end
end
y=fliplr(z); subplot(2,1,1); imshow(z);
title('a)'); subplot(2,1,2); imshow(y); title('b)');

DEPARTMENT OF TELECOMMUNICATION ENGINEERING SIR SYED


UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

OUTPUT:

(a) SOLUTION:
MATLAB CODE:
a=ones(1,100);
b=zeros(1,100);
for c=1:100
if (-1)^c==1
z(c,:)=a;
else
z(c,:)=b;
end
end
imshow(z);
OUTPUT:

DEPARTMENT OF TELECOMMUNICATION ENGINEERING SIR SYED


UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

(d)SOLUTION:
MATLAB CODE:
a=ones(100,1);
b=zeros(100,1);
for c=1:100
if (-1)^c==1
z(:,c)=a;
else
z(:,c)=b;
end
end
imshow(z)
OUTPUT:

(e)

(f)

SOLUTION:
MATLAB CODE:

DEPARTMENT OF TELECOMMUNICATION ENGINEERING SIR SYED


UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

for m=1:100; for k=0; for n=1:1000; q(m,n)=k; k=k+0.0010; end end end
p=fliplr(q);subplot(2,1,1);imshow(q) subplot(2,1,2);imshow(p)
OUTPUT:

8.3 Conclusion
As a result, in this lab, we demonstrate the idea of image processing by executing various
MATLAB commands.

Date: ___________ Signature: _________

DEPARTMENT OF TELECOMMUNICATION ENGINEERING SIR SYED


UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI

You might also like