Digital Image Processing Hongjun Xu August 1, 2007
Digital Image Processing
Hongjun Xu
August 1, 2007
Lecture 1
Introduction and Digital Image Fundamentals
• What is an Image?
Picture, photograph
Visual data
Usually two or three dimensional
What is a digital image?
An image which is “discretized,”, i.e., defined on a discrete grid
Two-dimensional collection of light values (or gray values)
What is digital image processing?
Digital image processing is the study of representation and manipulation of pictorial information by a computer.
Improve pictorial information for better clarity (human interpretation)
Examples:
1 Enhancing the edges of an image to make it appear sharper
2 Remove “noise” from an image
3 Remove motion blur from an image
What is image interpretation?
Assign meaning to an ensemble of recognized objects
Automatic machine processing of scene data (interpretation by a machine/non-human, storage, transmission)
Examples:
1 Obtain the edges of an image
2 Remove detail from an image
Important steps in a typical image processing system
Step 1: Image acquisition
Step 2: Discretization / digitalization; Quantization ; Compression
Step 3: Image enhancement and restoration
Step 4: Image segmentation
Step 5: Feature selection
Capturing visual data by an image sensor
Convert data into discrete form; compress for efficient storage/transmission
Improving image quality (low contrast, blur noise)
Partition image into objects or constituent parts
Extracting pertinent features from an image that are important for differentiating one class of objects from another
Step 6: Image representation
Step 7: Image interpretation
Assigning labels to an object based on information provided by descriptors
Assigning meaning to an ensemble of recognized objects
Image analysis:
Step 4: Image segmentation
Step 5: Feature selection
Step 6: Image representation
Image understanding:
Step 6: Image representation
Step 7: Image interpretation
Image processing:
Step 2: Compression
Step 3: Image enhancement and restoration
Step 4: Image segmentation
Imaging: Step 1: Image acquisition and
Step 2: digitalization; Quantization ; Compression
Image processing and analysis transformations
Level 0: Image representation
Level 1: Image to image transformations
Level 2: Image to parameter transformation
Level 3: Image to decision transformation
Acquisition; sampling; quantization; compression
Enhancement; restoration; segmentation
Feature selection
Recognition and interpretation
Image Acquisition and Sampling
Sampling refers to the process of digitizing a continuous function
For Example: 1
sin( ) sin(3 )3
y x x
Sampling an image requires that we consider the Nyquist criterion, when we consider an image as a continuous function of two variables, we wish to sample it to produce a digital image.
Using light
Light is the predominant energy source for image because it is the energy source which human beings can observe directly.
Many digital images are captured using visible light as the energy source.
For example, photographs are pictorial record of visible scene.
Light spectrum
Types of sensors:
Optical (camera)
Infrared (senses heat changes)
X-ray (CT Scan)
Magnetic (MRI)
Ultrasound (acoustic energy)
Electron Microscopy (Electron beam)
Computer generated images (fractals, animation)
Create an image
To create a digital image, we need to convert the continuously sensed data into digital form.
This involves:
Sampling:
Quantization (bits/pixel)
Digitizing the coordinate values (resolution)
Depends on density of sensor in an array
Limited by optical resolution
Digitizing the amplitude values
Pixel: short for picture element
Image Representation
Spatial Resolution
Sampling determines resolution
Resolution is the smallest discernible detail in an imageCommon unit – 480 x 640 pixels
Need to know size of image also
Quantization
• 1 bit /pixel
• B bits/pixel
Gray: generally integer values, ranging from 0 to some maximum value
–2 possible values–2 gray levels -> 0 or 1 (binary image)
–2B gray levels–1 byte = 8 bits –> 256 levels
Coordinate Convention
Digital Image Representation
)1,1(...)1,1()0,1(
............
)1,1(......)0,1(
)1,0(...)1,0()0,0(
),(
MNfNfNf
Mff
Mfff
yxf
Digital Image Image Elements(Pixels)
Pixel Notation
Reading ImagesMATLAB syntax: imread(‘filename’)Format name Description Recognized Extensions
TIFF Tagged Image File Format .tif, .tiff
JPEG Joint photographic experts group .jpg, .jpeg
GIF Graphics Interchange format .gif
BMP Windows Bitmap .bmp
PNG Portable Network Graphics .png
XWD X Window Dump .xwd
Note: GIF is supported by imread, but not by imwrite.
Applications• BIOLOGICAL: automated systems for analysis of samples.
•DEFENSE/INTELLIGENCE: enhancement and interpretation of images to find and track targets.
•DOCUMENT PROCESSING: scanning, archiving, transmission.
•FACTORY AUTOMATION: visual inspection of products.
•LAW ENFORCEMENT/FORENSICS: fingerprint analysis.
•MATERIALS TESTING: detection and quantification of cracks, impurities, etc.
•MEDICAL: disease detection and monitoring, therapy/surgery planning
•...
Image processing with MATLAB
What is the Image Processing Toolbox?
• The Image Processing Toolbox is a collection of functions that extend the capability of the MATLAB ® 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 (RIO)
>> help images
Data Classes
Double -double precision, range: [-10^308, +10^308]
Uint8 -unsigned 8-bit integer, range:[0,255]
Unit16 -unsigned 16-bit integer, range:[0, 65535]
Unit32 -unsigned 32-bit integer, range:[0, 2^32-1]
Int8 -signed 8-bit integer, range:[-128,127]
Int16 -signed 16-bit integer, range:[-32768,+32767]
Int32
Single -single precision, range:[-10^38,+10^38]
Char -characters
Logical -values are 0 or 1
Converting between Image Classes
Name Convert input to
Im2uint uint8
Im2uint16 uint16
Im2double double
Im2bw logical
Mat2gray double (in range [0,1])
Image types in MATLAB
1. White and black images
2. Grey scale images
3. Colored image
They are also called binary images, containing 1 for white and 0 for black.
They are also called Intensity Images, containing numbers in the range of 0 to 255 or 0 to 1.
They may be represented as RGB Image or Indexed Image.
Indexed images: m-by-3 color map
Most colour images only have a small subset of the more than sixteen million possible colours. So the image has an associated colour map. Each pixel has a value which does not give its colour, but an index to the colour in the map.
RGB images: m-by-n-by-3
If each of these components has a range 0-255, this gives a total 255^3=16777216 different possible colours in the image
Gray-level values can be stored as one of several data types:
All MATLAB operations work on images of type double
>>x=double(x);
DOUBLE Convert to double precision.
Only some MATLAB operations work on intensity or binary images of type uint8
–uint8: 8-bit unsigned integer; range is 0 (black) - 255 (white)
–double: double-precision floating-point number; range is 0.0 - 1.0
–uint16
Binary images
MATLAB code
Intensity Images
RGB images
Indexed Images
MATLAB stores the RGB values of an indexed image as values of type double, with values between 0 and 1.
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
• Imread - read image
Writing Images
imwrite -write images
Basic syntax: imwrite (f,’filename’)
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