You are on page 1of 34

R.C.P.I.

T Department Of Electronics & Telecommunication

1. Introduction

In today’s world where digital image processing has emerged as a new technology
which has opened in new horizon for this competition world. So if we can perform the
object identification using digital image processing then we can give a new scope in
various field of technology.

This object identification technique can be used in identifying objects over the
earth by using the image captured by a satellite. This will help the meteorological
department to implement various development plans. Similarly we can implement this
booming technique in biomedical instrument and in military equipment and so on.

We can perform object identification using following technique in digital image


processing such as segmentation, edge detection, thresholding masking template
matching and morphological operation. In our project a desired object of a particular
shape from a group of object is recognized with the help of digital image processing
technique. Here, the shape of the object which we want to recognize will be already
stored in the data base which is referred as an object image. Once the image is recognized
it can be used as a vision of pick and place robot to identify and place the image at its
desired place.

Here we are using a web cam captured an image. The image capture through
webcam will be continuously compared to the part of image (i.e. object) which is already
stored in data base. For identifying the object in the image, we are using an algorithm.
The next technique that we have employed for this project is the Edge Detection. Every
object has got an different shape. This technique helps in identification process where the
object is can be differentiated from other objects.

After the identification of object there is need that object should be shown
differently with others. For this purpose, there is one technique employed, named
Masking. Masking is the process in which a Region of Interest is enhanced.

2. Basic Concept and Literature Survey

Object Identification Using Digital Image Processing Page 1 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

2.1 Basic Concept

Figure 2.1.1 shows the basic components comprising a typical general purpose
system used for digital image processing. The function of each component is discussed
starting with image sensing.

Computer Microcont. Pick and


Matched
place
Image object
AT89C51
processing
(robot)

Specialized Crystal
Image
Processing
hardware

Not Matched
Image
sensors

Problem
Domain

Figure 2.1.1.Block Diagram of the project.

1) Sensing:

Object Identification Using Digital Image Processing Page 2 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

With reference to sensing, two elements are required to acquire digital images.
The first is a physical device that is sensitive to the energy radiated by the object image.
The second, called a digitizer is a device for converting the output of the physical sensing
device into digital form. For instance, in a digital video camera. The digitizer converts
these outputs to digital data.

2) Specialized image processing hardware:

It usually consists of the digitizer, plus hardware that performs primitive


operations, such as an arithmetic logic unit (ALU). This type of hardware sometimes is
called a ‘front-end subsystem’, and its most distinguishing characteristic is speed.

3) Computer:

The computer in an image processing system is a general-purpose computer and


can range from a PC to a supercomputer. In dedicated applications, sometimes specially
designed computers are used to achieve a required level of performance, but the interest
here is on general-purpose image processing systems. In these systems, almost any well-
equipped PC-type machine is suitable for offline image processing tasks. Matlab Software
for image processing consists of specialized modules that perform specific tasks. A well-
designed package also includes the capability for the user to write code that, as a
minimum, utilizes the specialized modules. More sophisticated software packages allow
the integration of those modules and general-purpose software commands from at least
one computer language.

4) Microcontroller AT89C51:

• Four 8 bit input and output port.


• Operating voltage 3.5V to 6V.
• ROM 4kbytes and RAM 128 bytes.
• 2 timer
• 6 interrupt sources.

5) Crystal and reset switch:

Object Identification Using Digital Image Processing Page 3 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

A crystal of 11.0592 MHz and for reset switch

6) Pick and Place Robot:

The designing of pick and place robot includes 2 stepper motor, a DC series motor,
power supply and microcontroller as used earlier. All the motors will be interfaced with
microcontroller which will be programmed to perform the desired actions.

2.2 Literature Survey

The present invention relates generally to the field of computer video image
manipulation, and more particularly to an improved means and method for identifying

Object Identification Using Digital Image Processing Page 4 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

objects of concern within a video image such that identification of the objects can be
maintained even as the objects move within the image.

Manipulation of digitized video images, both still pictures and moving video
presentations, is an important aspect of the present trend toward the introduction of
"multimedia" into many aspects of our lives, as well as in modern aspects of more
traditional endeavors such as, the creation of motion pictures.

