SlideShare a Scribd company logo
1 of 41
Image Formation Fundamentals
CS491E/791E
How are images represented
in the computer?
Color images
Image formation
• There are two parts to the image formation process:
– The geometry of image formation, which determines
where in the image plane the projection of a point in the
scene will be located.
– The physics of light, which determines the brightness of a
point in the image plane as a function of illumination and
surface properties.
A Simple model of image formation
• The scene is illuminated by a single source.
• The scene reflects radiation towards the camera.
• The camera senses it via chemicals on film.
Pinhole camera
• This is the simplest device to form an image of a 3D scene
on a 2D surface.
• Straight rays of light pass through a “pinhole” and form an
inverted image of the object on the image plane.
fX
x
Z

fY
y
Z

Camera optics
• In practice, the aperture must be larger to admit more light.
• Lenses are placed to in the aperture to focus the bundle of rays
from each scene point onto the corresponding point in the image
plane
Image formation (cont’d)
• Optical parameters of the lens
– lens type
– focal length
– field of view
• Photometric parameters
– type, intensity, and direction of illumination
– reflectance properties of the viewed surfaces
• Geometric parameters
– type of projections
– position and orientation of camera in space
– perspective distortions introduced by the imaging process
Image distortion
What is light?
• The visible portion of the electromagnetic (EM) spectrum.
• It occurs between wavelengths of approximately 400 and
700 nanometers.
Short wavelengths
• Different wavelengths of radiation have different
properties.
• The x-ray region of the spectrum, it carries sufficient
energy to penetrate a significant volume or material.
Long wavelengths
• Copious quantities of infrared (IR) radiation are emitted
from warm objects (e.g., locate people in total darkness).
Long wavelengths (cont’d)
• “Synthetic aperture radar” (SAR) imaging techniques
use an artificially generated source of microwaves to probe
a scene.
• SAR is unaffected by weather conditions and clouds (e.g.,
has provided us images of the surface of Venus).
Range images
• An array of distances to the objects in the scene.
• They can be produced by sonar or by using laser
rangefinders.
Sonic images
• Produced by the reflection of sound waves off an object.
• High sound frequencies are used to improve resolution.
CCD (Charged-Coupled Device) cameras
• Tiny solid state cells convert light energy into electrical
charge.
• The image plane acts as a digital memory that can be read
row by row by a computer.
Frame grabber
• Usually, a CCD camera plugs into a computer board
(frame grabber).
• The frame grabber digitizes the signal and stores it in its
memory (frame buffer).
Image digitization
• Sampling means measuring the value of an image at a
finite number of points.
• Quantization is the representation of the measured value
at the sampled point by an integer.
Image digitization (cont’d)
Image quantization(example)
• 256 gray levels (8bits/pixel) 32 gray levels (5 bits/pixel) 16 gray levels (4 bits/pixel)
• 8 gray levels (3 bits/pixel) 4 gray levels (2 bits/pixel) 2 gray levels (1 bit/pixel)
Image sampling (example)
original image sampled by a factor of 2
sampled by a factor of 4 sampled by a factor of 8
Digital image
• An image is represented by a rectangular array of integers.
• An integer represents the brightness or darkness of the
image at that point.
• N: # of rows, M: # of columns, Q: # of gray levels
– N = , M = , Q = (q is the # of bits/pixel)
– Storage requirements: NxMxQ (e.g., N=M=1024, q=8, 1MB)
(0,0) (0,1) ... (0, 1)
(1,0) (1,1) ... (1, 1)
... ... ... ...
( 1,0) ( 1,1) ... ( 1, 1)
f f f M
f f f M
f N f N f N M


   
2 n 2 m 2 q
Image file formats
• Many image formats adhere to the simple model shown below
(line by line, no breaks between lines).
• The header contains at least the width and height of the image.
• Most headers begin with a signature or “magic number” - a
short sequence of bytes for identifying the file format.
Common image file formats
• GIF (Graphic Interchange Format) -
• PNG (Portable Network Graphics)
• JPEG (Joint Photographic Experts Group)
• TIFF (Tagged Image File Format)
• PGM (Portable Gray Map)
• FITS (Flexible Image Transport System)
Comparison of image formats
PGM format
• A popular format for grayscale images (8 bits/pixel)
• Closely-related formats are:
– PBM (Portable Bitmap), for binary images (1 bit/pixel)
– PPM (Portable Pixelmap), for color images (24 bits/pixel)
• ASCII or binary (raw) storage
ASCII vs Raw format
• ASCII format has the following advantages:
– Pixel values can be examined or modified very easily using a
standard text editor.
– Files in raw format cannot be modified in this way since they
contain many unprintable characters.
• Raw format has the following advantages:
– It is much more compact compared to the ASCII format.
– Pixel values are coded using only a single character !
Image Class
class ImageType {
public:
ImageType();
~ImageType();
// more functions ...
private:
int N, M, Q; //N: # rows, M: # columns
int **pixelValue;
};
An example - Threshold.cpp
void readImageHeader(char[], int&, int&, int&, bool&);
void readImage(char[], ImageType&);
void writeImage(char[], ImageType&);
void main(int argc, char *argv[])
{
int i, j;
int M, N, Q;
bool type;
int val;
int thresh;
// read image header
readImageHeader(argv[1], N, M, Q, type);
// allocate memory for the image array
ImageType image(N, M, Q);
// read image
readImage(argv[1], image);
Threshold.cpp (cont’d)
cout << "Enter threshold: ";
cin >> thresh;
// threshold image
for(i=0; i<N; i++)
for(j=0; j<M; j++) {
image.getVal(i, j, val);
if(val < thresh)
image.setVal(i, j, 255);
else
image.setVal(i, j, 0);
}
// write image
writeImage(argv[2], image);
}
Reading/Writing PGM images
Writing a PGM image to a file
void writeImage(char fname[], ImageType& image)
int N, M, Q;
unsigned char *charImage;
ofstream ofp;
image.getImageInfo(N, M, Q);
charImage = (unsigned char *) new unsigned char [M*N];
// convert the integer values to unsigned char
int val;
for(i=0; i<N; i++)
for(j=0; j<M; j++)
image.getVal(i, j, val);
charImage[i*M+j]=(unsigned char)val;
}
Writing a PGM image... (cont’d)
ofp.open(fname, ios::out);
if (!ofp) {
cout << "Can't open file: " << fname << endl;
exit(1);
}
ofp << "P5" << endl;
ofp << M << " " << N << endl;
ofp << Q << endl;
ofp.write( reinterpret_cast<char *>(charImage), (M*N)*sizeof(unsigned char));
if (ofp.fail()) {
cout << "Can't write image " << fname << endl;
exit(0);
}
ofp.close();
}
Reading a PGM image from a file
void readImage(char fname[], ImageType& image)
{
int i, j;
int N, M, Q;
unsigned char *charImage;
char header [100], *ptr;
ifstream ifp;
ifp.open(fname, ios::in);
if (!ifp) {
cout << "Can't read image: " << fname << endl;
exit(1);
}
// read header
ifp.getline(header,100,'n');
if ( (header[0]!=80) || /* 'P' */
(header[1]!=53) ) { /* '5' */
cout << "Image " << fname << " is not PGM" << endl;
exit(1);
}
Reading a PGM image …. (cont’d)
ifp.getline(header,100,'n');
while(header[0]=='#')
ifp.getline(header,100,'n');
M=strtol(header,&ptr,0);
N=atoi(ptr);
ifp.getline(header,100,'n');
Q=strtol(header,&ptr,0);
charImage = (unsigned char *) new unsigned char [M*N];
ifp.read( reinterpret_cast<char *>(charImage), (M*N)*sizeof(unsigned char));
if (ifp.fail()) {
cout << "Image " << fname << " has wrong size" << endl;
exit(1);
}
ifp.close();
Reading a PGM image…(cont’d)
//
// Convert the unsigned characters to integers
//
int val;
for(i=0; i<N; i++)
for(j=0; j<M; j++) {
val = (int)charImage[i*M+j];
image.setVal(i, j, val);
}
}
How do I “see” images on the computer?
• Unix: xv, gimp
• Windows: Photoshop
How do I display an image from within
my C++ program?
• Save the image into a file with a default name (e.g., tmp.pgm)
using the WriteImage function.
• Put the following command in your C++ program:
system(“xv tmp.pgm”);
• This is a system call !!
• It passes the command within the quotes to the Unix operating
system.
• You can execute any Unix command this way ….
How do I convert an image from one
format to another?
• Use xv’s “save” option
• It can also convert images
How do I print an image?
• Load the image using “xv”
• Save the image in “postscript” format
• Print the postscript file (e.g., lpr -Pname image.ps)
Image processing software
• CVIPtools (Computer Vision and Image Processing tools)
• Intel Open Computer Vision Library
• Microsoft Vision SDL Library
• Matlab
• Khoros
• For more information, see
– http://www.cs.unr.edu/~bebis/CS791E
– http://www.cs.unr.edu/CRCD/ComputerVision/cv_resources.html

