PRAGRAMATIC WAY OF IMAGE PROCESSING FOR THE QUARANTINE OFDEFUNCT CHICKEN IN THE POULTRY

ranchocucamongabrrrAI and Robotics

Nov 6, 2013 (3 years and 5 months ago)

67 views

PRAGRAMATIC WAY OF IMAGE
PROCESSING FOR THE QUARANTINE OF

DEFUNCT CHICKEN IN THE POULTRY



P.Prasanna
1
, M.Sabarish
2

3rd Year BE
-
CSE, Periyar maniammai university

1
prasanna.cse.pmu@gmail.com,
2
sabarishcse01@gmail.com


Abstract

Our paper tries to completely
automate the poultry process by
continuously monitoring the chickens in
the poultry and by the application of
image processing, identify the dead
chicken using a camera
and inform the
appropriate person so that the dead
chicken can be removed from the
corresponding cabin. The chickens will
be monitored in each cabin with a
regular time interval. In the initial
phase the background image of the
cabin is stored as the refer
ence and
after say 15 minutes another image is
taken and stored. The difference image
is calculated for each image by the
application of image subtraction. For
this we employ any of the following two
algorithms:

1.
Two dimensio
nal cross correlation
algorith
m


2.S
um of absolute difference (SAD)
algorithm



If there is a constant variation in
the sum of pixels calculated even after 2
or 3 comparisons, then the particular
cabin is said to contain a dead chicken.


Consideri
ng this practical
problem a solution using digital image
processing is suggested. A system is
developed such that the sick or the dead
chicken is identified by an image
processing system. The image
processing tool box and image
acquisition toolbox of MATLA
B 7.0 are
used to check
motion detection in the
poultry.
A paper was designed and
developed to identify the dead chicken
in the poultry using a webcam, which
will be connected to the Universal Serial
Bus (USB).

Keywords
-

Two dimensional cross
correlation al
gorithm
,Sum of absolute
difference(SAD) algorithm

1. INTRODUCTION TO DIGITAL
IMAGE PROCESSING



Digital image processing remains
a challenging domain of programming for
several reasons .First the issue of digital
image processing appeared relatively late
in the computer history. Secondly, digital
image processing requires the most careful
optimiza
tions and especially for real time
applications. Finally, digital image
processing is by definition, a two
dimensional domain.



The original and basic way of
representing a digital colored image in
computers is obviously a bitmap. A bit
map is
constituted of rows of pixels ,
contraction of the words ‘ Picture
Element’ . Each pixel has a particular
value which determines the appearing
color. This value is qualified by three
numbers giving the decomposition of the
color in the three primary color
s RED,
GREEN, BLUE. Any color visible to the
human can be represented this way. There
are about 16.8 million colors can be
formed by using this RGB combination
(256*256*256).

This large number of
colors cannot be processed by the devices
which are availabl
e. So we are needed to
make these colors into gray format which
has only two values.

A. Gray Image Scale


There are two common conventions in
use for representing the position of a pixel
in a
n image. Usually the ordinary
Cartesian coordinate system is used. In
this system, g(x, y) is the gray level at the
pixel (x, y).Images can alternatively
represented as ordinary matrices in which
the gray level at the pixel (i, j) is
represented as g (i, j
).Image processing
Operations can be roughly divide into
three main categories:



B
.Image Compression

Reducing

the amount of memory
needed to
store a digital
image.

C.
Im
age Enhancement and
restoration

Image defects due to digitization
process or by faults in the imaging (for
example: bad lighting) can be corrected.

D.Measurement Extraction



To obtain useful information from
the compressed and enhanced images.

2. INTORUCTION TO
IMAGE
PROCESSING MATLAB 7.0



The image processing toolbox is
a collection of functions that extend the
capability of the MATLAB numeric
computing environment. MATLAB stores
most images as 2
-
D arrays (i.e., is in the
form of matrices), in which each elem
ent
corresponds to a single pixel in the
displayed
image. There

are 4 basic types
of images in image processing toolbox.

A. Intensity image



This is equivalent to a
‘gray scale
image’
. It represents an image as a matrix
where every element has a value
corresponding to how bright/dark the pixel
at the corresponding position is colored.

B.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 assi
gns 1 for white and 0 for
black
.

C.Indexed image

This is a practical way of
representing 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.

D.RGB image



This is a format for color images. It
represents an image with three matrices of
sizes matching and image format. Each
matrix corresponds to one of the colors
red, green or blue.

E.
Multiframe image




In some applications there is
necessity to study a sequence of
images.
This

is very common in biological and
medical imaging where a sequence of
images. This is very common in biological
and medical imaging where a sequence of
slices of cells is studied
.

F.Image acquisition toolbox

The

image acquisition toolbox is a
collection of functions that extend the
capability of the MATLAB numeric
computing environment. The toolbox
supports a wide range of image acquisition
operations, including