A cop ending U.S. Patent Application No. 08/146,964, having an inventor in


common with this present invention, teaches a method for converting a conventional
"moving picture" video into a computer/user interface means. In accomplishing the
method of that previous invention, it is necessary to identify, within the video
presentation, particular objects of concern. Such identification can be quite laborious, and
it was anticipated that methods for transferring some of that labor from the human
operator to the computer might be developed in the future.

This present application is directed to a method and means for automating the
identification of such objects and maintaining such identification through time. Although
the present inventive method is intended to be used in conjunction with the production of
interactive computer interface systems, it is not restricted to such applications.

Accordingly, it is an object of the present invention to provide a method for easily


identifying objects within a digitized moving video image such that the objects can be
tracked by a computer. It is still another object of the present invention to provide a
method for identifying objects within a digitized moving video image which requires a
minimum of operator intervention and labor.

It is yet another object of the present invention to provide a method for identifying
objects within a digitized moving video image which does not require a great deal of
computer power to implement. The present invention is to provide a method for
identifying objects within a digitized moving video image which identifies the objects in
such a manner that a computer can store the identifying criteria using a minimum amount
of data storage resources.

Object Identification Using Digital Image Processing Page 5 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

It is yet another object of the present invention to provide a method for identifying
objects within a digitized moving video image which will allow a computer to easily
follow the object as it moves through the image, without overburdening the computer's
resources.

3. Processing In Matlab

We have used Matlab 7.6 for the implementation of the algorithms as this
allows solving many technical computing problems, those with matrix and vector
formulations, in a fraction of time, it would take to write a program in a scalar no
interactive language such as C or FORTRAN.

Object Identification Using Digital Image Processing Page 6 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

Matlab features a family of application-specific solutions called toolboxes.


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, neural networks,
fuzzy logic, wavelets, simulation, and many others. The following sections describe the
methods implemented in this work.

3.1 Image Processing Operations:

Image processing operation includes the following topics.

3.1.1 Spatial image transformations:

Spatial transformations map pixel locations in an input image to new locations


in an output image. Common image geometric operations, such as resizing,
rotating, or cropping, are all examples of spatial transformations. This topic describes
the spatial transformation functions in the Image Processing.

3.1.1.2 Interpolation:

This topic describes the mechanism used to determine output pixel values in
all transformation operations. Interpolation is the process by which we estimate an
image value at a location in between image pixels. For example, if we resize an image so
it contains more pixels than it did originally, the software obtains values for the additional
pixels through interpolation.

3.1.1.3 Image Resizing:

Image resizing accepts two primary arguments: (1) The image to be resized
and (2) The magnification factor. To enlarge an image, specify a magnification
factor greater than 1. To reduce an image, specify a magnification factor between 0
and 1. By default, image resizing uses nearest neighbor interpolation but, by
specifying a third argument, we can also use either bilinear or bicubic interpolation.

Object Identification Using Digital Image Processing Page 7 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

3.1.1.4 Image Rotation:

Image rotating accepts two primary arguments :(1) The image to be rotated and
(2) The rotation angle. By specifying the rotation angle in positive or negative degrees,
we can rotate the image either in clockwise direction or in counterclockwise
direction, if we specify degree as positive then image will be rotated in clockwise
direction and if degree is negative then image will be rotated in counterclockwise
direction.

3.1.1.5 Image Cropping:

By using image cropping, we can extract a rectangular portion of an image;


image cropping accepts two primary arguments: (1) The image to be cropped and (2)
The coordinates of a rectangle that defines the crop area.

3.1.2 Morphological operations:

Morphology is a technique of image processing based on shapes. The value of


each pixel in the output image is based on a comparison of the corresponding pixel in
the input image with its neighbors. We can construct a morphological operation that is
sensitive to specific shapes in the input image. The Image Processing includes many
morphological functions, such as contrast enhancement, noise removal, thinning,
filling, and segmentation. This topic describes the morphology operations as following:

3.1.2.1 Dilation and Erosion:

Dilation and erosion are two fundamental morphological operations. Dilation adds
pixels to the boundaries of objects in an image, while erosion removes pixels on
object boundaries. The number of pixels added or removed from the objects in an
image depends on the size and shape of the structuring element used to process the
image. Some of the morphological image processing operations are based on
combinations of dilation and erosion.

Object Identification Using Digital Image Processing Page 8 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

3.1.2.2 Morphological Reconstruction:

Morphological reconstruction is another major part of morphological image


processing. Based on dilation, morphological reconstruction has these unique properties:
Processing is based on two images, a marker and a mask, rather than one image and a
structuring element Processing repeats until stability; i.e., the image no longer changes
Processing is based on the concept of connectivity, rather than a structuring element.
The topic describes the functions that are based on morphological reconstruction, for
example, Marker and Mask, Pixel Connectivity, Flood-Fill Operations, Finding Peaks,
Distance Transform, Marker-Controlled Watershed Segmentation and etc.

3.1.3 Neighborhood & block operations:

Certain image processing operations involve processing an image in sections


called blocks, rather than processing the entire image at once. The Image Processing
provides several operations for specific operations that work with blocks. This
concept provides more generic functions for processing an image in blocks. By
supplying information about the size of the blocks, and specifying a separate operation to
use to process the blocks. The block processing operation does the work of breaking
the input image into blocks, calling the specified operation for each block,
and reassembling the results into an output image. Following topics include in
neighborhood and block operation:

3.1.3.1 Sliding neighborhood operation:

It is an operation that is performed a pixel at a time, with the value of any


given pixel in the output image being determined by applying some algorithm to the
values of the corresponding input pixel's neighborhood. A pixel's neighborhood is some
set of pixels, defined by their locations relative to that pixel, which is called the center
pixel. The neighborhood is a rectangular block, and as we move from one element
to the next in an image matrix, the neighborhood block slides in the same direction.

Object Identification Using Digital Image Processing Page 9 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

3.1.3.2 Distinct blocks:

They are rectangular partitions that divide a matrix into m-by-n sections.
Distinct blocks overlay the image matrix starting in the upper-left corner, with no
overlap. If the blocks don't fit exactly over the image, then it is added zero padding so that
they do.

3.1.3.3 Column Processing:

This is the process of sliding neighborhoods or distinct blocks as columns, this


approach is useful for operations that mat lab performs column wise; in many
cases, column processing can reduce the execution time required to process an image.

3.1.4 Linear filtering and filter design:

The Image Processing provides a number of functions for designing and


implementing two- dimensional linear filters for image data. This topic describes these
functions and how to use them effectively. This topic is divided into two parts: The first
part is an explanation of linear filtering and how it is implemented. This topic describes
filtering in terms of the spatial domain, and is accessible to anyone doing image
processing. The second part is a discussion about designing two-dimensional filters.

3.1.5 Image Transforms:

The usual mathematical representation of an image is a function of two spatial


variables: f (x, y). The value of the function at a particular location (x, y) represents the
intensity of the image at that point. The term transform refers to an alternative
mathematical representation of an image. For example, the Fourier transform is a
representation of an image as a sum of complex exponentials of varying magnitudes,
frequencies, and phases. This representation is useful in a broad range of applications,
including image analysis, restoration, and filtering. The discrete cosine transform (DCT)

Object Identification Using Digital Image Processing Page 10 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

also represents an image as a sum of sinusoids of varying magnitudes and frequencies.


The DCT is extremely useful for image compression. The Radon transform represents an
image as a collection of projections along various directions. It is used in areas ranging
from seismology to computer vision.

3.1.6 Image analysis and enhancement:

The Image Processing supports a range of standard image processing operations


for analyzing and enhancing images. Its functions simplify several categories of tasks,
including:

• Obtaining pixel values and statistics, which are numerical summaries of data in an
image: The Image Processing provides several functions that return information
about the data values that make up an image. These functions return information
about image data in various forms.
• Analyzing images to extract information about their essential structure: This topic
describes functions that can use for following image analysis techniques:
• Edge Detection We can use edge detection 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. The
most powerful edge-detection methods that edge provides are the canny and sobel
methods. 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.
• Enhancing images to make certain features easier to see or to reduce noise: This
topic describes specific operations within each category, and shows how to
implement each kind of operation using different functions some what like,
intensity adjustment and noise removal.

3.1.7 Region Based Processing:

This topic describes operations that one can perform on a selected region of an
image. It discusses these topics:

Object Identification Using Digital Image Processing Page 11 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

3.1.7.1 Specifying a Region of Interest:

A region of interest is a portion of an image that we want to filter or perform some


other operation on. We define a region of interest by creating a binary mask, which is a
binary image with the same size as the image we want to process. The mask contains 1's
for all pixels that are part of the region of interest, and 0's everywhere else.

3.1.7.2 Filtering a Region:

Different functions are used to process a region of interest. When we specify an


intensity image, a binary mask, and a filter, then filter filters the input image and returns
an image that consists of filtered values for pixels where the binary mask contains 1’s and
unfiltered values for pixels where the binary mask contains 0's. This type of operation is
called masked filtering.

3.1.7.3 Filling a Region:

We can use the different operations to fill a region of interest, interpolating from
the borders of the region. This function is useful for image editing, including removal of
extraneous details or artifacts.

3.2 Image formats supported by Matlab:

The following image formats are supported by Matlab:

• BMP
• HDF
• JPEG
• PCX
• TIFF
• XWB

Object Identification Using Digital Image Processing Page 12 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

Most images we find on the Internet are JPEG-images which are the name for one
of the most widely used compression standards for images. If we have stored an image we
can usually see from the suffix what format it is stored in. For example, an image named
myimage.jpg is stored in the JPEG format and we will see later on that we can load an
image of this format into Matlab.

3.2.1 Working Formats in Matlab:

If an image is stored as a JPEG-image on disc we first read it into Matlab.


However, in order to start working with an image, for example perform a wavelet
transform on the image, we must convert it into a different format. This section explains
four common formats.

3.2.1.1 Intensity Image (Gray Scale Image):