More Related Content

Similar to IP_Fundamentals.ppt

Intro+Imaging.ppt
Intro+Imaging.pptIntro+Imaging.ppt
Intro+Imaging.pptshohel rana
 
CUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : NotesCUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : NotesSubhajit Sahu
 
BEC007 -Digital image processing.pdf
BEC007  -Digital image processing.pdfBEC007  -Digital image processing.pdf
BEC007 -Digital image processing.pdfgopikahari7
 
An Introduction to digital image processing
An Introduction to digital image processingAn Introduction to digital image processing
An Introduction to digital image processingnastaranEmamjomeh1
 
A (very brief) Introduction to Image Processing and 3D Printing with ImageJ
A (very brief) Introduction to Image Processing and 3D Printing with ImageJA (very brief) Introduction to Image Processing and 3D Printing with ImageJ
A (very brief) Introduction to Image Processing and 3D Printing with ImageJPaul Mignone, Ph.D
 
Overview of graphics systems
Overview of  graphics systemsOverview of  graphics systems
Overview of graphics systemsJay Nagar
 
Understanding neural radiance fields
Understanding neural radiance fieldsUnderstanding neural radiance fields
Understanding neural radiance fieldsVarun Bhaseen
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image ProcessingReshma KC
 
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptxDIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptxMdMojnuMiah3
 