Acquiring images t
hrough
professional grade frame grabbers
to USB
-
based webcams.



Preview of live video feed.



Triggering acquisitions



Bringing the image data into the
MATLAB workspace.

3. MOTION

DETECTIO
N AND
ISOLATION OF DEAD CHICKEN



The block diagram shows the steps
involved in motion detection and isolation
of dead chicken
.
The first step will be the
acquisition of the image through the
webcam connected via USB port. The
resolution of the webcam is 320*240
pixels. The frame rate is 30 fps.


Using the image acquisitio
n toolbox
present in the MATLAB 7.0, input images
are obtained with the specified time
interval. The acquired image is then stored
in the specified location. The image that is
acquired through the camera is pre
-
processed to remove blur present in the
image
.

Then two different motion
detection algorithms are applied to track
any motion. 2
-
D cross correlation and sum
of absolute difference are the two
algorithms used for motion detection and
tracking. Then by using image subtraction
tech
nique, the dead chicken is isolated.










Image acquisition

Image storage

Image pre
-

processing

Motion detection

1.2
-
D cross correlation

2. Sum of absolute

difference

3. Image Subtraction

Isolation of dead chicken

A. Image Preprocessing

Image
pre
-
processing refers to
attenuation, or sharpening, of image
features such as edges, boundaries, or
contrasts to make a graphic display and
analysis. The enhancement process does
not increase the inheritance information
content in the data. The best way t
o avoid
pre
-
processing is to concentrate on high
quality image acquisition. Nevertheless
pre
-
processing is very useful in a variety
of situations since it helps to suppress
information that is not relevant to the
specific image processing and analysis.

B.C
onversion to gray scale


All image processing operations
are carried on the gray scale image. So the
RGB image obtained from the webcam is
converted is converted into gray scale by
using the function rgb2gray ();An intensity
image, also
known

as a grayscale image, is
adapt matrix I whose values represent
B.

G
reeting

M
enu

Intensities

within some
range. MATLAB stores an intensity image
as an individual matrix, with each element
of the matrix corresponding to one image
pixel. The matrix can be of

class unit8,
unit16, int16, single or double. While
intensity images are rarely saved with a
color map
, MATLAB uses a
color map

to
display
them. For

a matrix of class single
or double, using the default gray scale
color map
, the intensity 0 represents bla
ck
and the intensity 1 represents white.

C.Histogram equalization


The toolbox provides a
several ways to improve the contrast in an
image. One way is to call the
histeq

function to spread the intensity values over
the full range of the image, a process
called histogram equalization.

D.Intensity adjustments

The intensity of an image can be
adjusted by using
imadjust

function, where
the range of intensity values is specif
ied in
the output image.

4. MOTION DETECTION AND
TRACKING


The aim of motion is to detect in a
streaming video source, which will
consider as a very rapid succession of
bitmaps, the presence of moving objects
and to be able to track their positi
on. Lot
of questions we will have to be answered
before making the choices for the
algorithm used.

1. Are

you going to have a static
background?

2. Is

the camera going to move around?

3. Do

you want to spot exclusively living
entities?

4. Do

you know in ad
vance the object
which going to move in the camera’s
field?

There are 2 types of motion detection:

1. Static

background motion detection

2. Dynamic

background motion detection

A. Static

background motion detection


Let us suppose a video camera is
facing a static background, the static
image of this background, say when no
object is in the field of the camera, is
stored in a bitmap. The idea is very
simple. When surveillance is turned on,
for each frame
received the software
compares each pixel of the frame with
those of the static background image.


If a pixel is different it is marked
as white, if not it is left black. The
difference between these two pixels can be
calculated by calculating t
he distance
between them with comparing it to a
threshold value.


Here, in this method the object
motion can be determined by the presence
of white pixels in the compared image. If
white pixel is less than certain number of
pixels (say<K), it ca
n be considered as
noise. If it is greater than K, the object is
said to be in motion.

B.Dynamic motion detection



The case of unknown background
motion detection is pretty similar to the
previous situation. This becomes useful
when the backgroun
d of the camera’s field
cannot be predicted and therefore cannot
apply the previous algorithm. Here the
camera doesn’t actually move, nor does it
use a background reference like just
before.


Instead of comparing each received
frame to a referen
ce static background, the
frames that are received together are
compared. This technique is known as
frame differentiating.


This is how the algorithm works on
a streaming source of frames coming from
video camera. The received frame is stored
i
n bitmap A, wait for the next n frames to
pass
without doing

anything ,capture the
n+1 frame, compare it to A, store n+1
frame in A, wait for n frames to pass ,
capture the 2n+2 frame , compare to A
,store in A, and soon.


