Image Processing
Image Processing
Language
VHDL
C/C++
Image processing using MATLAB
MATLAB
The name MATLAB stands for matrix laboratory . It
is a high-performance language for technical
computing. It is an interactive system whose basic
data element is an array which does not require any
dimensioning. This allows us to solve many
technical computing problems, especially those with
matrix and vector formulations, in a fraction of the
time.
MATLAB features a family of add-on application-
specific solutions called toolboxes. These toolboxes
are comprehensive collections of matlab functions
(M-files) that extend the matlab environment to
solve particular classes of problems. Areas in which
toolboxes are available include image processing,
signal processing, control systems, neural networks,
fuzzy logic, wavelets, simulation, and many others..
Image Processing Toolbox
Image processing toolbox
The Image Processing Toolbox is a collection of
functions that extend the capability of the Matlab
numeric computing environment. These functions
are written on M-files and further we can extend the
capabilities of the Image Processing Toolbox by
writing our own M-files. This toolbox supports a
wide range of image processing operations such as..
Operations of image processing
images.
Image segmentation.
Neighborhood and block operations.
Linear filtering and filter design.
Transforms.
High dynamic range imaging by combining multiple
images.
Deblurring.
Image formats supported by Matlab
The following image formats are supported by
Matlab:
BMP
HDF
JPEG
PCX
TIFF
XWB
Types of images
Intensity image
This is the equivalent to a "gray scale image“ . It
represents an image as a matrix where every
element has a value corresponding to how
bright/dark (each element represent intensities).
Binary image
This image format also stores an image as a matrix
but can only color a pixel black or white (and nothing
in between). It assigns a 0 for black and a 1 for white.
Indexed image
After
Before
Imadjust( ): This command is used to adjust the
contrast of the image. Imadjust increases the
contrast of the image by saturating 1% of the data at
both low and high intensities of Image and by
stretching the intensity.
Syntax
Imadjust(‘image_name.format’)
Examples of imadjust
Adapthisteq( ): This command is used to perform
contrast-limited adaptive histogram equalization
(CLAHE). It is an alternative to function histeq,
While histeq works on the entire image, adapthisteq
operates on small regions in the image, called tiles.
Syntax
adapthisteq(‘Image_name.format’);
Before After
Commands used for various file operations
in image processing toolbox.
Imread( ): This command is used to read that image on
which the operation has to be done. Imread returns the
image data in the array. If the file contains a grayscale
image, then it will return a two-dimensional (M-by-N)
array and if the file contains a color image, it will return a
three-dimensional (M-by-N-by-3) array. The class of the
returned array depends on the data type used by the file
format.
Syntax
Imread(‘image_name.format’)
Imview( ): This command is used to view the image
on the screen. And this command is always used
with the imread and imwrite command, because, it
views only that image which is under process.
Syntax
Imview(‘image_name.format’)
Result of above explained commands.
Imwrite( , ): This command is used to change the
format of read file. By using this command we can
change the file formats from one to another.
Syntax
Imwrite(‘image_name.format2’, ‘image_name.format1’)
After
Before
Before After
Im2bw = This command is used to convert the given
image in to binary image. This command is mainly
followed by one another command i.e.
level=graythresh(image_name.format).
Syntax
Level=graythresh(‘image_name.format’)
Bw=im2bw(‘image_name.format’, level)
Before After
Duller = This command is used to fade the image, so that,
other image on which it is overlapped can be easily
viewed.
Syntax 0.5
Duller= * ‘image_name.format’
gray2ind( )
Gray Indexed
indexed
format to intensity format.
ind2gray()
Indexed Gray
RGBformat to intensity format.
rgb2gray( )
RGB Gray
RGB format to indexed format. rgb2ind( )
RGB Indexed
IMAGE ANALYSIS
EdgeDetection
Boundary Tracing
Quadtree Decomposition
Edge Detection
We can use the edge function to detect edges, which
are those places in an image that correspond to
object boundaries. To find edges, this function looks
for places in the image where the intensity changes
rapidly. Edge takes an intensity image I as its input,
and returns a binary image BW of the same size as I,
with 1's where the function finds edges in I and 0's
elsewhere.
Canny Method
The most powerful edge-detection method that edge
provides is the Canny method. The Canny method differs
from the other edge-detection methods in that it uses two
different thresholds (to detect strong and weak edges), and
includes the weak edges in the output only if they are
connected to strong edges. This method is therefore less
likely than the others to be fooled by noise, and more likely to
detect true weak edges.
Syntax
Edge (‘image_name.fomat’,'canny');
Before After
Boundary Tracing
Bwtraceboundary
Bwboundaries
Bwtraceboundary
Syntax
binary_image _filled = imfill(binary_image,'holes');
boundaries = bwboundaries(binary_image _filled);
Example of above explained
commands
Quadtree Decomposition
Quadtree decomposition is an analysis technique that
involves subdividing an image into blocks that are more
homogeneous than the image itself. This technique
reveals information about the structure of the image.
Syntax
qtdecomp(‘Image_name.format’,threshold);
Before After
Noise Removal
Digital images are prone to a variety of types of noise. There
are several ways that noise can be introduced into an image,
depending on how the image is created. For example:
If the image is scanned from a photograph made on film, the
film grain is a source of noise. Noise can also be the result of
damage to the film, or be introduced by the scanner itself.
If the image is acquired directly in a digital format, the
mechanism for gathering the data (such as a CCD detector)
can introduce noise.Electronic transmission of image data
can introduce noise.
The Image Processing toolbox provides a number of different
ways to remove or reduce noise in an image. Different
methods are better for different kinds of noise. The method
which is used mostly to remove noise is Filtering.
Filtering
Filtering is a technique for modifying or enhancing an
image. It is a neighborhood operation, in which the value
of any given pixel in the output image is determined by
applying some algorithm to the values of the pixels in the
neighborhood of the corresponding input pixel. A pixel's
neighborhood is some set of pixels, defined by their
locations relative to that pixel. Filtering is further
categories as following:
Linear Filtering
Median Filtering
Adaptive Filtering
Image Histogram
Syntax
Imhist(‘Image_name.format’);
Histogram of a given image
Project: fingerprint
Recognition
Project: Fingerprint Recognition
FINGERPRINT RECOGNITION or FINGERPRINT
AUTHENTICATION refers to the automated method
of verifying a match between two human
fingerprints. Fingerprints are one of many forms of
biometrics used to identify an individual and verify
their identity.
Fingerprint Recognition touches on two major
classes of algorithms, one is based upon PATTERNS
and other one is based upon MINUTIA.
Patterns of Fingerprints
The basic patterns of fingerprint ridges includes :-
Arch pattern: An arch is a pattern where the ridges enter
from one side of the finger, rise in the center forming an
arc, and then exit the other side of the finger as shown in
following figure..
Loop Pattern: It is a pattern where the ridges enter
from one side of a finger, form a curve, and tend to
exit from the same side they enter as shown in the
following figure..
Whirl Pattern: It is completely different from others.
In this ridges form circularly around a central point
on the finger as shown in the following figure..
Minutia Features
The major Minutia features of fingerprint ridges
includes :
Ridge Ending: The ridge ending is the point at which
)
ot
r D
(o
ge
Rid
r t
o
Sh
Methods of Fingerprint Recognition
Overlappingor Combining.
Comparing slopes of ridges.
Other methods.
Overlapping or Combining Method
Overlapping or Combining Method
i=imread('fp1.bmp');
imview(i);
level=graythresh(i);
bw=im2bw(i,level);
imview(bw);
imview(~bw);
imshow(bw,[1 0 0 ; 0 0 1]);
Result of the above used commands
i2=imread('fp2.bmp');
imview(i2);
level=graythresh(i);
bw2=im2bw(i2,level);
imview(bw2);
imview(~bw2);
imshow(bw2,[1 0 0 ; 0 0 1]);
Result of the above used commands
duller= bw2 * 0.5;
imview(duller);
combine=bw+duller;
imview(combine);
Result
authentication.
It is less time consuming method.
fingerprints.
Disadvantages
It does not give us accurate result everytime
dimensions.
Comparing slopes of ridges
Comparing slopes of ridges
RGB = imread('fingerprint.bmp');
imshow(RGB);
imview(RGB);
Original
image
Step 2: Extract The Region Of Interest
start_row = 73;
start_col = 105;
cropRGB = RGB(start_row:134, start_col:233, :);
figure, imshow(cropRGB);
imview(RGB);
offsetX = start_col-1;
offsetY = start_row-1;
Cropped image
Step 3: Threshold The Image
I = rgb2gray(cropRGB);
threshold = graythresh(I);
BW = im2bw(I,threshold);
BW = ~BW; Binary image
Figure, imshow(BW);
i2=edge(BW, 'canny');
figure, imshow(i2); Canny image
imview(i2);
Step 4: Find Initial Point On Each Boundary
dim = size(i2);
col1 = 40;
row1 = min(find(i2(:,col1)));
row2 = 30;
col2 = min(find(i2(row2,:)));
Step 5: Trace The Boundaries
Marked image
imview(RGB);
plot(offsetX+boundary1(:,2),offsetY+boundary1(:,1),'g','LineWidth',2);
plot(offsetX+boundary2(:,2),offsetY+boundary2(:,1),'g','LineWidth',2);
Step 6: Fit Lines To The Boundaries
vect1 = [1 ab1(1)];
vect2 = [1 ab2(1)];
dp = dot(vect1, vect2);
length1 = sqrt(sum(vect1.^2));
length2 = sqrt(sum(vect2.^2));
angle = 180-acos(dp/(length1*length2))*180/pi
Result of all used command in program
Result
Angle between the marked ridges of image is
142.0786 .
Advantages
This one is more accurate than the overlapping
method because it is based upon minutia.
It is an interactive method for recognizing
fingerprints.
Disadvantages
Itis more time consuming as compared to the
former.
More complex program.