Working with images in matlab graphics
Working with images in matlab graphicsWorking with images in matlab graphics
Working with images in matlab graphicsmustafa_92
 
Digital image Processing.ppt
Digital image Processing.pptDigital image Processing.ppt
Digital image Processing.ppthassanHayyat
 
Digital Image Representation.ppt
Digital Image Representation.pptDigital Image Representation.ppt
Digital Image Representation.pptsghorai
 
Matlab Training in Jalandhar | Matlab Training in Phagwara
Matlab Training in Jalandhar | Matlab Training in PhagwaraMatlab Training in Jalandhar | Matlab Training in Phagwara
Matlab Training in Jalandhar | Matlab Training in PhagwaraE2Matrix
 
Matlab Training in Chandigarh
Matlab Training in ChandigarhMatlab Training in Chandigarh
Matlab Training in ChandigarhE2Matrix
 
Photometric calibration
Photometric calibrationPhotometric calibration
Photometric calibrationAli A Jalil
 

Similar to IP_Fundamentals.ppt (20)

Intro+Imaging.ppt
Intro+Imaging.pptIntro+Imaging.ppt
Intro+Imaging.ppt
 
CUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : NotesCUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : Notes
 
CG.pptx
CG.pptxCG.pptx
CG.pptx
 
Image processing
Image processingImage processing
Image processing
 
