SlideShare a Scribd company logo
MATLAB & IMAGE PROCESSING 2
Presented by
Dr. M. Venkatanarayana, cri,ksrmce,kadapa
Getting image information
After completion of this topic, student will be able to use
● imfinfo()
● impixelinfo
● rgb2ind()
● colormap(jet)
The imfinfo() gives us lots of information
>> info=imfinfo('Sun.jpg')
info =
Querying a pixel info
● Because the image itself is an array, we can check the values it is storing.
For example, if we want to know the values of the pixel at (350, 250):For example, if we want to know the values of the pixel at (350, 250):
● >> img(350,250,:)
● ans(:,:,1) = 157
● ans(:,:,2) = 70
● ans(:,:,3) = 0
rgb2ind()
● "Indexed color saves a lot of memory, storage space, and transmission
time: using truecolor, each pixel needs 24 bits, or 3 bytes. A typicaltime: using truecolor, each pixel needs 24 bits, or 3 bytes. A typical
640x480 VGA resolution truecolor uncompressed image needs 640x480x3
= 921,600 bytes (900 KiB). Limiting the image colors to 256, every pixel
needs only 8 bits, or 1 byte each, so the example image now needs only
640x480x1 = 307,200 bytes (300 KiB), plus 256x3 = 768 additional bytes to
store the palette map in itself (assuming RGB), approx. one third of the
original size."
Code:
● img = imread('Sun.jpg');
● [IND,map] =
● img = imread('Sun.jpg');
● [IND,map] = ● [IND,map] =
rgb2ind(img,32);
● figure('Name','Indexed
image with 32 Colors');
● imagesc(IND);
● colormap(map);
● [IND,map] =
rgb2ind(img,32);
● figure('Name','Indexed
image with 32 Colors');
● imshow(IND);
● colormap(map);
200
400
600
200 400 600 800 1000 1200 1400 1600
800
1000
1200
Colormap(jet);colormap(spring)
200
400
600
200
400
600
200 400 600 800 1000 1200 1400 1600
600
800
1000
1200
200 400 600 800 1000 1200 1400 1600
600
800
1000
1200
Creating grayscale image: We're going to create two
grayscale images of size 320×240,320×240,one with pixels
all black and the other one all white:
h = 240;
w = 320;
white = uint8(255*ones(h,w));
black = uint8(zeros(h,w));
figure;figure;
subplot(121);
imshow(white);
subplot(122);
imshow(black);
Class - Data Type: There are one thing to keep in mind when we process
images: data type. Is my image in uint8or double? One of the most frequent
issues caused by the data type is imshow(). We converted the image to double
to do something with the image, and now we want to draw it
● img = imread('cameraman.tif');
● img_d = double(img);● img_d = double(img);
● % ... played with the image, now we want to display it
● imshow(img_d);
Result is white image rather than original image
The imshow() has two function overloading. It takes image with type uint8 as it ranges
between [0, 255], and takes image with type double as it ranges between [0, 1]. So, in our
case, every pixel with over 1 is considered saturated, and that's why we got white cameraman.
img = imread('cameraman.tif');
img_d = double(img);
imshow(img_d/255);
Data type conversion problems
Extracting bit-plane from Grayscale image With mod() operation, we can extract a bit-
plane image. The mod(img,2) gives us either 0 or 1
img = imread('cameraman.tif');
img = double(img);
bp0 = mod(img,2);
imshow(bp0);
title('bit-plane 0');
bit-plane 0 bit-plane 1
title('bit-plane 0');
bit-plane 2 bit-plane 3 bit-plane 4
bit-plane 5 bit-plane 6 bit-plane 7

More Related Content

What's hot

Image processing
Image processingImage processing
Image processing
Dr. Heena Kher
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
Prabin Gautam
 
SIGNATE 国立国会図書館の画像データレイアウト認識 1st place solution
SIGNATE 国立国会図書館の画像データレイアウト認識 1st place solutionSIGNATE 国立国会図書館の画像データレイアウト認識 1st place solution
SIGNATE 国立国会図書館の画像データレイアウト認識 1st place solution
Koji Asami
 
Week 6
Week 6Week 6
COMPUTER GRAPHICS
COMPUTER GRAPHICSCOMPUTER GRAPHICS
COMPUTER GRAPHICS
Jagan Raja
 
Deep single view 3 d object reconstruction with visual hull
Deep single view 3 d object reconstruction with visual hullDeep single view 3 d object reconstruction with visual hull
Deep single view 3 d object reconstruction with visual hull
Hanqing Wang
 
Mat lab lecture part 1
Mat lab lecture part 1Mat lab lecture part 1
Mat lab lecture part 1
OmGulshan
 
Introductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT RoorkeeIntroductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT Roorkee
Vinayak Sahai
 
Juggle: Hybrid Large-Scale Music Recommendation
Juggle: Hybrid Large-Scale Music RecommendationJuggle: Hybrid Large-Scale Music Recommendation
Juggle: Hybrid Large-Scale Music Recommendation
José Devezas
 
Translating Linear Functions "I AM" Answer Key!
Translating Linear Functions "I AM" Answer Key!Translating Linear Functions "I AM" Answer Key!
Translating Linear Functions "I AM" Answer Key!
Deborah_Johnson
 
Output primitives computer graphics c version
Output primitives   computer graphics c versionOutput primitives   computer graphics c version
Output primitives computer graphics c version
Marwa Al-Rikaby
 
5.1 quadratic functions
5.1 quadratic functions5.1 quadratic functions
5.1 quadratic functionsmorrobea
 
Properties of-graphs-2.5
Properties of-graphs-2.5Properties of-graphs-2.5
Properties of-graphs-2.5
International advisers
 
Visualising Big Data
Visualising Big DataVisualising Big Data
Visualising Big Data
Amit Kapoor
 
Deep learning
Deep learningDeep learning
Deep learning
DrBaljitSinghKhehra
 
Terminado matematica ii
Terminado matematica iiTerminado matematica ii
Terminado matematica ii
yonygerardo
 

What's hot (20)

Image processing
Image processingImage processing
Image processing
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
SIGNATE 国立国会図書館の画像データレイアウト認識 1st place solution
SIGNATE 国立国会図書館の画像データレイアウト認識 1st place solutionSIGNATE 国立国会図書館の画像データレイアウト認識 1st place solution
SIGNATE 国立国会図書館の画像データレイアウト認識 1st place solution
 
Cg lab cse-v (1) (1)
Cg lab cse-v (1) (1)Cg lab cse-v (1) (1)
Cg lab cse-v (1) (1)
 
Ch22 28
Ch22 28Ch22 28
Ch22 28
 
Week 6
Week 6Week 6
Week 6
 
COMPUTER GRAPHICS
COMPUTER GRAPHICSCOMPUTER GRAPHICS
COMPUTER GRAPHICS
 
Deep single view 3 d object reconstruction with visual hull
Deep single view 3 d object reconstruction with visual hullDeep single view 3 d object reconstruction with visual hull
Deep single view 3 d object reconstruction with visual hull
 
Mat lab lecture part 1
Mat lab lecture part 1Mat lab lecture part 1
Mat lab lecture part 1
 
Introductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT RoorkeeIntroductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT Roorkee
 
Juggle: Hybrid Large-Scale Music Recommendation
Juggle: Hybrid Large-Scale Music RecommendationJuggle: Hybrid Large-Scale Music Recommendation
Juggle: Hybrid Large-Scale Music Recommendation
 
Translating Linear Functions "I AM" Answer Key!
Translating Linear Functions "I AM" Answer Key!Translating Linear Functions "I AM" Answer Key!
Translating Linear Functions "I AM" Answer Key!
 
Energía
EnergíaEnergía
Energía
 
ikh323-05
ikh323-05ikh323-05
ikh323-05
 
Output primitives computer graphics c version
Output primitives   computer graphics c versionOutput primitives   computer graphics c version
Output primitives computer graphics c version
 
5.1 quadratic functions
5.1 quadratic functions5.1 quadratic functions
5.1 quadratic functions
 
Properties of-graphs-2.5
Properties of-graphs-2.5Properties of-graphs-2.5
Properties of-graphs-2.5
 
Visualising Big Data
Visualising Big DataVisualising Big Data
Visualising Big Data
 
Deep learning
Deep learningDeep learning
Deep learning
 
Terminado matematica ii
Terminado matematica iiTerminado matematica ii
Terminado matematica ii
 

Similar to Dip 2

Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlabAnkur Tyagi
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptx
AvinashJain66
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLAB
Sriram Emarose
 
Dip syntax 4
Dip syntax 4Dip syntax 4
Dip syntax 4
Shajun Nisha
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using MATLAB
Amarjeetsingh Thakur
 
Image processing in MATLAB
Image processing in MATLABImage processing in MATLAB
Image processing in MATLAB
Amarjeetsingh Thakur
 
Dip 1
Dip 1Dip 1
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)Hasitha Ediriweera
 
Matlab intro
Matlab introMatlab intro
Matlab introfvijayami
 
Image processing for robotics
Image processing for roboticsImage processing for robotics
Image processing for robotics
SALAAMCHAUS
 
Image processing
Image processingImage processing
Image processing
Antriksh Saxena
 
We are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdfWe are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdf
DARSHANACHARYA13
 
الوسائط المتعددة Multimedia تاج
الوسائط المتعددة  Multimedia تاجالوسائط المتعددة  Multimedia تاج
الوسائط المتعددة Multimedia تاج
maaz hamed
 
Simple Matlab tutorial using matlab inbuilt commands
Simple Matlab tutorial using matlab inbuilt commandsSimple Matlab tutorial using matlab inbuilt commands
Simple Matlab tutorial using matlab inbuilt commands
Lakshmi Sarvani Videla
 
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
Ashok Kumar
 
Working with images in matlab graphics
Working with images in matlab graphicsWorking with images in matlab graphics
Working with images in matlab graphics
mustafa_92
 
CE344L-200365-Lab5.pdf
CE344L-200365-Lab5.pdfCE344L-200365-Lab5.pdf
CE344L-200365-Lab5.pdf
UmarMustafa13
 
Image_Processing_LECTURE_c#_programming.ppt
Image_Processing_LECTURE_c#_programming.pptImage_Processing_LECTURE_c#_programming.ppt
Image_Processing_LECTURE_c#_programming.ppt
LOUISSEVERINOROMANO
 

Similar to Dip 2 (20)

Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlab
 
Image processing tool box.pptx
Image processing tool box.pptxImage processing tool box.pptx
Image processing tool box.pptx
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLAB
 
Dip syntax 4
Dip syntax 4Dip syntax 4
Dip syntax 4
 
Image Processing Using MATLAB
Image Processing Using MATLABImage Processing Using MATLAB
Image Processing Using MATLAB
 
Image processing in MATLAB
Image processing in MATLABImage processing in MATLAB
Image processing in MATLAB
 
Dip 1
Dip 1Dip 1
Dip 1
 
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
Image processing for robotics
Image processing for roboticsImage processing for robotics
Image processing for robotics
 
Image processing
Image processingImage processing
Image processing
 
Ec section
Ec section Ec section
Ec section
 
Image processing
Image processingImage processing
Image processing
 
We are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdfWe are restricted from importing cv2 numpy stats and other.pdf
We are restricted from importing cv2 numpy stats and other.pdf
 
الوسائط المتعددة Multimedia تاج
الوسائط المتعددة  Multimedia تاجالوسائط المتعددة  Multimedia تاج
الوسائط المتعددة Multimedia تاج
 
Simple Matlab tutorial using matlab inbuilt commands
Simple Matlab tutorial using matlab inbuilt commandsSimple Matlab tutorial using matlab inbuilt commands
Simple Matlab tutorial using matlab inbuilt commands
 
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
 
Working with images in matlab graphics
Working with images in matlab graphicsWorking with images in matlab graphics
Working with images in matlab graphics
 
CE344L-200365-Lab5.pdf
CE344L-200365-Lab5.pdfCE344L-200365-Lab5.pdf
CE344L-200365-Lab5.pdf
 
Image_Processing_LECTURE_c#_programming.ppt
Image_Processing_LECTURE_c#_programming.pptImage_Processing_LECTURE_c#_programming.ppt
Image_Processing_LECTURE_c#_programming.ppt
 

Recently uploaded

RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 

Recently uploaded (20)

RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 

Dip 2

  • 1. MATLAB & IMAGE PROCESSING 2 Presented by Dr. M. Venkatanarayana, cri,ksrmce,kadapa
  • 2. Getting image information After completion of this topic, student will be able to use ● imfinfo() ● impixelinfo ● rgb2ind() ● colormap(jet)
  • 3. The imfinfo() gives us lots of information >> info=imfinfo('Sun.jpg') info =
  • 4. Querying a pixel info ● Because the image itself is an array, we can check the values it is storing. For example, if we want to know the values of the pixel at (350, 250):For example, if we want to know the values of the pixel at (350, 250): ● >> img(350,250,:) ● ans(:,:,1) = 157 ● ans(:,:,2) = 70 ● ans(:,:,3) = 0
  • 5. rgb2ind() ● "Indexed color saves a lot of memory, storage space, and transmission time: using truecolor, each pixel needs 24 bits, or 3 bytes. A typicaltime: using truecolor, each pixel needs 24 bits, or 3 bytes. A typical 640x480 VGA resolution truecolor uncompressed image needs 640x480x3 = 921,600 bytes (900 KiB). Limiting the image colors to 256, every pixel needs only 8 bits, or 1 byte each, so the example image now needs only 640x480x1 = 307,200 bytes (300 KiB), plus 256x3 = 768 additional bytes to store the palette map in itself (assuming RGB), approx. one third of the original size."
  • 6.
  • 7. Code: ● img = imread('Sun.jpg'); ● [IND,map] = ● img = imread('Sun.jpg'); ● [IND,map] = ● [IND,map] = rgb2ind(img,32); ● figure('Name','Indexed image with 32 Colors'); ● imagesc(IND); ● colormap(map); ● [IND,map] = rgb2ind(img,32); ● figure('Name','Indexed image with 32 Colors'); ● imshow(IND); ● colormap(map);
  • 8.
  • 9. 200 400 600 200 400 600 800 1000 1200 1400 1600 800 1000 1200
  • 10. Colormap(jet);colormap(spring) 200 400 600 200 400 600 200 400 600 800 1000 1200 1400 1600 600 800 1000 1200 200 400 600 800 1000 1200 1400 1600 600 800 1000 1200
  • 11. Creating grayscale image: We're going to create two grayscale images of size 320×240,320×240,one with pixels all black and the other one all white: h = 240; w = 320; white = uint8(255*ones(h,w)); black = uint8(zeros(h,w)); figure;figure; subplot(121); imshow(white); subplot(122); imshow(black);
  • 12. Class - Data Type: There are one thing to keep in mind when we process images: data type. Is my image in uint8or double? One of the most frequent issues caused by the data type is imshow(). We converted the image to double to do something with the image, and now we want to draw it ● img = imread('cameraman.tif'); ● img_d = double(img);● img_d = double(img); ● % ... played with the image, now we want to display it ● imshow(img_d); Result is white image rather than original image The imshow() has two function overloading. It takes image with type uint8 as it ranges between [0, 255], and takes image with type double as it ranges between [0, 1]. So, in our case, every pixel with over 1 is considered saturated, and that's why we got white cameraman.
  • 13. img = imread('cameraman.tif'); img_d = double(img); imshow(img_d/255); Data type conversion problems
  • 14. Extracting bit-plane from Grayscale image With mod() operation, we can extract a bit- plane image. The mod(img,2) gives us either 0 or 1 img = imread('cameraman.tif'); img = double(img); bp0 = mod(img,2); imshow(bp0); title('bit-plane 0'); bit-plane 0 bit-plane 1 title('bit-plane 0');
  • 15. bit-plane 2 bit-plane 3 bit-plane 4 bit-plane 5 bit-plane 6 bit-plane 7