SlideShare a Scribd company logo
1 of 30
Image processing tool box
DR. Anjali Potnis
NITTTR, Bhopal
Basic Definition of Digital Image
Digital images are two or multidimensional array
represent pixel which constitute the complete
image matrix.
I(x,y)= [ ]mxn is an Intensity image or Black and
White image .
I(x,y)=[ ]mxnxq is a colour image or RGB
image.
What is the Image Processing Toolbox?
• The Image Processing Toolbox is a collection of functions that
extend the capabilities of the MATLAB’s numeric computing
environment. The toolbox supports a wide range of image
processing operations, including:
– Geometric operations
– Neighborhood and block operations
– Linear filtering and filter design
– Transforms
– Image analysis and enhancement
– Binary image operations
– Region of interest operations
Image Processing Toolbox
Perform image processing, analysis , visualization
and algorithm development.
• Image Analysis
• Image Enhancement
• Spatial transformation
• Image registration
• Morphological operations
• ROI base processing
• Image display and exploration
Images and Data formats
• MATLAB can import/export
several image formats:
– BMP (Microsoft Windows Bitmap)
– GIF (Graphics Interchange Files)
– HDF (Hierarchical Data Format)
– JPEG (Joint Photographic Experts
Group)
– PCX (Paintbrush)
– PNG (Portable Network Graphics)
– TIFF (Tagged Image File Format)
– XWD (X Window Dump)
– raw-data and other types of image
data
• Data types in MATLAB
– 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)
Images in MATLAB
• Binary images : {0,1}
• Intensity images : [0,1] or uint8, double etc.
• RGB images : m × n × 3
• Multidimensional images: m × n × p (p is the number of layers)
Image Import and Export
• Read and write images in Matlab
img = imread('apple.jpg');
dim = size(img);
figure;
imshow(img);
imwrite(img, 'output.bmp', 'bmp');
• Alternatives to imshow
imagesc(I)
imtool(I)
image(I)
Images and Matrices
Column 1 to 256
Row
1
to
256
o
[0, 0]
o
[256, 256]
How to build a matrix
(or image)?
Intensity Image:
row = 256;
col = 256;
img = zeros(row, col);
img(100:105, :) = 0.5;
img(:, 100:105) = 1;
figure;
imshow(img);
Images and Matrices
Binary Image:
row = 256;
col = 256;
img = rand(row, col);
img = round(img);
figure;
imshow(img);
Image Display
• image - create and display image object
• imagesc - scale and display as image
• imshow - display image
• colorbar - display colorbar
• getimage - get image data from axes
• truesize - adjust display size of image
• zoom - zoom in and zoom out of 2D plot
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
Image Operations
• RGB image to gray image
• Image resize
• Image crop
• Image rotate
• Image histogram
• Image histogram equalization
• Image DCT/IDCT
• Convolution
- CODE
Examples working with Images
Blending two images
Examples working with Images
Sobel descriptor to detect object edge
Vectorize Loops
• Example
– Given image matrices, A and B, of the same size (540*380), blend these
two images
apple = imread(‘apple.jpg');
orange = imread(‘orange.jpg’);
• Poor Style
% measure performance using stopwatch timer
tic
for i = 1 : size(apple, 1)
for j = 1 : size(apple, 2)
for k = 1 : size(apple, 3)
output(i, j, k) = (apple(i, j, k) + orange(i, j,
k))/2;
end
end
end
toc
• Elapsed time is 0.138116 seconds
Vectorize Loops (cont.)
• Example
– Given image matrices, A and B, of the same size (600*400), blend
these two images
apple = imread(‘apple.jpg');
orange = imread(‘orange.jpg’);
• Better Style
tic % measure performance using stopwatch timer
Output = (apple + orange)/2;
toc
• Elapsed time is 0.099802 seconds
• Computation is faster!
Subset of Images
Image processing tool box.pptx
Image processing tool box.pptx
Image processing tool box.pptx
Image processing tool box.pptx
Image processing tool box.pptx
Image processing tool box.pptx
Image processing tool box.pptx
Image processing tool box.pptx
Image processing tool box.pptx
Image processing tool box.pptx
Image processing tool box.pptx

More Related Content

Similar to Image processing tool box.pptx

Working with images in matlab graphics
Working with images in matlab graphicsWorking with images in matlab graphics
Working with images in matlab graphicsmustafa_92
 
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)Hasitha Ediriweera
 
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
 
Multimedia tools(images)
Multimedia tools(images)Multimedia tools(images)
Multimedia tools(images)dhruv patel
 
Presentation1.pptx qalid.pptx
Presentation1.pptx qalid.pptxPresentation1.pptx qalid.pptx
Presentation1.pptx qalid.pptxssuserd565841
 
Prinsip gambar digital
Prinsip gambar digitalPrinsip gambar digital
Prinsip gambar digitalOno Trader
 
Overview of graphics systems
Overview of  graphics systemsOverview of  graphics systems
Overview of graphics systemsJay Nagar
 
YCIS_Forensic PArt 1 Digital Image Processing.pptx
YCIS_Forensic PArt 1 Digital Image Processing.pptxYCIS_Forensic PArt 1 Digital Image Processing.pptx
YCIS_Forensic PArt 1 Digital Image Processing.pptxSharmilaMore5
 
Dital Image Processing (Lab 2+3+4)
Dital Image Processing (Lab 2+3+4)Dital Image Processing (Lab 2+3+4)
Dital Image Processing (Lab 2+3+4)Moe Moe Myint
 
Fundamental Steps of Digital Image Processing & Image Components
Fundamental Steps of Digital Image Processing & Image ComponentsFundamental Steps of Digital Image Processing & Image Components
Fundamental Steps of Digital Image Processing & Image ComponentsKalyan Acharjya
 
Chapter 3 : IMAGE
Chapter 3 : IMAGEChapter 3 : IMAGE
Chapter 3 : IMAGEazira96
 
Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab SangeethaSasi1
 

Similar to Image processing tool box.pptx (20)

Working with images in matlab graphics
Working with images in matlab graphicsWorking with images in matlab graphics
Working with images in matlab graphics
 
MATLAB & Image Processing
MATLAB & Image ProcessingMATLAB & Image Processing
MATLAB & Image Processing
 
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)
 
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
 