DIP-Unit1-Session1.pdf
DIP-Unit1-Session1.pdfDIP-Unit1-Session1.pdf
DIP-Unit1-Session1.pdf
 
BEC007 -Digital image processing.pdf
BEC007  -Digital image processing.pdfBEC007  -Digital image processing.pdf
BEC007 -Digital image processing.pdf
 
An Introduction to digital image processing
An Introduction to digital image processingAn Introduction to digital image processing
An Introduction to digital image processing
 
A (very brief) Introduction to Image Processing and 3D Printing with ImageJ
A (very brief) Introduction to Image Processing and 3D Printing with ImageJA (very brief) Introduction to Image Processing and 3D Printing with ImageJ
A (very brief) Introduction to Image Processing and 3D Printing with ImageJ
 
Overview of graphics systems
Overview of  graphics systemsOverview of  graphics systems
Overview of graphics systems
 
Understanding neural radiance fields
Understanding neural radiance fieldsUnderstanding neural radiance fields
Understanding neural radiance fields
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptxDIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
 
Working with images in matlab graphics
Working with images in matlab graphicsWorking with images in matlab graphics
Working with images in matlab graphics
 
Digital image Processing.ppt
Digital image Processing.pptDigital image Processing.ppt
Digital image Processing.ppt
 
Digital Image Representation.ppt
Digital Image Representation.pptDigital Image Representation.ppt
Digital Image Representation.ppt
 
lect4-images.ppt
lect4-images.pptlect4-images.ppt
lect4-images.ppt
 
Matlab Training in Jalandhar | Matlab Training in Phagwara
Matlab Training in Jalandhar | Matlab Training in PhagwaraMatlab Training in Jalandhar | Matlab Training in Phagwara
Matlab Training in Jalandhar | Matlab Training in Phagwara
 
Matlab Training in Chandigarh
Matlab Training in ChandigarhMatlab Training in Chandigarh
Matlab Training in Chandigarh
 
Photometric calibration
Photometric calibrationPhotometric calibration
Photometric calibration
 
Digital Image Fundamentals - II
Digital Image Fundamentals - IIDigital Image Fundamentals - II
Digital Image Fundamentals - II
 

More from vasuhisrinivasan

2. Dispersion Understanding the effects of dispersion in optical fibers is qu...
2. Dispersion Understanding the effects of dispersion in optical fibers is qu...2. Dispersion Understanding the effects of dispersion in optical fibers is qu...
2. Dispersion Understanding the effects of dispersion in optical fibers is qu...vasuhisrinivasan
 
AntBrief123A12-6-07.pptMaxwell’s Equations & EM Waves
AntBrief123A12-6-07.pptMaxwell’s Equations & EM WavesAntBrief123A12-6-07.pptMaxwell’s Equations & EM Waves
AntBrief123A12-6-07.pptMaxwell’s Equations & EM Wavesvasuhisrinivasan
 
Helical.pptan antenna consisting of a conducting wire wound in the form of a ...
Helical.pptan antenna consisting of a conducting wire wound in the form of a ...Helical.pptan antenna consisting of a conducting wire wound in the form of a ...
Helical.pptan antenna consisting of a conducting wire wound in the form of a ...vasuhisrinivasan
 
cis595_03_IMAGE_FUNDAMENTALS.ppt
cis595_03_IMAGE_FUNDAMENTALS.pptcis595_03_IMAGE_FUNDAMENTALS.ppt
cis595_03_IMAGE_FUNDAMENTALS.pptvasuhisrinivasan
 
Radiation from an Oscillating Electric Dipole.ppt
Radiation from an Oscillating Electric Dipole.pptRadiation from an Oscillating Electric Dipole.ppt
Radiation from an Oscillating Electric Dipole.pptvasuhisrinivasan
 
