SlideShare a Scribd company logo
1 of 41
Presented by:Presented by:
Dr. Moe Moe Myint
moemoemyint@moemyanmar.ml
http://www.slideshare.net/MoeMoeMyint
Information Technology Department
Technological University (Kyaukse)
Only Original Owner has full rights reserved for
copied images.
This PPT is only for fair academic use.
Converting images to other image types
(Lab 2)
- The Image Processing Toolbox supports four basic types of images:
- Indexed images
- Grayscale images
- Binary images
- True Color images
M. M. Myint
Dr. Moe Moe Myint
Information Technology Department
Technological University (Kyaukse)
An indexed image consists of an array and a colormap
matrix.
The pixel values in the array are direct indices into a
colormap.
The colormap matrix is an m-by-3 array of class double
containing floating-point values in the range [0,1]. Each
row of map specifies the red, green, and blue components
of a single color.
M. M. Myint
MATLAB stores a grayscale image as a single matrix, with each
element of the matrix corresponding to one image pixel.
 The matrix can be of class uint8, uint16, int16, single, or double
in which case it contains values in the range [0,1], i.e, the
intensity ‘0’ represents black and the intensity ‘1’ represents
white.
M. M. Myint
In a binary image, each pixel assumes one of only two
discrete values, “0” or “1”.
M. M. Myint
 A true color image is an image in which each pixel is specified by
three values — one each for the red, blue, and green
components of the pixel's color.
 A true color array can be of class uint8, uint16, single, or
double. In a true color array of class single or double, each color
component is a value between 0 and 1.
 Graphics file formats store true color images as 24-bit images,
where the red, green, and blue components are 8 bits each.
M. M. Myint
0.5176 0.1608 0.0627
0.5176 0 0
0 0.5176 0
To change a color image into a grayscale image
I = rgb2gray(RGB)
grayimage = rgb2gray(‘Dog.jpg’);
figure; imshow(grayimage);
Practice1.m
clear all
close all
clc
[f p]=uigetfile('*.jpg');
I=imread([p f]);
figure;imshow(I);
title('Original Image','FontSize',14);
text(500,37,'Picture from Libraries','FontSize',14,'HorizontalAlignment','left');
grayimage=rgb2gray(I);
figure;imshow(grayimage);title('Grayscale Image');
M. M. Myint
Convert grayscale or binary image to indexed image
[X, map] = gray2ind(I, n)
 Converts the grayscale image I to an indexed image