Matlab practical ---2.pdf
Matlab practical ---2.pdfMatlab practical ---2.pdf
Matlab practical ---2.pdf
 
Images
ImagesImages
Images
 
Multimedia tools(images)
Multimedia tools(images)Multimedia tools(images)
Multimedia tools(images)
 
Presentation1.pptx qalid.pptx
Presentation1.pptx qalid.pptxPresentation1.pptx qalid.pptx
Presentation1.pptx qalid.pptx
 
Dip day1&2
Dip day1&2Dip day1&2
Dip day1&2
 
Dip 2
Dip 2Dip 2
Dip 2
 
Prinsip gambar digital
Prinsip gambar digitalPrinsip gambar digital
Prinsip gambar digital
 
Overview of graphics systems
Overview of  graphics systemsOverview of  graphics systems
Overview of graphics systems
 
YCIS_Forensic PArt 1 Digital Image Processing.pptx
YCIS_Forensic PArt 1 Digital Image Processing.pptxYCIS_Forensic PArt 1 Digital Image Processing.pptx
YCIS_Forensic PArt 1 Digital Image Processing.pptx
 
Dital Image Processing (Lab 2+3+4)
Dital Image Processing (Lab 2+3+4)Dital Image Processing (Lab 2+3+4)
Dital Image Processing (Lab 2+3+4)
 
Fundamental Steps of Digital Image Processing & Image Components
Fundamental Steps of Digital Image Processing & Image ComponentsFundamental Steps of Digital Image Processing & Image Components
Fundamental Steps of Digital Image Processing & Image Components
 
Project 1
Project 1Project 1
Project 1
 
Image & Graphics
Image & GraphicsImage & Graphics
Image & Graphics
 
Chapter 3 : IMAGE
Chapter 3 : IMAGEChapter 3 : IMAGE
Chapter 3 : IMAGE
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab
 

More from AvinashJain66

Graphs and waveforms.ppt
Graphs and waveforms.pptGraphs and waveforms.ppt
Graphs and waveforms.pptAvinashJain66
 
Loop Concept and Array.ppt
Loop Concept and Array.pptLoop Concept and Array.ppt
Loop Concept and Array.pptAvinashJain66
 
Looping concept.pptx
Looping concept.pptxLooping concept.pptx
Looping concept.pptxAvinashJain66
 
Virtual Instrumentation & LabVIEW-lini.ppt
Virtual Instrumentation & LabVIEW-lini.pptVirtual Instrumentation & LabVIEW-lini.ppt
Virtual Instrumentation & LabVIEW-lini.pptAvinashJain66
 
PIC18F458_Ritula Thakur.pptx.pdf
PIC18F458_Ritula Thakur.pptx.pdfPIC18F458_Ritula Thakur.pptx.pdf
PIC18F458_Ritula Thakur.pptx.pdfAvinashJain66
 
Introduction_PIC18F458_Ritula Thakur.pptx
Introduction_PIC18F458_Ritula Thakur.pptxIntroduction_PIC18F458_Ritula Thakur.pptx
Introduction_PIC18F458_Ritula Thakur.pptxAvinashJain66
 
Lecture-6-PIC Programming in C-good.pdf
Lecture-6-PIC Programming in C-good.pdfLecture-6-PIC Programming in C-good.pdf
Lecture-6-PIC Programming in C-good.pdfAvinashJain66
 

More from AvinashJain66 (9)

FACTS.pdf
FACTS.pdfFACTS.pdf
FACTS.pdf
 
Graphs and waveforms.ppt
Graphs and waveforms.pptGraphs and waveforms.ppt
Graphs and waveforms.ppt
 
Loop Concept and Array.ppt
Loop Concept and Array.pptLoop Concept and Array.ppt
Loop Concept and Array.ppt
 