Human Detection and Tracking Using Apparent Features under.pdf
Human Detection and Tracking Using Apparent Features under.pdfHuman Detection and Tracking Using Apparent Features under.pdf
Human Detection and Tracking Using Apparent Features under.pdfvasuhisrinivasan
 

More from vasuhisrinivasan (14)

2. Dispersion Understanding the effects of dispersion in optical fibers is qu...
2. Dispersion Understanding the effects of dispersion in optical fibers is qu...2. Dispersion Understanding the effects of dispersion in optical fibers is qu...
2. Dispersion Understanding the effects of dispersion in optical fibers is qu...
 
AntBrief123A12-6-07.pptMaxwell’s Equations & EM Waves
AntBrief123A12-6-07.pptMaxwell’s Equations & EM WavesAntBrief123A12-6-07.pptMaxwell’s Equations & EM Waves
AntBrief123A12-6-07.pptMaxwell’s Equations & EM Waves
 
Helical.pptan antenna consisting of a conducting wire wound in the form of a ...
Helical.pptan antenna consisting of a conducting wire wound in the form of a ...Helical.pptan antenna consisting of a conducting wire wound in the form of a ...
Helical.pptan antenna consisting of a conducting wire wound in the form of a ...
 
surveillance.ppt
surveillance.pptsurveillance.ppt
surveillance.ppt
 
Aerial photo.ppt
Aerial photo.pptAerial photo.ppt
Aerial photo.ppt
 
cis595_03_IMAGE_FUNDAMENTALS.ppt
cis595_03_IMAGE_FUNDAMENTALS.pptcis595_03_IMAGE_FUNDAMENTALS.ppt
cis595_03_IMAGE_FUNDAMENTALS.ppt
 
rmsip98.ppt
rmsip98.pptrmsip98.ppt
rmsip98.ppt
 
defenseTalk.ppt
defenseTalk.pptdefenseTalk.ppt
defenseTalk.ppt
 
Ch24 fiber optics.pptx
Ch24 fiber optics.pptxCh24 fiber optics.pptx
Ch24 fiber optics.pptx
 
Radiation from an Oscillating Electric Dipole.ppt
Radiation from an Oscillating Electric Dipole.pptRadiation from an Oscillating Electric Dipole.ppt
Radiation from an Oscillating Electric Dipole.ppt
 
Aperture ant.ppt
Aperture ant.pptAperture ant.ppt
Aperture ant.ppt
 
Spiral antenna.pptx
Spiral antenna.pptxSpiral antenna.pptx
Spiral antenna.pptx
 
Antennas-p-3.ppt
Antennas-p-3.pptAntennas-p-3.ppt
Antennas-p-3.ppt
 
Human Detection and Tracking Using Apparent Features under.pdf
Human Detection and Tracking Using Apparent Features under.pdfHuman Detection and Tracking Using Apparent Features under.pdf
Human Detection and Tracking Using Apparent Features under.pdf
 

Recently uploaded

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 