This is the equivalent to a "gray scale image" and this is the image we will mostly
work with in this course. It represents an image as a matrix where every element has a
value corresponding to how bright/dark the pixel at the corresponding position should be
colored. There are two ways to represent the number that represents the brightness of the
pixel: The double class (or data type). This assigns a floating number ("a number with
decimals") between 0 and 1 to each pixel. The value 0 corresponds to black and the value
1 corresponds to white. The other class is called uint8 which assigns an integer between 0
and 255 to represent the brightness of a pixel. The value 0 corresponds to black and 255
to white. The class uint8 only requires roughly 1/8 of the storage compared to the class
double. On the other hand, many mathematical functions can only be applied to the
double class. We will see later how to convert between double and uint8.

3.2.1.2 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.

3.2.1.3 Indexed Image:

Object Identification Using Digital Image Processing Page 13 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

This is a practical way of representing color images. (In this course we will mostly
work with gray scale images but once we have learned how to work with a gray scale
image we will also know the principle how to work with color images.) An indexed
image stores an image as two matrices. The first matrix has the same size as the image
and one number for each pixel. The second matrix is called the color map and its size may
be different from the image. The numbers in the first matrix is an instruction of what
number to use in the color map matrix.

3.2.1.4 RGB Image:

This is another format for color images. It represents an image with three matrices
of sizes matching the image format. Each matrix corresponds to one of the colors red,
green or blue and gives an instruction of how much of each of these colors a certain pixel
should use.

3.2.1.5 Multiframe Image:

In some applications we want to study a sequence of images. This is very common


in biological and medical imaging where we might study a sequence of slices of a cell.
For these cases, the multiframe format is a convenient way of working with a sequence of
images. In case we choose to work with biological imaging later on in this course, we
may use this format.

3.3 Fundamental Steps in Image Processing:

The steps that are very useful in Digital Image Processing are given below:

3.3.1 Image Acquisition:

In Fig.3.1, (a) is energy source, and (b) is an element of scene, the energy from an
illumination source being reflected from a scene element, but the energy also could be
transmitted through the scene elements.

The first function performed by the imaging system shown in Fig. 3.1(c) is to
collect the incoming energy and focus it into an image plane. If the illumination is light,

Object Identification Using Digital Image Processing Page 14 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

the front end of the imaging system is a lens, which projects the viewed scene onto
the lens focal plane, as Fig.3.1(d) shows. The sensor array, which is coincident with
the focal plane, produces outputs proportional to the integral of the light received at each
sensor. Digital and analog circuitry sweeps these outputs and converts them to a video
signal, which is then digitized by another section of the imaging system. The output is a
digital image, as shown diagrammatically in Fig. 3.1(e).

Figure 3.3.1 Digital image acquisition process.

3.3.2 A Simple Image Formation Model:

Object Identification Using Digital Image Processing Page 15 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

We can denote images by two-dimensional functions of the form f (x, y). The
value or amplitude of f at spatial coordinates (x, y) is a positive scalar quantity whose
physical meaning is determined by the source of the image. When an image is generated
from a physical process, its values are proportional to energy radiated by a physical
source. As a consequence, f (x, y) must be nonzero and finite; that is,

0 < f (x, y) < ∞.

The function f(x, y) may be characterized by two components :(1) the amount of source
illumination incident on the scene being viewed, and (2) the amount of illumination
reflected by the objects in the scene. Appropriately, these are called the illumination and
reflection components and are denoted by i (x, y) and r (x, y), respectively. The two
functions combine as a product to form f(x,y):

f (x, y) = i (x,y) · r (x,y), (Where, 0 < i (x,y) < ∞ and 0 < r (x,y) <1)

Above Equation indicates that reflectance is bounded by 0 (total absorption) and 1


(total reflectance). The nature of i (x, y) is determined by the characteristics of the imaged
objects.

3.3.3 Representing Digital Images:

We use two principal ways to represent digital images. Assume that an image f (x,
y) is sampled so that the resulting digital image has M rows and N columns. The values of
the coordinates (x, y) now become discrete quantities. For notational clarity and
convenience, we shall use integer values for these discrete coordinates. Thus, the values
of the coordinates at the origin are (x, y) = (0,0). The next coordinate values along the
first row of the image are represented as (x, y) = (0, 1). It is important to keep in mind
that the notation (0, 1) is used to signify the second sample along the first row. It does not
mean that these are the actual values of physical coordinates when the image was
sampled.

Object Identification Using Digital Image Processing Page 16 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

4. Implementation

Our project is divided into two as identifying image using DIP and then
picking up the object and placing at its required place.

4.1 Pick and place Robot:

4.1.1PowerSupply: :

Fig4.1.1.1: Power Supply

Object Identification Using Digital Image Processing Page 17 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

A transformer of 12-0-12V is used to supply voltage to the circuit. Four diodes are
connected in bridge configuration. A regulator IC7805 is used to provide 5V output
supply whereas a IC7812 is used to provide a 12V supply.

Fig:4.1.1.2 Power Supply Layout

4.1.2 Interfacing of DC motor with microcontroller:

Object Identification Using Digital Image Processing Page 18 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

Fig.4.1.2.1 Interfacing of DC motor with 8051

The DC motor works for arm movement and lifting the object and placing it at
the destinations. A power supply of 5V is provided to driver IC which boost the
current ratings for motor. The boosted current can therefore be used in driving
the motor. The microcontroller 8051 controls the motion of motor and thereby
clockwise and counterclockwise motion of motor is possible. A optoisolator ICQ74
is used to provide isolation and thereby creating an extra protection
circuit.L293D is a motor driving IC which is used to drive two motors
simultaneously.

Object Identification Using Digital Image Processing Page 19 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

Fig4.1.2.2Interfacing of motor with AT89c51 Layout


Specifications:-

L293D

Fig:4.1.2.3 Pin Diagram Of L293D

Features

Object Identification Using Digital Image Processing Page 20 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

• Wide Supply-Voltage Range: 4.5 V to 36 V


• Separate Input-Logic Supply
• Internal ESD Protection
• Thermal Shutdown
• High-Noise-Immunity Inputs
• Functionally Similar to SGS L293 and SGS L293D
• Output Current 1 A Per Channel (600 mA for L293D)
• Peak Output Current 2 A Per Channel (1.2 A for L293D)
• Output Clamp Diodes for Inductive
• Transient Suppression (L293D) L293 and L293D

b.2) ILD74