X. n specifies the size of the colormap, gray(n). n must
be an integer between 1 and 65536. If n is omitted,
it defaults to 64.
Example 1
I = imread('cameraman.tif');
[X, map] = gray2ind(I, 16);
imshow(X, map);
M. M. Myint
Convert grayscale image to indexed image using
multilevel thresholding
grayslice
Example 2
I = imread('snowflakes.png');
X = grayslice(I,16);
imshow(I)
figure, imshow(X,jet(16))
M. M. Myint
Global image threshold
graythresh
Example 3
I = imread('coins.png');
level = graythresh(I);
BW = im2bw(I,level);
imshow(BW)
M. M. Myint
Convert image to binary image, based on threshold
BW = im2bw(I, level)
Specify level in the range [0,1]
Example 4
load trees
BW = im2bw(I,0.4);
imshow(X,map), figure, imshow(BW)
M. M. Myint
Convert indexed image to grayscale image
ind2gray
Example 5
load trees
I = ind2gray(X,map);
imshow(X,map)
figure,imshow(I)
M. M. Myint
Convert indexed image to RGB image
ind2rgb
Example 6
Syntax
RGB = ind2rgb(X,map)
M. M. Myint
Convert RGB image or colormap to grayscale
rgb2gray
Example 7
I = imread('board.tif');
J = rgb2gray(I);
figure, imshow(I), figure, imshow(J);
Convert the colormap to a grayscale colormap.
[X,map] = imread('trees.tif');
gmap = rgb2gray(map);
figure, imshow(X,map), figure, imshow(X,gmap);
M. M. Myint
Practice2.m
clear all, close all, clc;
rgbImage=imread('peppers.png');
figure,imshow(rgbImage);colorbar
title('Original Image');
figure,imshow(rgbImage);
bwImage=im2bw(rgbImage);
imshow(bwImage);
title('Black and White Image');
grayImage=rgb2gray(rgbImage);
figure,imshow(grayImage);
title('Grayscale Image');
indexImage=gray2ind(grayImage);
figure,imshow(indexImage);
title('Index Image');
doubleImage=im2double(rgbImage);
figure,imshow(doubleImage);
title('Double Image');
igrayImage=ind2gray(indexImage,cool);
figure,imshow(igrayImage);
title('Index Gray Image');
rgbindexImage=rgb2ind(rgbImage,cool);
figure,imshow(rgbindexImage);
title('RGB Indexex Image');
M. M. Myint
Double (64-bit double-precision floating point)
Single (32-bit single-precision floating point)
Int32 (32-bit signed integer)
Int16 (16-bit signed integer)
Int8 (8-bit signed integer)
Uint32 (32-bit unsigned integer)
Uint16 (16-bit unsigned integer)
Uint8 (8-bit unsigned integer)
M. M. Myint
M. M. Myint
Spatial Transformations(Lab 3)
- Modify the spatial relationship between pixels in an image,
mapping pixel locations in an input image to new locations in an
output image
-Perform certain specialized spatial transformations, such as
resizing and rotating an image
M. M. Myint
Dr. Moe Moe Myint
Information Technology Department
Technological University (Kyaukse)
B = imresize(A, scale) returns image B that is scale
times the size of A.
The input image A can be a grayscale, RGB, or binary
image.
If scale is between 0 and 1.0, B is smaller than A. If
scale is greater than 1.0, B is larger than A.
To resize an image, use the imresize function
I = imread('circuit.tif');
J = imresize(I,1.25);
imshow(I)
figure, imshow(J)
To create an output image with 100 rows and 150 columns
I = imread('circuit.tif');
J = imresize(I,[100 150]);
imshow(I)
figure, imshow(J)
M. M. Myint
B = imrotate(A, angle) rotates image A by angle
degrees in a counterclockwise direction around its
center point.
To rotate the image clockwise, specify a negative value
for angle.
To rotate an image, use the imrotate function
I = imread('circuit.tif');
J = imrotate(I,35);
%counterclockwise direction around its center point
imshow(I)
figure, imshow(J)
To rotate an image, use the imrotate function
I = imread('circuit.tif');
J = imrotate(I,-35);
%clockwise direction around its center point
imshow(I)
figure, imshow(J)
M. M. Myint
To extract a rectangular portion of an image, use the
imcrop function
I = imread('circuit.tif')
J = imcrop(I);
I = imread('circuit.tif');
J = imcrop(I,[60 40 100 90]);
M. M. Myint
B = impyramid(A, direction) computes a Gaussian
pyramid reduction or expansion of A by one level
direction can be 'reduce' or 'expand'.
M. M. Myint
I0 = imread('cameraman.tif');
I1 = impyramid(I0, 'reduce');
I2 = impyramid(I1, 'reduce');
I3 = impyramid(I2, 'reduce');
imshow(I0)
figure, imshow(I1)
figure, imshow(I2)
figure, imshow(I3)
I0 =imread('cameraman.tif');
I1 = impyramid(I0, ‘expand');
I2 = impyramid(I1, ‘expand');
I3 = impyramid(I2, ‘expand');
imshow(I0)
figure, imshow(I1)
figure, imshow(I2)
figure, imshow(I3)
Expansion
Read the image and display it with title ‘Input Image’
Resize the input image with scale greater than 1.0 and
display it with title ‘Resize Image with >1.0’
Also …..with scale between 0 and 1.0 and display it
with title ‘Resize Image with <1.0’
Rotate the ‘Resize image with >1.0’ %Clockwise
direction
Crop the input image with copying the position
Compute a four-level multiresolution pyramid of the
input image
Practice3.m
%Shrink by factor of two using the defaults of bicubic interpolation and
antialiasing
I = imread('rice.png');
J = imresize(I, 0.5);
figure, imshow(I), figure, imshow(J)
%Shrink by factor of two using nearest-neighbor interpolation (This is the
fastest method, but it has the lowest quality.)
J2 = imresize(I, 0.5, 'nearest'); %Resize an indexed image
[X, map] = imread('trees.tif');
[Y, newmap] = imresize(X, map, 0.5);
imshow(Y, newmap)
%Resize an RGB image to have 64 rows (The number of columns is
computed automatically.)
RGB = imread('peppers.png');
RGB2 = imresize(RGB, [64 NaN]);
M. M. Myint
Practice4.m
%Read a solar spectra image, stored in FITS format, and rotate the image to
bring it into horizontal alignment. A rotation of -1 degree is all that is
required.
I = fitsread('solarspectra.fts');
I = mat2gray(I);
J = imrotate(I,-1,'bilinear','crop');
figure, imshow(I)
figure, imshow(J)
M. M. Myint
Image Analysis (Lab 4)
M. M. Myint
Dr. Moe Moe Myint
Information Technology Department
Technological University (Kyaukse)
bwboundaries Trace region boundaries in binary image
bwtraceboundary Trace object in binary image
cornermetric Create corner metric matrix from image
edge Find edges in grayscale image
hough Hough transform
houghlines Extract line segments based on Hough transform
houghpeaks Identify peaks in Hough transform
Qtdecomp Quadtree decomposition
qtgetblk Block values in quadtree decomposition
qtsetblk Set block values in quadtree decomposition
 The Sobel method finds edges using the Sobel approximation to the
derivative. It returns edges at those points where the gradient of I is
maximum.
BW = edge(I,'sobel')
 The Prewitt method finds edges using the Prewitt approximation to
the derivative. It returns edges at those points where the gradient of I
is maximum.
BW = edge(I,'prewitt')
 The Roberts method finds edges using the Roberts approximation to
the derivative. It returns edges at those points where the gradient of I
is maximum.
BW = edge(I,'roberts')
M. M. Myint
The Laplacian of Gaussian method finds edges by looking for
zero crossings after filtering I with a Laplacian of Gaussian filter.
BW = edge(I,'log')
The Canny method finds edges by looking for local maxima of
the gradient of I. The gradient is calculated using the derivative
of a Gaussian filter. The method uses two thresholds, to detect
strong and weak edges, and includes the weak edges in the
output only if they are connected to strong edges. This method
is therefore less likely than the others to be fooled by noise, and
more likely to detect true weak edges.
BW = edge(I,'canny')
Examples
Find the edges of an image using the Prewitt and Canny
methods.
I = imread('circuit.tif');
BW1 = edge(I,'prewitt');
BW2 = edge(I,'canny');
imshow(BW1);
figure, imshow(BW2
Practice1.m
clc,clear all, close all
I=imread('peppers.png');
imshow(I);title('Input Image');
I=rgb2gray(I);
figure,imshow(I);title('Gray Image');
BW1=edge(I);
figure,imshow(BW1);title('Edge Image');
BW2=edge(I,'sobel');
figure,imshow(BW2);title('Sobel');
BW3=edge(I,'prewitt');
figure,imshow(BW3);title('Prewitt');
BW4=edge(I,'roberts');
figure,imshow(BW4);title('Roberts');
BW5=edge(I,'log');
figure,imshow(BW5);title('Log');
BW7=edge(I,'canny');
figure,imshow(BW7);title('Canny');
M. M. Myint
Dital Image Processing (Lab 2+3+4)

More Related Content

What's hot

Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationMostafa G. M. Mostafa
 
Image sampling and quantization
Image sampling and quantizationImage sampling and quantization
Image sampling and quantizationBCET, Balasore
 
Image segmentation
Image segmentationImage segmentation
Image segmentationDeepak Kumar
 
Lecture 3 image sampling and quantization
Lecture 3 image sampling and quantizationLecture 3 image sampling and quantization
Lecture 3 image sampling and quantizationVARUN KUMAR
 
Image enhancement techniques
Image enhancement techniques Image enhancement techniques
Image enhancement techniques Arshad khan
 
Convolution final slides
Convolution final slidesConvolution final slides
Convolution final slidesramyasree_ssj
 
Introduction to image contrast and enhancement method
Introduction to image contrast and enhancement methodIntroduction to image contrast and enhancement method
Introduction to image contrast and enhancement methodAbhishekvb
 
Image compression standards
Image compression standardsImage compression standards
Image compression standardskirupasuchi1996
 
Lecture 4 Relationship between pixels
Lecture 4 Relationship between pixelsLecture 4 Relationship between pixels
Lecture 4 Relationship between pixelsVARUN KUMAR
 
Active contour segmentation
Active contour segmentationActive contour segmentation
Active contour segmentationNishant Jain
 
Histogram Processing
Histogram ProcessingHistogram Processing
Histogram ProcessingAmnaakhaan
 
DIGITAL IMAGE PROCESSING - LECTURE NOTES
DIGITAL IMAGE PROCESSING - LECTURE NOTESDIGITAL IMAGE PROCESSING - LECTURE NOTES
DIGITAL IMAGE PROCESSING - LECTURE NOTESEzhilya venkat
 
Edge Detection algorithm and code
Edge Detection algorithm and codeEdge Detection algorithm and code
Edge Detection algorithm and codeVaddi Manikanta
 
Image Segmentation (Digital Image Processing)
Image Segmentation (Digital Image Processing)Image Segmentation (Digital Image Processing)
Image Segmentation (Digital Image Processing)VARUN KUMAR
 
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...Ulaş Bağcı
 

What's hot (20)

Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image Segmentation
 
Image sampling and quantization
Image sampling and quantizationImage sampling and quantization
Image sampling and quantization
 
Image processing Presentation
Image processing PresentationImage processing Presentation
Image processing Presentation
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Lecture 3 image sampling and quantization
Lecture 3 image sampling and quantizationLecture 3 image sampling and quantization
Lecture 3 image sampling and quantization
 
Sharpening spatial filters
Sharpening spatial filtersSharpening spatial filters
Sharpening spatial filters
 
Image enhancement techniques
Image enhancement techniques Image enhancement techniques
Image enhancement techniques
 
Convolution final slides
Convolution final slidesConvolution final slides
Convolution final slides
 
Edge detection
Edge detectionEdge detection
Edge detection
 
Introduction to image contrast and enhancement method
Introduction to image contrast and enhancement methodIntroduction to image contrast and enhancement method
Introduction to image contrast and enhancement method
 
Image compression standards
Image compression standardsImage compression standards
Image compression standards
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 
Lecture 4 Relationship between pixels
Lecture 4 Relationship between pixelsLecture 4 Relationship between pixels
Lecture 4 Relationship between pixels
 
Spatial domain and filtering
Spatial domain and filteringSpatial domain and filtering
Spatial domain and filtering
 
Active contour segmentation
Active contour segmentationActive contour segmentation
Active contour segmentation
 
Histogram Processing
Histogram ProcessingHistogram Processing
Histogram Processing
 
DIGITAL IMAGE PROCESSING - LECTURE NOTES
DIGITAL IMAGE PROCESSING - LECTURE NOTESDIGITAL IMAGE PROCESSING - LECTURE NOTES
DIGITAL IMAGE PROCESSING - LECTURE NOTES
 
Edge Detection algorithm and code
Edge Detection algorithm and codeEdge Detection algorithm and code
Edge Detection algorithm and code
 
Image Segmentation (Digital Image Processing)
Image Segmentation (Digital Image Processing)Image Segmentation (Digital Image Processing)
Image Segmentation (Digital Image Processing)
 
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
 

Viewers also liked

basic of Image processing using matlab
basic of Image processing using matlabbasic of Image processing using matlab
basic of Image processing using matlabRohit Sinha
 
Digital image processing lab 1
Digital image processing lab 1Digital image processing lab 1
Digital image processing lab 1Moe Moe Myint
 
Lect 02 first portion
Lect 02   first portionLect 02   first portion
Lect 02 first portionMoe Moe Myint
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portionMoe Moe Myint
 
Multimedia Data Mining using Deep Learning
Multimedia Data Mining using Deep LearningMultimedia Data Mining using Deep Learning
Multimedia Data Mining using Deep LearningBhagyashree Barde
 
Lect 02 second portion
Lect 02  second portionLect 02  second portion
Lect 02 second portionMoe Moe Myint
 
Deep learning: the future of recommendations
Deep learning: the future of recommendationsDeep learning: the future of recommendations
Deep learning: the future of recommendationsBalázs Hidasi
 
Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)Moe Moe Myint
 
Matlab Working With Images
Matlab Working With ImagesMatlab Working With Images
Matlab Working With Imagesmatlab Content
 
Optical fiber Communication
Optical fiber Communication Optical fiber Communication
Optical fiber Communication Saurabh Kumar
 
Image encryption and decryption
Image encryption and decryptionImage encryption and decryption
Image encryption and decryptionAashish R
 
The end of the car city - A convenient truth
The end of the car city - A convenient truthThe end of the car city - A convenient truth
The end of the car city - A convenient truthAlexander Ståhle
 

Viewers also liked (18)

basic of Image processing using matlab
basic of Image processing using matlabbasic of Image processing using matlab
basic of Image processing using matlab
 
Digital image processing lab 1
Digital image processing lab 1Digital image processing lab 1
Digital image processing lab 1
 
Visual Search
Visual SearchVisual Search
Visual Search
 
PDF vs. TIFF, An Evaluation of Document Scanning File Formats
PDF vs. TIFF, An Evaluation of Document Scanning File FormatsPDF vs. TIFF, An Evaluation of Document Scanning File Formats
PDF vs. TIFF, An Evaluation of Document Scanning File Formats
 
Lect 02 first portion
Lect 02   first portionLect 02   first portion
Lect 02 first portion
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portion
 
Multimedia Data Mining using Deep Learning
Multimedia Data Mining using Deep LearningMultimedia Data Mining using Deep Learning
Multimedia Data Mining using Deep Learning
 
Dip chapter 2
Dip chapter 2Dip chapter 2
Dip chapter 2
 
Jpeg
JpegJpeg
Jpeg
 
Lect 02 second portion
Lect 02  second portionLect 02  second portion
Lect 02 second portion
 
Deep learning: the future of recommendations
Deep learning: the future of recommendationsDeep learning: the future of recommendations
Deep learning: the future of recommendations
 
Soliton
Soliton Soliton
Soliton
 
Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)Lecture 1 for Digital Image Processing (2nd Edition)
Lecture 1 for Digital Image Processing (2nd Edition)
 
Matlab Working With Images
Matlab Working With ImagesMatlab Working With Images
Matlab Working With Images
 
Optical fiber Communication
Optical fiber Communication Optical fiber Communication
Optical fiber Communication
 
Image encryption and decryption
Image encryption and decryptionImage encryption and decryption
Image encryption and decryption
 
OPTICAL FIBER COMMUNICATION PPT
OPTICAL FIBER COMMUNICATION PPTOPTICAL FIBER COMMUNICATION PPT
OPTICAL FIBER COMMUNICATION PPT
 
The end of the car city - A convenient truth
The end of the car city - A convenient truthThe end of the car city - A convenient truth
The end of the car city - A convenient truth
 

Similar to Dital Image Processing (Lab 2+3+4)

Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlabAnkur Tyagi
 
Matlab intro
Matlab introMatlab intro
Matlab introfvijayami
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptxAvinashJain66
 
Digital Image Processing (Lab 05)
Digital Image Processing (Lab 05)Digital Image Processing (Lab 05)
Digital Image Processing (Lab 05)Moe Moe Myint
 
Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab SangeethaSasi1
 
Image_Processing_LECTURE_c#_programming.ppt
Image_Processing_LECTURE_c#_programming.pptImage_Processing_LECTURE_c#_programming.ppt
Image_Processing_LECTURE_c#_programming.pptLOUISSEVERINOROMANO
 
Image Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image ProcessingImage Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image ProcessingAshok Kumar
 
Fundamentals Image and Graphics
Fundamentals Image and GraphicsFundamentals Image and Graphics
Fundamentals Image and GraphicsShrawan Adhikari
 
Programming in matlab lesson5
Programming in matlab lesson5Programming in matlab lesson5
Programming in matlab lesson5najmah17
 
Dip digital image 3
Dip digital image 3Dip digital image 3
Dip digital image 3Shajun Nisha
 
Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)Moe Moe Myint
 
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)Hasitha Ediriweera
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABSriram Emarose
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image ProcessingAnkur Nanda
 