Recently uploaded (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 

IP_Fundamentals.ppt

  • 2. How are images represented in the computer?
  • 4. Image formation • There are two parts to the image formation process: – The geometry of image formation, which determines where in the image plane the projection of a point in the scene will be located. – The physics of light, which determines the brightness of a point in the image plane as a function of illumination and surface properties.
  • 5. A Simple model of image formation • The scene is illuminated by a single source. • The scene reflects radiation towards the camera. • The camera senses it via chemicals on film.
  • 6. Pinhole camera • This is the simplest device to form an image of a 3D scene on a 2D surface. • Straight rays of light pass through a “pinhole” and form an inverted image of the object on the image plane. fX x Z  fY y Z 
  • 7. Camera optics • In practice, the aperture must be larger to admit more light. • Lenses are placed to in the aperture to focus the bundle of rays from each scene point onto the corresponding point in the image plane
  • 8. Image formation (cont’d) • Optical parameters of the lens – lens type – focal length – field of view • Photometric parameters – type, intensity, and direction of illumination – reflectance properties of the viewed surfaces • Geometric parameters – type of projections – position and orientation of camera in space – perspective distortions introduced by the imaging process
  • 10. What is light? • The visible portion of the electromagnetic (EM) spectrum. • It occurs between wavelengths of approximately 400 and 700 nanometers.
  • 11. Short wavelengths • Different wavelengths of radiation have different properties. • The x-ray region of the spectrum, it carries sufficient energy to penetrate a significant volume or material.
  • 12. Long wavelengths • Copious quantities of infrared (IR) radiation are emitted from warm objects (e.g., locate people in total darkness).
  • 13. Long wavelengths (cont’d) • “Synthetic aperture radar” (SAR) imaging techniques use an artificially generated source of microwaves to probe a scene. • SAR is unaffected by weather conditions and clouds (e.g., has provided us images of the surface of Venus).
  • 14. Range images • An array of distances to the objects in the scene. • They can be produced by sonar or by using laser rangefinders.
  • 15. Sonic images • Produced by the reflection of sound waves off an object. • High sound frequencies are used to improve resolution.
  • 16. CCD (Charged-Coupled Device) cameras • Tiny solid state cells convert light energy into electrical charge. • The image plane acts as a digital memory that can be read row by row by a computer.
  • 17. Frame grabber • Usually, a CCD camera plugs into a computer board (frame grabber). • The frame grabber digitizes the signal and stores it in its memory (frame buffer).
  • 18. Image digitization • Sampling means measuring the value of an image at a finite number of points. • Quantization is the representation of the measured value at the sampled point by an integer.
  • 20. Image quantization(example) • 256 gray levels (8bits/pixel) 32 gray levels (5 bits/pixel) 16 gray levels (4 bits/pixel) • 8 gray levels (3 bits/pixel) 4 gray levels (2 bits/pixel) 2 gray levels (1 bit/pixel)
  • 21. Image sampling (example) original image sampled by a factor of 2 sampled by a factor of 4 sampled by a factor of 8
  • 22. Digital image • An image is represented by a rectangular array of integers. • An integer represents the brightness or darkness of the image at that point. • N: # of rows, M: # of columns, Q: # of gray levels – N = , M = , Q = (q is the # of bits/pixel) – Storage requirements: NxMxQ (e.g., N=M=1024, q=8, 1MB) (0,0) (0,1) ... (0, 1) (1,0) (1,1) ... (1, 1) ... ... ... ... ( 1,0) ( 1,1) ... ( 1, 1) f f f M f f f M f N f N f N M       2 n 2 m 2 q
  • 23. Image file formats • Many image formats adhere to the simple model shown below (line by line, no breaks between lines). • The header contains at least the width and height of the image. • Most headers begin with a signature or “magic number” - a short sequence of bytes for identifying the file format.
  • 24. Common image file formats • GIF (Graphic Interchange Format) - • PNG (Portable Network Graphics) • JPEG (Joint Photographic Experts Group) • TIFF (Tagged Image File Format) • PGM (Portable Gray Map) • FITS (Flexible Image Transport System)
  • 26. PGM format • A popular format for grayscale images (8 bits/pixel) • Closely-related formats are: – PBM (Portable Bitmap), for binary images (1 bit/pixel) – PPM (Portable Pixelmap), for color images (24 bits/pixel) • ASCII or binary (raw) storage
  • 27. ASCII vs Raw format • ASCII format has the following advantages: – Pixel values can be examined or modified very easily using a standard text editor. – Files in raw format cannot be modified in this way since they contain many unprintable characters. • Raw format has the following advantages: – It is much more compact compared to the ASCII format. – Pixel values are coded using only a single character !
  • 28. Image Class class ImageType { public: ImageType(); ~ImageType(); // more functions ... private: int N, M, Q; //N: # rows, M: # columns int **pixelValue; };
  • 29. An example - Threshold.cpp void readImageHeader(char[], int&, int&, int&, bool&); void readImage(char[], ImageType&); void writeImage(char[], ImageType&); void main(int argc, char *argv[]) { int i, j; int M, N, Q; bool type; int val; int thresh; // read image header readImageHeader(argv[1], N, M, Q, type); // allocate memory for the image array ImageType image(N, M, Q); // read image readImage(argv[1], image);
  • 30. Threshold.cpp (cont’d) cout << "Enter threshold: "; cin >> thresh; // threshold image for(i=0; i<N; i++) for(j=0; j<M; j++) { image.getVal(i, j, val); if(val < thresh) image.setVal(i, j, 255); else image.setVal(i, j, 0); } // write image writeImage(argv[2], image); }
  • 32. Writing a PGM image to a file void writeImage(char fname[], ImageType& image) int N, M, Q; unsigned char *charImage; ofstream ofp; image.getImageInfo(N, M, Q); charImage = (unsigned char *) new unsigned char [M*N]; // convert the integer values to unsigned char int val; for(i=0; i<N; i++) for(j=0; j<M; j++) image.getVal(i, j, val); charImage[i*M+j]=(unsigned char)val; }
  • 33. Writing a PGM image... (cont’d) ofp.open(fname, ios::out); if (!ofp) { cout << "Can't open file: " << fname << endl; exit(1); } ofp << "P5" << endl; ofp << M << " " << N << endl; ofp << Q << endl; ofp.write( reinterpret_cast<char *>(charImage), (M*N)*sizeof(unsigned char)); if (ofp.fail()) { cout << "Can't write image " << fname << endl; exit(0); } ofp.close(); }
  • 34. Reading a PGM image from a file void readImage(char fname[], ImageType& image) { int i, j; int N, M, Q; unsigned char *charImage; char header [100], *ptr; ifstream ifp; ifp.open(fname, ios::in); if (!ifp) { cout << "Can't read image: " << fname << endl; exit(1); } // read header ifp.getline(header,100,'n'); if ( (header[0]!=80) || /* 'P' */ (header[1]!=53) ) { /* '5' */ cout << "Image " << fname << " is not PGM" << endl; exit(1); }
  • 35. Reading a PGM image …. (cont’d) ifp.getline(header,100,'n'); while(header[0]=='#') ifp.getline(header,100,'n'); M=strtol(header,&ptr,0); N=atoi(ptr); ifp.getline(header,100,'n'); Q=strtol(header,&ptr,0); charImage = (unsigned char *) new unsigned char [M*N]; ifp.read( reinterpret_cast<char *>(charImage), (M*N)*sizeof(unsigned char)); if (ifp.fail()) { cout << "Image " << fname << " has wrong size" << endl; exit(1); } ifp.close();
  • 36. Reading a PGM image…(cont’d) // // Convert the unsigned characters to integers // int val; for(i=0; i<N; i++) for(j=0; j<M; j++) { val = (int)charImage[i*M+j]; image.setVal(i, j, val); } }
  • 37. How do I “see” images on the computer? • Unix: xv, gimp • Windows: Photoshop
  • 38. How do I display an image from within my C++ program? • Save the image into a file with a default name (e.g., tmp.pgm) using the WriteImage function. • Put the following command in your C++ program: system(“xv tmp.pgm”); • This is a system call !! • It passes the command within the quotes to the Unix operating system. • You can execute any Unix command this way ….
  • 39. How do I convert an image from one format to another? • Use xv’s “save” option • It can also convert images
  • 40. How do I print an image? • Load the image using “xv” • Save the image in “postscript” format • Print the postscript file (e.g., lpr -Pname image.ps)
  • 41. Image processing software • CVIPtools (Computer Vision and Image Processing tools) • Intel Open Computer Vision Library • Microsoft Vision SDL Library • Matlab • Khoros • For more information, see – http://www.cs.unr.edu/~bebis/CS791E – http://www.cs.unr.edu/CRCD/ComputerVision/cv_resources.html