Looping concept.pptx
Looping concept.pptxLooping concept.pptx
Looping concept.pptx
 
Virtual Instrumentation & LabVIEW-lini.ppt
Virtual Instrumentation & LabVIEW-lini.pptVirtual Instrumentation & LabVIEW-lini.ppt
Virtual Instrumentation & LabVIEW-lini.ppt
 
PIC18F458_Ritula Thakur.pptx.pdf
PIC18F458_Ritula Thakur.pptx.pdfPIC18F458_Ritula Thakur.pptx.pdf
PIC18F458_Ritula Thakur.pptx.pdf
 
Introduction_PIC18F458_Ritula Thakur.pptx
Introduction_PIC18F458_Ritula Thakur.pptxIntroduction_PIC18F458_Ritula Thakur.pptx
Introduction_PIC18F458_Ritula Thakur.pptx
 
Lecture-6-PIC Programming in C-good.pdf
Lecture-6-PIC Programming in C-good.pdfLecture-6-PIC Programming in C-good.pdf
Lecture-6-PIC Programming in C-good.pdf
 
Relay-ppt.pptx
Relay-ppt.pptxRelay-ppt.pptx
Relay-ppt.pptx
 

Recently uploaded

Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniquesugginaramesh
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 

Recently uploaded (20)

Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniques
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 

Image processing tool box.pptx

  • 1. Image processing tool box DR. Anjali Potnis NITTTR, Bhopal
  • 2. Basic Definition of Digital Image Digital images are two or multidimensional array represent pixel which constitute the complete image matrix. I(x,y)= [ ]mxn is an Intensity image or Black and White image . I(x,y)=[ ]mxnxq is a colour image or RGB image.
  • 3.
  • 4. What is the Image Processing Toolbox? • The Image Processing Toolbox is a collection of functions that extend the capabilities of the MATLAB’s numeric computing environment. The toolbox supports a wide range of image processing operations, including: – Geometric operations – Neighborhood and block operations – Linear filtering and filter design – Transforms – Image analysis and enhancement – Binary image operations – Region of interest operations
  • 5. Image Processing Toolbox Perform image processing, analysis , visualization and algorithm development. • Image Analysis • Image Enhancement • Spatial transformation • Image registration • Morphological operations • ROI base processing • Image display and exploration
  • 6. Images and Data formats • MATLAB can import/export several image formats: – BMP (Microsoft Windows Bitmap) – GIF (Graphics Interchange Files) – HDF (Hierarchical Data Format) – JPEG (Joint Photographic Experts Group) – PCX (Paintbrush) – PNG (Portable Network Graphics) – TIFF (Tagged Image File Format) – XWD (X Window Dump) – raw-data and other types of image data • Data types in MATLAB – 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)
  • 7. Images in MATLAB • Binary images : {0,1} • Intensity images : [0,1] or uint8, double etc. • RGB images : m × n × 3 • Multidimensional images: m × n × p (p is the number of layers)
  • 8. Image Import and Export • Read and write images in Matlab img = imread('apple.jpg'); dim = size(img); figure; imshow(img); imwrite(img, 'output.bmp', 'bmp'); • Alternatives to imshow imagesc(I) imtool(I) image(I)
  • 9. Images and Matrices Column 1 to 256 Row 1 to 256 o [0, 0] o [256, 256] How to build a matrix (or image)? Intensity Image: row = 256; col = 256; img = zeros(row, col); img(100:105, :) = 0.5; img(:, 100:105) = 1; figure; imshow(img);
  • 10. Images and Matrices Binary Image: row = 256; col = 256; img = rand(row, col); img = round(img); figure; imshow(img);
  • 11. Image Display • image - create and display image object • imagesc - scale and display as image • imshow - display image • colorbar - display colorbar • getimage - get image data from axes • truesize - adjust display size of image • zoom - zoom in and zoom out of 2D plot
  • 12. 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
  • 13. Image Operations • RGB image to gray image • Image resize • Image crop • Image rotate • Image histogram • Image histogram equalization • Image DCT/IDCT • Convolution - CODE
  • 14. Examples working with Images Blending two images
  • 15. Examples working with Images Sobel descriptor to detect object edge
  • 16. Vectorize Loops • Example – Given image matrices, A and B, of the same size (540*380), blend these two images apple = imread(‘apple.jpg'); orange = imread(‘orange.jpg’); • Poor Style % measure performance using stopwatch timer tic for i = 1 : size(apple, 1) for j = 1 : size(apple, 2) for k = 1 : size(apple, 3) output(i, j, k) = (apple(i, j, k) + orange(i, j, k))/2; end end end toc • Elapsed time is 0.138116 seconds
  • 17. Vectorize Loops (cont.) • Example – Given image matrices, A and B, of the same size (600*400), blend these two images apple = imread(‘apple.jpg'); orange = imread(‘orange.jpg’); • Better Style tic % measure performance using stopwatch timer Output = (apple + orange)/2; toc • Elapsed time is 0.099802 seconds • Computation is faster!
  • 18.