Basics of image processing using MATLAB
Basics of image processing using MATLABBasics of image processing using MATLAB
Basics of image processing using MATLABMohsin Siddique
 

Similar to Dital Image Processing (Lab 2+3+4) (20)

Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlab
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
Image processing in MATLAB
Image processing in MATLABImage processing in MATLAB
Image processing in MATLAB
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using MATLAB
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptx
 
Digital Image Processing (Lab 05)
Digital Image Processing (Lab 05)Digital Image Processing (Lab 05)
Digital Image Processing (Lab 05)
 
Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab
 
Image_Processing_LECTURE_c#_programming.ppt
Image_Processing_LECTURE_c#_programming.pptImage_Processing_LECTURE_c#_programming.ppt
Image_Processing_LECTURE_c#_programming.ppt
 
Image Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image ProcessingImage Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image Processing
 
Fundamentals Image and Graphics
Fundamentals Image and GraphicsFundamentals Image and Graphics
Fundamentals Image and Graphics
 
Programming in matlab lesson5
Programming in matlab lesson5Programming in matlab lesson5
Programming in matlab lesson5
 
Matlab Working With Images
Matlab Working With ImagesMatlab Working With Images
Matlab Working With Images
 
Resize image vb.net
Resize image vb.netResize image vb.net
Resize image vb.net
 