Pin Diagram

Fig:4.1.2.3 Pin Diagram Of ILD74

Features of ILD74:-
Peak reverse voltage- 3.0V

Object Identification Using Digital Image Processing Page 21 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

Continuous forward current- 60mA


Power dissipationat 25’C- 100mW
Derate linearity from 25’C- 1.33mW/’C
Collector-Emitter Breakdown Voltage 20 V
Emitter-Base Breakdown Voltage..5 V
Collector-Base Breakdown Voltage 70 V
Power Dissipation at 25°C- 150 mW
Derate Linearly from 25°C-2.0 mW/°C

Microcontroller AT89c51
Pin Diagram of 8051

Features:-

Fig:4.1.2.5 Pin Diagram Of AT89c51 microcontroller

Features:
1. Compatible with MCS-51™ Products
2. 4K Bytes of In-System Reprogrammable Flash Memory

Object Identification Using Digital Image Processing Page 22 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

Endurance: 1,000 Write/Erase Cycles


3. Fully Static Operation: 0 Hz to 24 MHz
4. Three-level Program Memory Lock
5. 128 x 8-bit Internal RAM
6. 32 Programmable I/O Lines
7. Two 16 bit Timer/Counters
8. Six Interrupt Sources
9. Programmable Serial Channel
10. Low-power Idle and Power-down Modes

4.2 Alogrithms:

4.2.1 Image comparison using MATLAB

clc;

clear all;

close all;

r=imread('C:\Users\rupam\Desktop\New Folder\gaurav project\1.jpg');

g1= rgb2gray(r);

edge1=edge(g1,'prewitt');

r1=imread('C:\Users\rupam\Desktop\New Folder\gaurav project\2.jpg');

g2= rgb2gray(r1);

edge2=edge(g2,'prewitt');

I1=imcrop(edge1,[247 154 350 250]);

I2=imcrop(edge2,[258 193 442 360]);

%image acquisation%

Object Identification Using Digital Image Processing Page 23 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

vid = videoinput('winvideo',1);

preview(vid);

I = getsnapshot(vid);

delete(vid);

clear vid;

r3=imread('C:\Users\rupam\Desktop\New Folder\gaurav project\3.jpg');

g3= rgb2gray(r3);

edge3=edge(g3,'prewitt');

I3=imcrop(edge3,[247 154 350 250]);

figure,imshow (I1);

figure,imshow (I2);

figure,imshow (I3);

if I1==I3

disp 'detected';

else disp 'not detected';

end;

%start serial communication

s= serial('com3');

fopen(s)

if I1==I3

Object Identification Using Digital Image Processing Page 24 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

fwrite(s,1,'uint8');

elseif fwrite(s,0,'uint8');

A=fread(s,1,'uint8');

if A==0

fclose(s);

delete(s);

clear(s);

end;

end;

fclose(s);

delete(s);

clear(s);

4.2.2 Algorithm for interfacing DC motor with microcontroller:

org 00h

mov P0,#00h

mov P1,#00h

mov tmod,#20h

mov th1,#-6h

mov scon,#50h

setb tr1

Object Identification Using Digital Image Processing Page 25 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

here:

jnb RI,here

mov a,sbuf

mov P1,a

clr RI

jnb P1.0,here

//motor1 clockwise

setb p0.3

mov R5,#05h

acall delay

cpl P0.3

//motor2 clockwise

setb P0.5

mov R5,#10h

acall delay

cpl P0.5

//motor2 anticlockwise

setb P0.6

mov R5,#10h

