SlideShare a Scribd company logo
1 of 16
Download to read offline
MATLAB & IMAGE PROCESSING 1
Presented by
Dr. M. Venkatanarayana, cri,ksrmce,kadapa
Introduction
After completion of this topic, student will be able to
1. imread()1. imread()
2. imshow()
3. imwrite()
4. rgb2gray()
5. imhist()
6. imadjust()
7. im2bw()
imread():This command will read an image into a matrix
>> img=imread('BerkeleyTower.png');
>> size(img)
ans =
499 748 3
imshow()/imshowsc:To show an image
The imshow() command shows an image in standard 8-bit format, like it would appear in a web browser.
The imagesc()command displays the image on scaled axes with the min value as black and the max
value as white.
>> imshow(img)
Figure window
We can check the RGB values with (x,y) coordinates of a pixel:
1. Select "Data Cursor" icon from the top menu1. Select "Data Cursor" icon from the top menu
2. Click the mouse on the image
Actually, a color image is a combined image of 3 grayscale images. So, we can display the individual
RGB components of the image using the following script:
Code:
clear all; close all
img=imread('BerkeleyTower.png');
subplot(131);
imagesc(img(:,:,1));
title('Red');
Red
50
100
150
200
Green
50
100
150
200
Blue
50
100
150
200
title('Red');
subplot(132);
imagesc(img(:,:,2));
title('Green');
subplot(133);
imagesc(img(:,:,3));
title('Blue');
200 400 600
250
300
350
400
450
200 400 600
250
300
350
400
450
200 400 600
250
300
350
400
450
>> colormap gray
Red
50
100
150
200
Green
50
100
150
200
Blue
50
100
150
200
200 400 600
250
300
350
400
450
200 400 600
250
300
350
400
450
200 400 600
250
300
350
400
450
double data format
● The standard image format is uint8 (8-bit integer), which may not like arithmetic
operation and could give us errors if we try mathematical operations.
● So, we may want to do image processing by casting our image matrix● So, we may want to do image processing by casting our image matrix
to double format before we do our math.
● Then we cast back to uint8 format at the end, before displaying the image.
Code:
clear all; close all
img=imread('BerkeleyTower.png');
subplot(211);
imshow(img);
title('Normal RGB');
subplot(212);
Normal RGB
subplot(212);
blue_img = double(img);
blue_img(:,:,3) = 4*blue_img(:,:,3);
blue_img = uint8(blue_img);
imshow(blue_img);
title('RG 4*B');
RG 4*B
Imwrite(): to save or store a variable to a file
● X=imread('hawk.png');
● Y=imresize(X,[256 256]);● Y=imresize(X,[256 256]);
● imwrite(Y,'myhawk.png');
rgb2gray()
img = imread(‘BerkeleyTower.png');
gray = rgb2gray(img); imshow(gray);
Imhist(): to show histogram of an image
Display a histogram of image data.
Imhist(img,n) displays a histogram with n bins for the intensity imageImhist(img,n) displays a histogram with n bins for the intensity image
above a grayscale colorbar of length n.
If we omit the argument, imhist() uses a default value of n = 256 if I is a
grayscale image, or n = 2 if I is a binary image.
3000
4000
5000
Historgram
0
1000
2000
0 50 100 150 200 250
imadjust() :adjust image intensity values. It maps the values in intensity image of an
input to new values in output image. This increases the contrast of the output image.
input adjustedimg = imread('Rachmaninoff.jpg');
gray = rgb2gray(img);
adj_img = imadjust(gray, [0.3,0.7],[]);
subplot(121);
imshow(gray);
title('input');title('input');
subplot(122);
imshow(adj_img);
title('adjusted');
im2bw() converts the grayscale image to a binary image. We'll use the adjusted
image.
input image binary imageimg = imread('Rachmaninoff.jpg');
gray = rgb2gray(img);
adj_img = imadjust(gray, [0.3,0.7],[]);
bw_img = im2bw(adj_img);
subplot(121);
imshow(adj_img);
title('input image');title('input image');
subplot(122);
imshow(bw_img);
title('binary image');

More Related Content

What's hot

Microsoft Word Hw#3
Microsoft Word   Hw#3Microsoft Word   Hw#3
Microsoft Word Hw#3kkkseld
 
Deep learning study 3
Deep learning study 3Deep learning study 3
Deep learning study 3San Kim
 
Introduction of Xgboost
Introduction of XgboostIntroduction of Xgboost
Introduction of Xgboostmichiaki ito
 
Gauss in java
Gauss in javaGauss in java
Gauss in javabaxter89
 
Kristhyan kurtlazartezubia evidencia1-metodosnumericos
Kristhyan kurtlazartezubia evidencia1-metodosnumericosKristhyan kurtlazartezubia evidencia1-metodosnumericos
Kristhyan kurtlazartezubia evidencia1-metodosnumericosKristhyanAndreeKurtL
 
Image processing lab work
Image processing lab workImage processing lab work
Image processing lab workShajun Nisha
 
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)Kobkrit Viriyayudhakorn
 