Dip digital image 3
Dip digital image 3Dip digital image 3
Dip digital image 3
 
Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)
 
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLAB
 
Dip day1&2
Dip day1&2Dip day1&2
Dip day1&2
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Basics of image processing using MATLAB
Basics of image processing using MATLABBasics of image processing using MATLAB
Basics of image processing using MATLAB
 

More from Moe Moe Myint

Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)Moe Moe Myint
 
Chapter 8 Embedded Hardware Design and Development (third portion)
Chapter 8 Embedded Hardware Design and Development (third portion)Chapter 8 Embedded Hardware Design and Development (third portion)
Chapter 8 Embedded Hardware Design and Development (third portion)Moe Moe Myint
 
Chapter 8 Embedded Hardware Design and Development (second portion)
Chapter 8 Embedded Hardware Design and Development (second portion)Chapter 8 Embedded Hardware Design and Development (second portion)
Chapter 8 Embedded Hardware Design and Development (second portion)Moe Moe Myint
 
Schematic and PCB Design Using Eagle
Schematic and PCB Design Using EagleSchematic and PCB Design Using Eagle
Schematic and PCB Design Using EagleMoe Moe Myint
 
Chapter 4 Embedded System: Application and Domain Specific
Chapter 4 Embedded System: Application and Domain SpecificChapter 4 Embedded System: Application and Domain Specific
Chapter 4 Embedded System: Application and Domain SpecificMoe Moe Myint
 
Chapter 3 Charateristics and Quality Attributes of Embedded System
Chapter 3 Charateristics and Quality Attributes of Embedded SystemChapter 3 Charateristics and Quality Attributes of Embedded System
Chapter 3 Charateristics and Quality Attributes of Embedded SystemMoe Moe Myint
 
Introduction to Embedded System I: Chapter 2 (5th portion)
Introduction to Embedded System I: Chapter 2 (5th portion)Introduction to Embedded System I: Chapter 2 (5th portion)
Introduction to Embedded System I: Chapter 2 (5th portion)Moe Moe Myint
 
Introduction to Embedded System: Chapter 2 (4th portion)
Introduction to Embedded System:  Chapter 2 (4th portion)Introduction to Embedded System:  Chapter 2 (4th portion)
Introduction to Embedded System: Chapter 2 (4th portion)Moe Moe Myint
 
