Basics of Image Processing
Basics of Image Processing
Processing
PRESENTED BY
R.SARAVANAN,
RESEARCH SCHOLAR,
D E PA R T M E N T O F I N F O R M AT I O N
T E C H N O L O G Y,
M A D R A S I N S T I T U T E O F T E C H N O L O G Y, A N N A
U N I V E R S I T Y.
Topics
Image Processing Basics
MATLAB Basics and IPT
Image Sensing and Acquisition
Arithmetic and Logic Operation
Geometric Operations
Gray-Level Transformation
Histogram Processing
Neighborhood Processing
MATLAB Basics
Introduction to MATLAB
MATLAB (MATrix LABoratory) is a data analysis, prototyping
and visualization tool with built in support for matrices and matrix
operations, excellent graphics capabilities, and a high level
programming language and development environment.
Working Environment consists of MATLAB Desktop, this
contains Command Window, the Workspace Browser, The Current
Directory Window, The Command History and Figure Windows,
MATLAB Editor used to create and edit the M files and MATLAB help
system includes the Help Browser, Which displays HTML, documents
and contains a number of search and display options.
MATLAB Basics
Cont.,
Data Types
- uint8 ---- 8-Bit unsigned integers (1 byte per element)
- uint16---- 16-Bit unsigned integers (2 bytes per element)
- uint32---- 32-Bit unsigned integers (4 bytes per element)
- int8 ----8-Bit signed integers (1 byte per element)
- int16---- 16-Bit signed integers (2 bytes per element)
- int32---- 32-Bit signed integers (4 bytes per element)
- single---- Single-precision floating numbers (4 bytes per element)
- double--- Double-precision floating numbers (8 bytes per element)
- logical ----Values are 0 (false) or 1 (true) (1 byte per element)
- char ----Characters (2 bytes per element)
MATLAB Basics
Cont.,
Standard Array
- Build in standard arrays:
zeros(m, n) creates an m n matrix of zeros.
ones(m, n) creates an m n matrix of ones.
true(m, n) creates an m n matrix of logical ones.
false(m, n) creates an m n matrix of logical zeros.
eye(n) returns an n n identity matrix.
magic(m) returns a magic square2 of order m.
rand(m, n) creates an m n matrix whose entries are pseudo
random numbers uniformly distributed in the interval [0, 1].
MATLAB Basics
Cont.,
The Image Processing Toolbox(IPT)
The IPT is a collection of function that extend the basic capability
of the MATLAB environment to enable specialized signal and image
processing operation,
- Spatial Transformations
- Neighborhood operation
- Mathematical transforms
- Morphological operations
MATLAB Basics
Cont.,
Essential Function and Features
- Displaying Information About an image File
imfinfo (filename) display the information about graphics file
Reading an Image file
- imread function to open and read the contents of all popular
formats.(e.g: TIFF,JPEG,BMP,GIF, and PNG) and this function allows
to read image files of all type, in virtually ant format, located
anywhere.
- dicomread for DICOM(Digital Imaging and Communication in
Medicine) files, nitfread for NITF(National Imagery Transmission
Format) files, and hdrread for HDR (High Dynamic Range) files
MATLAB Basics
Cont.,
Data Classes and Data Conversions
- The most common data class for images are
uint8: 1 byte per pixel, in the [0,255] range.
double: 8 bytes per pixel, usually in the [0.0, 1.0] range
logical: 1 byte per pixel, its value as true(White) or false (Black)
- To convert an image to data class and range suitable for image
processing.,
MATLAB Basics
Cont.,
Displaying the Contents of an image
- image: Displays an image using the current color map
- imagesc: Scales image data to the full range of the current color map
and display the image.
- imshow: Display an image and contains a number of optimizations
and optional parameters for property settings associated with image
display.
- imtool: Display an image and contains a number of associated tools
that can be used to explore the image content.
Two other IPT functions: impixel returns the red, green and blue color
values of image, imdistline creates the Distance tools thats measure the
distance between its endpoints.,
Image Acquisition
Image Sensors and Optics
- Image sensors: The main goal of an image sensor is to convert EM energy into
electrical signals that can be processed, displayed, and interpreted as image.
- Camera Optics: A camera uses a lens to focus part of the scene onto the image
sensor. Two of the most important parameters of a lens are its magnifying power
and light gathering capacity.
Image Acquisition
Cont.,
Image Digitization
- Involves two processes: Sampling (in time or space) and
quantization (in amplitude). These operation may occurs in any
sequence, but usually sampling precedes quantization.
- Sampling involves selecting a finite number of points within an
interval, whereas quantization implies assigning an finite range of
possible amplitude value to each of those points.
- Sampling is the process of measuring the value of a 2D function at
discrete intervals along the x and y dimensions and the quantization
is the process of replacing a continuously varying function with a
discrete set of quantization levels
- In MATLAB, (Re)-Quantizing an image can be accomplished using
grayslice function.
Example of Quantizing in MATLAB: (a)480 x 640 image, 256 gray level: (b-h) image requantized
to 128, 64, 32, 16, 8, 4 and 2 gray levels
ARITHMETIC OPERATIONS
Cont.,
Addition
- Addition is used to blend the pixel contents from two images or add
a constant value to pixel value of an image. Adding the contents of
two monochrome images causes their contents to blend. Adding a
constant value (scalar) to an image causes an increase in its overall
brightness, a process sometimes referred to as additive image offset
ARITHMETIC OPERATIONS
Cont.,
Subtraction
- Its often used to detect differences between two images. Such differences
may be due to several factors, such as artificial addition to or removal of
relevant contents from the image, relative object motion between two
frames of a video sequence, and many others. Subtracting a constant value
from an image causes a decrease in its overall brightness, a process
sometimes called as a subtractive image offset. (Negative image also possible)
ARITHMETIC OPERATIONS
Cont.,
Multiplication and Division
- Multiplication and division by a scalar
LOGIC OPERATIONS
Logic Operations: Fundamentals
- Logic operations are performed in a bit wise fashion on the binary
contents of each pixel value. The AND, XOR and OR operators required a
two or more arguments, the NOT operator requires only one argument. They
are used to in masking operations, and extract the ROI.
LOGIC OPERATIONS
Logic Operations: In MATLAB
- XOR operation is often used to highlight a difference between the
two images and NOT operation extracts the binary complement of
each pixel value, which is equal to applying the negative effect. In
MATLAB, bitand, bitor, bitxor and bitcmp are in build functions.
AND operation applied to monochrome images: (a) X; (b) Y; (c) X AND
LOGIC OPERATIONS
The XOR operation applied to monochrome images: (a) X; (b) Y; (c) X XOR Y.
GEOMETRIC OPERATIONS
Introduction
- Geometric operations modify the geometry of an image by repositioning
pixels in a constrained way. In other words, rather than changing the pixel
values of an image, they modify the spatial relationships between groups of
pixels representing features or objects of interest within the image
GEOMETRIC OPERATIONS
Using MATLAB,
- Zooming, Shrinking and Resizing
- Translation
- Rotation
- Cropping
- Flipping
Other Geometric Operations,
- Warping
- Nonlinear Image Transformation
- Twirling
- Ripping
- Morphing
- Seam Carving
HISTOGRAM PROCESSING
Image Histogram:
- The histogram of a monochrome image is a graphical
representation of the frequency of occurrence of each gray level in
the image. The data structure that stores the frequency values is a 1D
array of numerical values, h whose individual elements store the
number of image pixels that correspond to each possible gray level.
h(k) = nk = card { (x, y) f (x, y) = k}
Here the k = 0,1,.L-1 where L is the digitized image, and nk
number of elements in the set.
- A Normalized histogram can be mathematically defined as
p(rk ) = nk / n where n is the total number of pixel and result is
probability of k th gray level.
- In Matlab, imhist and plotting function is bar, plot and stem
HISTOGRAM EQUALIZATION
Histogram equalization is a technique by which the gray level
HISTOGRAM EQUALIZATION
- Histogram Stretching technique also known as input cropping
consists of a linear transformation that expands (stretches) part of the
original histogram so that its nonzero intensity range [rmin ,rmax ]
occupies the full dynamic gray scale, [0, L-1].
- Histogram Shrinking technique also known as output cropping
modifies the original histogram in such a way as to compress its
dynamic grayscale range, [rmin ,rmax ], into narrower gray scale,
between smin and smax .
- In Matlab, IPT built in function to perform histogram stretching
and shrinking using imadjust
NEIGHBORHOOD PROCESSING
Steps of neighborhood processing operation. (both linear or nonlinear)
NEIGHBORHOOD PROCESSING
Convolution and Correlation in MATLAB
* conv2: It computes the 2D convolution between two matrices.
full: Returns the full 2D convolution
same: Returns the central part of the convolution of the same size as A.
valid: Returns only the convolution that are computed without the zero
padded edges.
* filter2: It rotates the convolution mask 180degree in each direction to
NEIGHBORHOOD PROCESSING
Image Smoothing (Low Pass Filter)
- Low pass filter those spatial filters whose effect on the output
image is equivalent to attenuating high frequency components.
- In Matlab, Linear filters are implemented by two basic
functions: imfilter and optionally fspecial.
NEIGHBORHOOD PROCESSING
In fspecial is an function created a 2D image filter, syntax is
NEIGHBORHOOD PROCESSING
Image Sharpening (High Pass Filter)
- High Pass filter those spatial filters whose effect on an image is
equivalent to preserving or emphasizing its high-frequency components
(i.e., fine details, points, lines and edges) that is, to highlight transitions
in intensity within the image.
- Linear HPFs can be implemented using 2D convolution masks with
positive and negative coefficients, which correspond to a digital
approximation of the laplacian a simple, isotropic second order
derivative that is capable of responding to intensity transitions in any
direction.
THANK YOU