Deep Learning with Julia1.0 and Flux
Deep Learning with Julia1.0 and FluxDeep Learning with Julia1.0 and Flux
Deep Learning with Julia1.0 and FluxSatoshi Terasaki
 
Nyc open-data-2015-andvanced-sklearn-expanded
Nyc open-data-2015-andvanced-sklearn-expandedNyc open-data-2015-andvanced-sklearn-expanded
Nyc open-data-2015-andvanced-sklearn-expandedVivian S. Zhang
 
Gradient boosting in practice: a deep dive into xgboost
Gradient boosting in practice: a deep dive into xgboostGradient boosting in practice: a deep dive into xgboost
Gradient boosting in practice: a deep dive into xgboostJaroslaw Szymczak
 
Edit/correct India Map In Cdat Documentation - With Edited World Map Data
Edit/correct India Map In Cdat  Documentation -  With Edited World Map Data Edit/correct India Map In Cdat  Documentation -  With Edited World Map Data
Edit/correct India Map In Cdat Documentation - With Edited World Map Data Arulalan T
 

What's hot (20)

Microsoft Word Hw#3
Microsoft Word   Hw#3Microsoft Word   Hw#3
Microsoft Word Hw#3
 
Deep learning study 3
Deep learning study 3Deep learning study 3
Deep learning study 3
 
Otsu
OtsuOtsu
Otsu
 
Introduction of Xgboost
Introduction of XgboostIntroduction of Xgboost
Introduction of Xgboost
 
09 Simulation
09 Simulation09 Simulation
09 Simulation
 
Gauss in java
Gauss in javaGauss in java
Gauss in java
 
Kristhyan kurtlazartezubia evidencia1-metodosnumericos
Kristhyan kurtlazartezubia evidencia1-metodosnumericosKristhyan kurtlazartezubia evidencia1-metodosnumericos
Kristhyan kurtlazartezubia evidencia1-metodosnumericos
 
Divided difference Matlab code
Divided difference Matlab codeDivided difference Matlab code
Divided difference Matlab code
 
Image processing lab work
Image processing lab workImage processing lab work
Image processing lab work
 
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
 
C# Assignmet Help
C# Assignmet HelpC# Assignmet Help
C# Assignmet Help
 
Sharbani bhattacharya sacta 2014
Sharbani bhattacharya sacta 2014Sharbani bhattacharya sacta 2014
Sharbani bhattacharya sacta 2014
 
Deep Learning with Julia1.0 and Flux
Deep Learning with Julia1.0 and FluxDeep Learning with Julia1.0 and Flux
Deep Learning with Julia1.0 and Flux
 
MFC Tree
MFC TreeMFC Tree
MFC Tree
 