Introduction to Embedded System I : Chapter 2 (3rd portion)
Introduction to Embedded System I : Chapter 2 (3rd portion)Introduction to Embedded System I : Chapter 2 (3rd portion)
Introduction to Embedded System I : Chapter 2 (3rd portion)Moe Moe Myint
 
Introduction to Embedded System I : Chapter 2 (2nd portion)
Introduction to Embedded System I : Chapter 2 (2nd portion)Introduction to Embedded System I : Chapter 2 (2nd portion)
Introduction to Embedded System I : Chapter 2 (2nd portion)Moe Moe Myint
 
Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)Moe Moe Myint
 
Introduction to Embedded Systems I : Chapter 1
Introduction to Embedded Systems I : Chapter 1Introduction to Embedded Systems I : Chapter 1
Introduction to Embedded Systems I : Chapter 1Moe Moe Myint
 
Lect 02 first portion
Lect 02   first portionLect 02   first portion
Lect 02 first portionMoe Moe Myint
 
Digital Image Processing (Lab 09 and 10)
Digital Image Processing (Lab 09 and 10)Digital Image Processing (Lab 09 and 10)
Digital Image Processing (Lab 09 and 10)Moe Moe Myint
 
Digital Image Processing (Lab 08)
Digital Image Processing (Lab 08)Digital Image Processing (Lab 08)
Digital Image Processing (Lab 08)Moe Moe Myint
 
Digital Image Processing (Lab 06)
Digital Image Processing (Lab 06)Digital Image Processing (Lab 06)
Digital Image Processing (Lab 06)Moe Moe Myint
 

More from Moe Moe Myint (17)

Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
Ch 1 introduction to Embedded Systems (AY:2018-2019--> First Semester)
 
Chapter 8 Embedded Hardware Design and Development (third portion)
Chapter 8 Embedded Hardware Design and Development (third portion)Chapter 8 Embedded Hardware Design and Development (third portion)
Chapter 8 Embedded Hardware Design and Development (third portion)
 
Chapter 8 Embedded Hardware Design and Development (second portion)
Chapter 8 Embedded Hardware Design and Development (second portion)Chapter 8 Embedded Hardware Design and Development (second portion)
Chapter 8 Embedded Hardware Design and Development (second portion)
 
Schematic and PCB Design Using Eagle
Schematic and PCB Design Using EagleSchematic and PCB Design Using Eagle
Schematic and PCB Design Using Eagle
 
Chapter 4 Embedded System: Application and Domain Specific
Chapter 4 Embedded System: Application and Domain SpecificChapter 4 Embedded System: Application and Domain Specific
Chapter 4 Embedded System: Application and Domain Specific
 
Chapter 3 Charateristics and Quality Attributes of Embedded System
Chapter 3 Charateristics and Quality Attributes of Embedded SystemChapter 3 Charateristics and Quality Attributes of Embedded System
Chapter 3 Charateristics and Quality Attributes of Embedded System
 
Introduction to Embedded System I: Chapter 2 (5th portion)
Introduction to Embedded System I: Chapter 2 (5th portion)Introduction to Embedded System I: Chapter 2 (5th portion)
Introduction to Embedded System I: Chapter 2 (5th portion)
 
Introduction to Embedded System: Chapter 2 (4th portion)
Introduction to Embedded System:  Chapter 2 (4th portion)Introduction to Embedded System:  Chapter 2 (4th portion)
Introduction to Embedded System: Chapter 2 (4th portion)
 
Introduction to Embedded System I : Chapter 2 (3rd portion)
Introduction to Embedded System I : Chapter 2 (3rd portion)Introduction to Embedded System I : Chapter 2 (3rd portion)
Introduction to Embedded System I : Chapter 2 (3rd portion)
 
Introduction to Embedded System I : Chapter 2 (2nd portion)
Introduction to Embedded System I : Chapter 2 (2nd portion)Introduction to Embedded System I : Chapter 2 (2nd portion)
Introduction to Embedded System I : Chapter 2 (2nd portion)
 
Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)Introduction to Embedded Systems I: Chapter 2 (1st portion)
Introduction to Embedded Systems I: Chapter 2 (1st portion)
 
Introduction to Embedded Systems I : Chapter 1
Introduction to Embedded Systems I : Chapter 1Introduction to Embedded Systems I : Chapter 1
Introduction to Embedded Systems I : Chapter 1
 
Lect 06
Lect 06 Lect 06
Lect 06
 
Lect 02 first portion
Lect 02   first portionLect 02   first portion
Lect 02 first portion
 
Digital Image Processing (Lab 09 and 10)
Digital Image Processing (Lab 09 and 10)Digital Image Processing (Lab 09 and 10)
Digital Image Processing (Lab 09 and 10)
 
Digital Image Processing (Lab 08)
Digital Image Processing (Lab 08)Digital Image Processing (Lab 08)
Digital Image Processing (Lab 08)
 
Digital Image Processing (Lab 06)
Digital Image Processing (Lab 06)Digital Image Processing (Lab 06)
Digital Image Processing (Lab 06)
 

Recently uploaded

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEselvakumar948
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 

Recently uploaded (20)

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 