Object Identification Using Digital Image Processing Page 26 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

acall delay

cpl P0.6

//motor1 clockwise

setb P0.4

mov R5,#05h

acall delay

cpl P0.4

sjmp here

delay:

h1:mov R2,#100

h2:mov R3,#255

h3:djnz R3,h3

djnz R2,h2

djnz R5,h1

RET

5. Test and Result

5.1 Results of matlab programming

Object Identification Using Digital Image Processing Page 27 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

Fig 5.1.1:Object1(square shape)

Fig 5.1.2.Object2(Triangle shape)

The above figure shows the image of first object.The shape of an object is a square and
we have used a black background to avoid distortion from lights.

Object Identification Using Digital Image Processing Page 28 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

Fig5.1.3.Crop image of object

Fig5.1.4.Crop image of Triangle object

Object Identification Using Digital Image Processing Page 29 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

We have taken the crop image of the object,so that only the specific area would be
selected.After croping the image a filter is used to remove the distortion and a new
cropped image is formed.The crop image is compared with the new image and the
reference object is selected.

5.2 Pick and Place Robot:

Fig5.2.1 Interfacing of DC motor with 8051

A DC motor of 150 rpm and 12V rating is interfaced with microcontroller 8051.The
output of driver LM293D is used to drive the motor. Microcontroller controls the motor
rotation clockwise or anticlockwise.DC motor translates electrical pulses into mechanical
movement. It has positive and negative leads. DC motor moves continuously from
starting position. DC motor also has voltage and current ratings. The nominal voltage is 1
to 150v depending upon motor. As we increase voltage rpm goes up. With a fixed

Object Identification Using Digital Image Processing Page 30 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

voltage, as load increases, current consumption of DC motor is increased. If we overload


the motor it will stall, and that can damage the motor due to heat generated by high
current consumption.

Although 8051 family members come in different packages here dual in line package is
used, this have 40 pins that are dedicated to various functions. It must me provided that
20 pin version is reduced number of I/O ports for less demanding applications. A total of
32 pins are set aside for the four ports P0, P1, P2,P3 where each port take 8 pins. The rest
of pins are designated as Vcc, GND, XTAL1, XTAL2, RST, EA, and ALE.

Object Identification Using Digital Image Processing Page 31 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

6. Future Scope

One of the things to make the algorithm better would be to develop a more
optimal edge detection scheme that leaves thinner edges than the gradient detector used
but also would be more resistant to noise than a Laplacian edge detector. One possibility
would be to implement a multiscale edge detector to solve that problem. Another
improvement would be to find a better thresholding scheme than setting a range that the
number of `edge' pixels has to fall into.

Again, the multiscale edge detector might eliminate the need for much
thresholding. Also in the future, the edge detection results found with some region
growing results done independently in order to optimize the region determination process.
Finally, it would be nice to add a texture/color recognition feature to this algorithm so that
similar yet disjoint regions could be classified as `the same' and assigned the same gray-
level value.

The object identifying pick and place robot can be modified for several other
purposes like explosive detectors, mine detectors etc.

Object Identification Using Digital Image Processing Page 32 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

7. Conclusions

One of the major part of interfacing of motors with microcontroller and part of
Matlab programming to identify and compare the two images is completed. Using
compare module a much larger size images can be compared. For pick and place robot
there will be interfacing of two motors which would follow with slight modifications in
controller programming.

Object Identification Using Digital Image Processing Page 33 of 34


R.C.P.I.T Department Of Electronics & Telecommunication

8. Reference

[1]. Rafael C. Gonzalez and Richard E. woods, “Digital image processing”, Addition
Wesley.

[2]. Anil K. Jain, “Fundamental of Digital Image Processing”, prentice hall of India.

[3]. Gose Earl, Johnson Baugh, R Jost Steve, “Pattern Recognition and Image analysis”,
Prentice Hall of India.

[4]. Mazidi Ali, Janice Mazidi Janice and Rolin .D. Mckinlay, “The 8051 microcontroller
and Embedded systems”.

Object Identification Using Digital Image Processing Page 34 of 34