Nyc open-data-2015-andvanced-sklearn-expanded
Nyc open-data-2015-andvanced-sklearn-expandedNyc open-data-2015-andvanced-sklearn-expanded
Nyc open-data-2015-andvanced-sklearn-expanded
 
OpenGL L05-Texturing
OpenGL L05-TexturingOpenGL L05-Texturing
OpenGL L05-Texturing
 
Gradient boosting in practice: a deep dive into xgboost
Gradient boosting in practice: a deep dive into xgboostGradient boosting in practice: a deep dive into xgboost
Gradient boosting in practice: a deep dive into xgboost
 
Edit/correct India Map In Cdat Documentation - With Edited World Map Data
Edit/correct India Map In Cdat  Documentation -  With Edited World Map Data Edit/correct India Map In Cdat  Documentation -  With Edited World Map Data
Edit/correct India Map In Cdat Documentation - With Edited World Map Data
 
Calculus
CalculusCalculus
Calculus
 
Array and pointer
Array and pointerArray and pointer
Array and pointer
 

Similar to Dip 1

Images in matlab
Images in matlabImages in matlab
Images in matlabAli Alvi
 
could you draw uml diagram for this code from PIL import Image, Im.pdf
could you draw uml diagram for this code from PIL import Image, Im.pdfcould you draw uml diagram for this code from PIL import Image, Im.pdf
could you draw uml diagram for this code from PIL import Image, Im.pdfmurtuzadahadwala3
 
Basics of image processing using MATLAB
Basics of image processing using MATLABBasics of image processing using MATLAB
Basics of image processing using MATLABMohsin Siddique
 
Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlabAnkur Tyagi
 
Histogram dan Segmentasi
Histogram dan SegmentasiHistogram dan Segmentasi
Histogram dan SegmentasiLusiana Diyan
 
Histogram dan Segmentasi 2
Histogram dan Segmentasi 2Histogram dan Segmentasi 2
Histogram dan Segmentasi 2Lusiana Diyan
 
Using the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdfUsing the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdfacteleshoppe
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)JAINAM KAPADIYA
 
Image processing for robotics
Image processing for roboticsImage processing for robotics
Image processing for roboticsSALAAMCHAUS
 
The code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdfThe code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdffatoryoutlets
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 
Computer graphics
Computer graphics Computer graphics
Computer graphics shafiq sangi
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics FunctionsSHAKOOR AB
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptxAvinashJain66
 

Similar to Dip 1 (20)

Images in matlab
Images in matlabImages in matlab
Images in matlab
 
Dip 2
Dip 2Dip 2
Dip 2
 
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
 
Dip iit workshop
Dip iit workshopDip iit workshop
Dip iit workshop
 
could you draw uml diagram for this code from PIL import Image, Im.pdf
could you draw uml diagram for this code from PIL import Image, Im.pdfcould you draw uml diagram for this code from PIL import Image, Im.pdf
could you draw uml diagram for this code from PIL import Image, Im.pdf
 
Basics of image processing using MATLAB
Basics of image processing using MATLABBasics of image processing using MATLAB
Basics of image processing using MATLAB
 
Dip syntax 4
Dip syntax 4Dip syntax 4
Dip syntax 4
 
Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlab
 
Histogram dan Segmentasi
Histogram dan SegmentasiHistogram dan Segmentasi
Histogram dan Segmentasi
 
Histogram dan Segmentasi 2
Histogram dan Segmentasi 2Histogram dan Segmentasi 2
Histogram dan Segmentasi 2
 
Using the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdfUsing the code below- I need help with creating code for the following.pdf
Using the code below- I need help with creating code for the following.pdf
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)
 
Image processing for robotics
Image processing for roboticsImage processing for robotics
Image processing for robotics
 
Graphics in C++
Graphics in C++Graphics in C++
Graphics in C++
 
The code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdfThe code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdf
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics Functions
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptx
 

Recently uploaded

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
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
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
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
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 

Recently uploaded (20)

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
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
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
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
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
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
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 