Dital Image Processing (Lab 2+3+4)

  • 1. Presented by:Presented by: Dr. Moe Moe Myint moemoemyint@moemyanmar.ml http://www.slideshare.net/MoeMoeMyint Information Technology Department Technological University (Kyaukse)
  • 2. Only Original Owner has full rights reserved for copied images. This PPT is only for fair academic use.
  • 3. Converting images to other image types (Lab 2) - The Image Processing Toolbox supports four basic types of images: - Indexed images - Grayscale images - Binary images - True Color images M. M. Myint Dr. Moe Moe Myint Information Technology Department Technological University (Kyaukse)
  • 4. An indexed image consists of an array and a colormap matrix. The pixel values in the array are direct indices into a colormap. The colormap matrix is an m-by-3 array of class double containing floating-point values in the range [0,1]. Each row of map specifies the red, green, and blue components of a single color. M. M. Myint
  • 5.
  • 6. MATLAB stores a grayscale image as a single matrix, with each element of the matrix corresponding to one image pixel.  The matrix can be of class uint8, uint16, int16, single, or double in which case it contains values in the range [0,1], i.e, the intensity ‘0’ represents black and the intensity ‘1’ represents white. M. M. Myint
  • 7.
  • 8. In a binary image, each pixel assumes one of only two discrete values, “0” or “1”. M. M. Myint
  • 9.
  • 10.  A true color image is an image in which each pixel is specified by three values — one each for the red, blue, and green components of the pixel's color.  A true color array can be of class uint8, uint16, single, or double. In a true color array of class single or double, each color component is a value between 0 and 1.  Graphics file formats store true color images as 24-bit images, where the red, green, and blue components are 8 bits each. M. M. Myint
  • 11. 0.5176 0.1608 0.0627 0.5176 0 0 0 0.5176 0
  • 12. To change a color image into a grayscale image I = rgb2gray(RGB) grayimage = rgb2gray(‘Dog.jpg’); figure; imshow(grayimage); Practice1.m clear all close all clc [f p]=uigetfile('*.jpg'); I=imread([p f]); figure;imshow(I); title('Original Image','FontSize',14); text(500,37,'Picture from Libraries','FontSize',14,'HorizontalAlignment','left'); grayimage=rgb2gray(I); figure;imshow(grayimage);title('Grayscale Image'); M. M. Myint
  • 13. Convert grayscale or binary image to indexed image [X, map] = gray2ind(I, n)  Converts the grayscale image I to an indexed image X. n specifies the size of the colormap, gray(n). n must be an integer between 1 and 65536. If n is omitted, it defaults to 64. Example 1 I = imread('cameraman.tif'); [X, map] = gray2ind(I, 16); imshow(X, map); M. M. Myint
  • 14. Convert grayscale image to indexed image using multilevel thresholding grayslice Example 2 I = imread('snowflakes.png'); X = grayslice(I,16); imshow(I) figure, imshow(X,jet(16)) M. M. Myint
  • 15. Global image threshold graythresh Example 3 I = imread('coins.png'); level = graythresh(I); BW = im2bw(I,level); imshow(BW) M. M. Myint
  • 16. Convert image to binary image, based on threshold BW = im2bw(I, level) Specify level in the range [0,1] Example 4 load trees BW = im2bw(I,0.4); imshow(X,map), figure, imshow(BW) M. M. Myint
  • 17. Convert indexed image to grayscale image ind2gray Example 5 load trees I = ind2gray(X,map); imshow(X,map) figure,imshow(I) M. M. Myint
  • 18. Convert indexed image to RGB image ind2rgb Example 6 Syntax RGB = ind2rgb(X,map) M. M. Myint
  • 19. Convert RGB image or colormap to grayscale rgb2gray Example 7 I = imread('board.tif'); J = rgb2gray(I); figure, imshow(I), figure, imshow(J); Convert the colormap to a grayscale colormap. [X,map] = imread('trees.tif'); gmap = rgb2gray(map); figure, imshow(X,map), figure, imshow(X,gmap); M. M. Myint
  • 20. Practice2.m clear all, close all, clc; rgbImage=imread('peppers.png'); figure,imshow(rgbImage);colorbar title('Original Image'); figure,imshow(rgbImage); bwImage=im2bw(rgbImage); imshow(bwImage); title('Black and White Image'); grayImage=rgb2gray(rgbImage); figure,imshow(grayImage); title('Grayscale Image'); indexImage=gray2ind(grayImage); figure,imshow(indexImage); title('Index Image'); doubleImage=im2double(rgbImage); figure,imshow(doubleImage); title('Double Image'); igrayImage=ind2gray(indexImage,cool); figure,imshow(igrayImage); title('Index Gray Image'); rgbindexImage=rgb2ind(rgbImage,cool); figure,imshow(rgbindexImage); title('RGB Indexex Image'); M. M. Myint
  • 21. Double (64-bit double-precision floating point) Single (32-bit single-precision floating point) Int32 (32-bit signed integer) Int16 (16-bit signed integer) Int8 (8-bit signed integer) Uint32 (32-bit unsigned integer) Uint16 (16-bit unsigned integer) Uint8 (8-bit unsigned integer) M. M. Myint
  • 22.
  • 24. Spatial Transformations(Lab 3) - Modify the spatial relationship between pixels in an image, mapping pixel locations in an input image to new locations in an output image -Perform certain specialized spatial transformations, such as resizing and rotating an image M. M. Myint Dr. Moe Moe Myint Information Technology Department Technological University (Kyaukse)
  • 25. B = imresize(A, scale) returns image B that is scale times the size of A. The input image A can be a grayscale, RGB, or binary image. If scale is between 0 and 1.0, B is smaller than A. If scale is greater than 1.0, B is larger than A.
  • 26. To resize an image, use the imresize function I = imread('circuit.tif'); J = imresize(I,1.25); imshow(I) figure, imshow(J) To create an output image with 100 rows and 150 columns I = imread('circuit.tif'); J = imresize(I,[100 150]); imshow(I) figure, imshow(J) M. M. Myint
  • 27. B = imrotate(A, angle) rotates image A by angle degrees in a counterclockwise direction around its center point. To rotate the image clockwise, specify a negative value for angle.
  • 28. To rotate an image, use the imrotate function I = imread('circuit.tif'); J = imrotate(I,35); %counterclockwise direction around its center point imshow(I) figure, imshow(J) To rotate an image, use the imrotate function I = imread('circuit.tif'); J = imrotate(I,-35); %clockwise direction around its center point imshow(I) figure, imshow(J) M. M. Myint
  • 29. To extract a rectangular portion of an image, use the imcrop function I = imread('circuit.tif') J = imcrop(I); I = imread('circuit.tif'); J = imcrop(I,[60 40 100 90]); M. M. Myint
  • 30. B = impyramid(A, direction) computes a Gaussian pyramid reduction or expansion of A by one level direction can be 'reduce' or 'expand'. M. M. Myint
  • 31. I0 = imread('cameraman.tif'); I1 = impyramid(I0, 'reduce'); I2 = impyramid(I1, 'reduce'); I3 = impyramid(I2, 'reduce'); imshow(I0) figure, imshow(I1) figure, imshow(I2) figure, imshow(I3) I0 =imread('cameraman.tif'); I1 = impyramid(I0, ‘expand'); I2 = impyramid(I1, ‘expand'); I3 = impyramid(I2, ‘expand'); imshow(I0) figure, imshow(I1) figure, imshow(I2) figure, imshow(I3) Expansion
  • 32. Read the image and display it with title ‘Input Image’ Resize the input image with scale greater than 1.0 and display it with title ‘Resize Image with >1.0’ Also …..with scale between 0 and 1.0 and display it with title ‘Resize Image with <1.0’ Rotate the ‘Resize image with >1.0’ %Clockwise direction Crop the input image with copying the position Compute a four-level multiresolution pyramid of the input image
  • 33. Practice3.m %Shrink by factor of two using the defaults of bicubic interpolation and antialiasing I = imread('rice.png'); J = imresize(I, 0.5); figure, imshow(I), figure, imshow(J) %Shrink by factor of two using nearest-neighbor interpolation (This is the fastest method, but it has the lowest quality.) J2 = imresize(I, 0.5, 'nearest'); %Resize an indexed image [X, map] = imread('trees.tif'); [Y, newmap] = imresize(X, map, 0.5); imshow(Y, newmap) %Resize an RGB image to have 64 rows (The number of columns is computed automatically.) RGB = imread('peppers.png'); RGB2 = imresize(RGB, [64 NaN]); M. M. Myint
  • 34. Practice4.m %Read a solar spectra image, stored in FITS format, and rotate the image to bring it into horizontal alignment. A rotation of -1 degree is all that is required. I = fitsread('solarspectra.fts'); I = mat2gray(I); J = imrotate(I,-1,'bilinear','crop'); figure, imshow(I) figure, imshow(J) M. M. Myint
  • 35. Image Analysis (Lab 4) M. M. Myint Dr. Moe Moe Myint Information Technology Department Technological University (Kyaukse)
  • 36. bwboundaries Trace region boundaries in binary image bwtraceboundary Trace object in binary image cornermetric Create corner metric matrix from image edge Find edges in grayscale image hough Hough transform houghlines Extract line segments based on Hough transform houghpeaks Identify peaks in Hough transform Qtdecomp Quadtree decomposition qtgetblk Block values in quadtree decomposition qtsetblk Set block values in quadtree decomposition
  • 37.  The Sobel method finds edges using the Sobel approximation to the derivative. It returns edges at those points where the gradient of I is maximum. BW = edge(I,'sobel')  The Prewitt method finds edges using the Prewitt approximation to the derivative. It returns edges at those points where the gradient of I is maximum. BW = edge(I,'prewitt')  The Roberts method finds edges using the Roberts approximation to the derivative. It returns edges at those points where the gradient of I is maximum. BW = edge(I,'roberts') M. M. Myint
  • 38. The Laplacian of Gaussian method finds edges by looking for zero crossings after filtering I with a Laplacian of Gaussian filter. BW = edge(I,'log') The Canny method finds edges by looking for local maxima of the gradient of I. The gradient is calculated using the derivative of a Gaussian filter. The method uses two thresholds, to detect strong and weak edges, and includes the weak edges in the output only if they are connected to strong edges. This method is therefore less likely than the others to be fooled by noise, and more likely to detect true weak edges. BW = edge(I,'canny')
  • 39. Examples Find the edges of an image using the Prewitt and Canny methods. I = imread('circuit.tif'); BW1 = edge(I,'prewitt'); BW2 = edge(I,'canny'); imshow(BW1); figure, imshow(BW2
  • 40. Practice1.m clc,clear all, close all I=imread('peppers.png'); imshow(I);title('Input Image'); I=rgb2gray(I); figure,imshow(I);title('Gray Image'); BW1=edge(I); figure,imshow(BW1);title('Edge Image'); BW2=edge(I,'sobel'); figure,imshow(BW2);title('Sobel'); BW3=edge(I,'prewitt'); figure,imshow(BW3);title('Prewitt'); BW4=edge(I,'roberts'); figure,imshow(BW4);title('Roberts'); BW5=edge(I,'log'); figure,imshow(BW5);title('Log'); BW7=edge(I,'canny'); figure,imshow(BW7);title('Canny'); M. M. Myint

Editor's Notes

  1. - This example introduces some basic image processing concepts. The example starts by reading an image into the MATLAB workspace. The example then performs some contrast adjustment on the image. Finally, the example writes the adjusted image to a file.
  2. Gray-scale image or Gray level image
  3. For each pixel in the image, the red, green, and blue elements combine to create the pixel’s actual color. For example, to determine the color of the pixel (112,86), look at the RGB triplet stored in (112,86,1:3). Suppose (112,86,1) contains the value 0.1238, (112,86,2) contains 0.9874, and (112,86,3) contains 0.2543. The color for the pixel at (112,86) is: 0.1238 0.9874 0.2543 An RGB array can be of class double, in which case it contains values in the range [0,1]. class uint8, in which case the data range is [0,255].
  4. 1. Display an image from a file. 2. Display an indexed image. 3. Display a grayscale image. 4. Display the same grayscale image, adjusting the display range.
  5. 1. Display an image from a file. 2. Display an indexed image. 3. Display a grayscale image. 4. Display the same grayscale image, adjusting the display range.
  6. 1. Display an image from a file. 2. Display an indexed image. 3. Display a grayscale image. 4. Display the same grayscale image, adjusting the display range.
  7. 1. Display an image from a file. 2. Display an indexed image. 3. Display a grayscale image. 4. Display the same grayscale image, adjusting the display range.
  8. 1. Display an image from a file. 2. Display an indexed image. 3. Display a grayscale image. 4. Display the same grayscale image, adjusting the display range.
  9. 1. Display an image from a file. 2. Display an indexed image. 3. Display a grayscale image. 4. Display the same grayscale image, adjusting the display range.
  10. 1. Display an image from a file. 2. Display an indexed image. 3. Display a grayscale image. 4. Display the same grayscale image, adjusting the display range.
  11. Image Conversion gray2ind - intensity image to index image im2bw - image to binary im2double - image to double precision im2uint8 - image to 8-bit unsigned integers im2uint16 - image to 16-bit unsigned integers ind2gray - indexed image to intensity image mat2gray - matrix to intensity image rgb2gray - RGB image to grayscale rgb2ind - RGB image to indexed image
  12. Color-Space conversions in ImageTransform Color transformations in ImageTransform consist of converting a three-layer wave (e.g., RGB) into another three-layer wave (e.g., XYZ). rgb2gray rgb2hsl convert2gray cmap2rgb hsl2rgb rgb2xyz xyz2rgb cmyk2rgb rgb2I123 ************** Color-Space conversions in colorSpaceConversions procedures The color transformations in procedures are designed to convert a single color at a time. Using optional input parameters you can use the procedures to set function variables to individual components or to print them to the history. RGB2Lab Lab2RGB RGB2XYZ XYZ2RGB RGB2XYZccir XYZccir2RGB RGB2XYZitu XYZitu2RGB RGB2YUV YUV2RGB RGB2YIQ YIQ2RGB YUV2YIQ YIQ2YUV RGB2YCbCr YCbCr2RGB HSL2RGB HSV2RGB
  13. A spatial transformation (also known as a geometric operation) modifies the spatial relationship between pixels in an image, mapping pixel locations in an input image to new locations in an output image. The toolbox includes functions that perform certain specialized spatial transformations, such as resizing and rotating an image. In addition, the toolbox includes functions that you can use to perform many types of 2-D and N-D spatial transformations, including custom transformations. Resizing an Image Rotating an Image Cropping an Image Performing General 2-D Spatial Transformations Performing N-Dimensional Spatial Transformations Example: Performing Image Registration
  14. To resize an image, use the imresize function. When you resize an image, you specify the image to be resized and the magnification factor. To enlarge an image, specify a magnification factor greater than 1. To reduce an image, specify a magnification factor between 0 and 1. For example, the command below increases the size of an image by 1.25 times. You can specify the size of the output image by passing a vector that contains the number of rows and columns in the output image. If the specified size does not produce the same aspect ratio as the input image, the output image will be distorted. If you specify one of the elements in the vector as NaN, imresize calculates the value for that dimension to preserve the aspect ratio of the image. This example creates an output image with 100 rows and 150 columns.
  15. To rotate an image, use the imrotate function. When you rotate an image, you specify the image to be rotated and the rotation angle, in degrees. If you specify a positive rotation angle, imrotate rotates the image counterclockwise; if you specify a negative rotation angle, imrotate rotates the image clockwise. By default, imrotate creates an output image large enough to include the entire original image. Pixels that fall outside the boundaries of the original image are set to 0 and appear as a black background in the output image. You can, however, specify that the output image be the same size as the input image, using the &amp;apos;crop&amp;apos; argument. Similarly, imrotate uses nearest-neighbor interpolation by default to determine the value of pixels in the output image, but you can specify other interpolation methods. See the imrotate reference page for a list of supported interpolation methods. This example rotates an image 35° counterclockwise and specifies bilinear interpolation.
  16. To extract a rectangular portion of an image, use the imcrop function. Using imcrop, you can specify the crop region interactively using the mouse or programmatically by specifying the size and position of the crop region. This example illustrates an interactive syntax. The example reads an image into the MATLAB workspace and calls imcrop specifying the image as an argument. imcrop displays the image in a figure window and waits for you to draw the crop rectangle on the image. When you move the pointer over the image, the shape of the pointer changes to cross hairs . Click and drag the pointer to specify the size and position of the crop rectangle. You can move and adjust the size of the crop rectangle using the mouse. When you are satisfied with the crop rectangle, double-click to perform the crop operation, or right-click inside the crop rectangle and select Crop Image from the context menu. imcrop returns the cropped image in J. You can also specify the size and position of the crop rectangle as parameters when you call imcrop. Specify the crop rectangle as a four-element position vector, [xmin ymin width height]. In this example, you call imcrop specifying the image to crop, I, and the crop rectangle. imcrop returns the cropped image in J.
  17. To extract a rectangular portion of an image, use the imcrop function. Using imcrop, you can specify the crop region interactively using the mouse or programmatically by specifying the size and position of the crop region. This example illustrates an interactive syntax. The example reads an image into the MATLAB workspace and calls imcrop specifying the image as an argument. imcrop displays the image in a figure window and waits for you to draw the crop rectangle on the image. When you move the pointer over the image, the shape of the pointer changes to cross hairs . Click and drag the pointer to specify the size and position of the crop rectangle. You can move and adjust the size of the crop rectangle using the mouse. When you are satisfied with the crop rectangle, double-click to perform the crop operation, or right-click inside the crop rectangle and select Crop Image from the context menu. imcrop returns the cropped image in J. You can also specify the size and position of the crop rectangle as parameters when you call imcrop. Specify the crop rectangle as a four-element position vector, [xmin ymin width height]. In this example, you call imcrop specifying the image to crop, I, and the crop rectangle. imcrop returns the cropped image in J.
  18. A spatial transformation (also known as a geometric operation) modifies the spatial relationship between pixels in an image, mapping pixel locations in an input image to new locations in an output image. The toolbox includes functions that perform certain specialized spatial transformations, such as resizing and rotating an image. In addition, the toolbox includes functions that you can use to perform many types of 2-D and N-D spatial transformations, including custom transformations. Resizing an Image Rotating an Image Cropping an Image Performing General 2-D Spatial Transformations Performing N-Dimensional Spatial Transformations Example: Performing Image Registration
  19. In an image, an edge is a curve that follows a path of rapid change in image intensity. Edges are often associated with the boundaries of objects in a scene. Edge detection is used to identify the edges in an image.