When the 2 frames are
compared
together, the same method can be used as
in static background, if a pixel changes a
lot of color from one frame to another, it
will be as white, else leave it in black.
Then the resulting image is passed through
an aliasing filter and finally the
moving
objects are spotted.

5. SOFTWARE IMPLEMENTATION


These shows

the main software
design and implementation issues. It stars
by describing the general flow chart of the
main program that was implemented in
MATLAB .It explains each comp
onent of
the flow chart with some details. Finally it
shows how the graphical user interface
(GUI) was
designed.














Setup &
initializations

What is
flag
value?

Image
acquisition

Motion
detection
algorithm

Is
image>thr
eshold?

Actions on
motion
detection

Break &
clear

Data record

Stop

Start

A. Main

program flow chart


The main task of the software was
to read the still images recorded from the
camera and then process these images to
detect motions
and take necessary actions
accordingly.

It starts with general initialization
of software parameters and objects setup.
Then, once the program started, the flag
value which indicates whether the stop
button was pressed or not is checked. If
the stop button

was

not pressed it start
reading the images then process them
using one of the two algorithms as the
operator was selected. If a motion is
detected it starts a series of actions and
then it go back to read the next images.
Whenever the stop button is pr
essed the
flag value will be set to zero and the
program is stopped, memory is cleared and
necessary results are recorded.

This terminates the program and
returns the control for the operator to
collect the results. The next section
explains each process o
f the flow chart
with some details.

6. MOTION

DETECTION ALGORITHM

A. Image acquisition

After setup stage the image
acquisition starts. This process reads
images from the PC camera and save them
in a format suitable for the motion
detection algorithm.

A motion detection
algorithm was applied on the previously
read images. There were 2 approaches to
implement motion detection algorithm.
The first was by using the 2
-
D cross
correlation while the second one was by
using the sum of absolute difference
a
lgorithm.


Fig.2 (Image acquisition flow chart)

B. 2
-
D cross correlation

First the 2 images were sub divided
into 4 equal parts each. This was done to
increase the sensitivity of calculation
where it is easier to notice the difference
between parts of image rather than a whole
one. A two dimensional cross correlation
was calcul
ated between each sub image
with its corresponding part in the other
image. This process produces four values
ranging from
-
1 to 1depending on the
difference of the correlated images.
Because the goal of this division was to
achieve more sensitivity the ma
ximum
value of correlation will be used as
reference to the threshold.

Convert to gray
scale

Read second frame

Convert to gray
scale

Stop

Read first frame

Start

In norm
al cases, motion can easily
be detected

when the measured minimum
cross correlation value is used to set the
threshold. However, detection fails when
images contain global vari
ations such as
illumination changes or when camera
moves.

c. Sum of absolute Difference (SAD)
algorithm

This algorithm is based on image
differencing techniques. It is
mathematically represented using the
following equation:

D (t) = 1/N
|I(t
i
)


I(t
j
)|



where N is the no. of pixels in the
image used as scaling factor

I(t
i
) is the image I at time i

I(t
j
) is the image I at time
j



D(t) is the normalized sum of
absolute difference for that time. In an
ideal case when there is no motion I(t
i
)
= I(t
j
) and D (t)=0.

By this algorithm the difference between
the two images can be found and it can be
used for the isolation of
chicken
.

7. ISOLATION OF DEAD CHICKEN

In this stage the following steps are
followed to isolate the dead chicken:



Capture the image
.



Convert the RGB image to the gray
scale image
.



The first image is kept as the
background image
.



The subsequent images are
s
ubtracted from the background
image
.



All the pixels are added using the
sum function and stored in a single
array
.



Then normalize this value
.



All the subtracted images are again
subtracted and stored in a different
variable
.



Now again the pixels are added
using the sum function and stored
in a single array
.



It is then normalized
.



The resulting value is always
consistent for more than 5
comparisons then the chicken is
said to dead in the particular cabin.



Otherwise “
no dead chicken

found
.













8.
CONCLUSION

Poultry Business is a major
contributor to the Indian economy. With
more and more people heading into
poultry business, there is automation in
this sector. With already feeding
mechanisms and collection of eggs inside
the cabin having been in au
tomated, the
poultry is trying to complete the poultry
process. The major concern with the
poultry is the menace of disease that is
often affecting the chickens. The problem
is that, the disease quickly spreads among
the chickens and affects others. Search
ing
the dead chicken is tedious, as there is
chicken population about a lakh or even
millions. Also as it is done manually, it is
a time consuming process.
We think our

paper will fulfill the needy when
implemented.

9. References

1.
www.igp.ethz.ch/photogra
mmetry/.../
ma

lab
_
imageprocessing


2.
www.getreuer.info/tutorials/
matlab
imaging


3.www.pjbs.org/ijps


4.www.math.ufl.edu/help/
matlab
-
tutorial/


5.ieeexplore.ieee.org/xpl/RecentIssue.jsp