Dip 1

  • 1. MATLAB & IMAGE PROCESSING 1 Presented by Dr. M. Venkatanarayana, cri,ksrmce,kadapa
  • 2. Introduction After completion of this topic, student will be able to 1. imread()1. imread() 2. imshow() 3. imwrite() 4. rgb2gray() 5. imhist() 6. imadjust() 7. im2bw()
  • 3. imread():This command will read an image into a matrix >> img=imread('BerkeleyTower.png'); >> size(img) ans = 499 748 3
  • 4. imshow()/imshowsc:To show an image The imshow() command shows an image in standard 8-bit format, like it would appear in a web browser. The imagesc()command displays the image on scaled axes with the min value as black and the max value as white. >> imshow(img)
  • 5.
  • 6. Figure window We can check the RGB values with (x,y) coordinates of a pixel: 1. Select "Data Cursor" icon from the top menu1. Select "Data Cursor" icon from the top menu 2. Click the mouse on the image Actually, a color image is a combined image of 3 grayscale images. So, we can display the individual RGB components of the image using the following script:
  • 7. Code: clear all; close all img=imread('BerkeleyTower.png'); subplot(131); imagesc(img(:,:,1)); title('Red'); Red 50 100 150 200 Green 50 100 150 200 Blue 50 100 150 200 title('Red'); subplot(132); imagesc(img(:,:,2)); title('Green'); subplot(133); imagesc(img(:,:,3)); title('Blue'); 200 400 600 250 300 350 400 450 200 400 600 250 300 350 400 450 200 400 600 250 300 350 400 450
  • 8. >> colormap gray Red 50 100 150 200 Green 50 100 150 200 Blue 50 100 150 200 200 400 600 250 300 350 400 450 200 400 600 250 300 350 400 450 200 400 600 250 300 350 400 450
  • 9. double data format ● The standard image format is uint8 (8-bit integer), which may not like arithmetic operation and could give us errors if we try mathematical operations. ● So, we may want to do image processing by casting our image matrix● So, we may want to do image processing by casting our image matrix to double format before we do our math. ● Then we cast back to uint8 format at the end, before displaying the image.
  • 10. Code: clear all; close all img=imread('BerkeleyTower.png'); subplot(211); imshow(img); title('Normal RGB'); subplot(212); Normal RGB subplot(212); blue_img = double(img); blue_img(:,:,3) = 4*blue_img(:,:,3); blue_img = uint8(blue_img); imshow(blue_img); title('RG 4*B'); RG 4*B
  • 11. Imwrite(): to save or store a variable to a file ● X=imread('hawk.png'); ● Y=imresize(X,[256 256]);● Y=imresize(X,[256 256]); ● imwrite(Y,'myhawk.png');
  • 13. Imhist(): to show histogram of an image Display a histogram of image data. Imhist(img,n) displays a histogram with n bins for the intensity imageImhist(img,n) displays a histogram with n bins for the intensity image above a grayscale colorbar of length n. If we omit the argument, imhist() uses a default value of n = 256 if I is a grayscale image, or n = 2 if I is a binary image.
  • 15. imadjust() :adjust image intensity values. It maps the values in intensity image of an input to new values in output image. This increases the contrast of the output image. input adjustedimg = imread('Rachmaninoff.jpg'); gray = rgb2gray(img); adj_img = imadjust(gray, [0.3,0.7],[]); subplot(121); imshow(gray); title('input');title('input'); subplot(122); imshow(adj_img); title('adjusted');
  • 16. im2bw() converts the grayscale image to a binary image. We'll use the adjusted image. input image binary imageimg = imread('Rachmaninoff.jpg'); gray = rgb2gray(img); adj_img = imadjust(gray, [0.3,0.7],[]); bw_img = im2bw(adj_img); subplot(121); imshow(adj_img); title('input image');title('input image'); subplot(122); imshow(bw_img); title('binary image');