Sunteți pe pagina 1din 25

Determination of Fertility State in Swine Through

Vulva Observation Using Digital Image Processing

by

Marimar L. Auditor
Chaos Jeremy C. Pichay
Rinna Andrea B. Roxas
Don Albert U. Tejada

A Thesis Proposal Report Submitted to the School of EECE


in Partial Fulfilment of the Requirements for the Degree

Bachelor of Science in Electronics Engineering

Mapa Institute of Technology


January 2016
Chapter 1
INTRODUCTION
In the industry of handling farm animals, specifically swine, one of the biggest problems
that lead to big revenue losses is the uncertainty of determining the fertility cycle of the pigs.
Estrus in pigs is the time when a farm owner should consider encouraging mating among the
herd because this period holds a comparatively higher possibility of insemination. Nowadays, a
sows fertility is tested through physical assessment wherein the pigs estrous discharge and
behavioral changes are closely monitored. However, newcomers in the swine industry cannot
effectively distinguish physical and behavioral changes that suggests the onset of pigs fertility

cycle. Furthermore, existing electronic methods in this nature proves to be expensive for pig
owners to own and maintain.
Digital image processing proves to be the avenue for answers to the problems of different
industries nowadays. Its applications, particularly color comparison and pattern recognition, are
highly used in matters regarding effective monitoring and surveillance. Characteristics of a
certain image such as hue, saturation, intensity, and resolution are taken into consideration in
contrast to a number of reference images. It will then be synthesized further to have its aspects
noted and compared for similarities and differences. Certain inferences can be singled out into
suggested truths regarding the made observations.
It is undeniable that uncertainty in sows fertility cycle presents heavy revenue losses as
well as waste in productivity and time. The margin for error found in mere physical observation
and the luxurious price of ultrasound equipment do not help in maximizing the return profit of
the pig business. In hope of finding a viable alternative for these methods, this paper supports the
use of a pictorial scan of a sows vulva to determine its fertile period through digital image
processing. Since a pig in fertile state shows a noticeable swelling accompanied with redness of
her vulva, its comparison to the wide selection of vulvas will help in determining its progress
into estrus state. The implementation of this project also eliminates the use of expensive medical
tests.
The intention of this research is to create a vulva analyzer using image comparing system
capable of identifying the key differences in vulva swell of fertile and infertile pigs. More
specifically, this research aims to: (1) design a vulva analyzer which is capable of capturing and
processing vulva swell and redness parameters based on an image database (2) perform

calibrations to the implemented algorithms (3) identify what the monitored vulva swell and
redness suggests after being processed by the system.
This study would be significant for individuals who are new in the pig industry. Using
image processing, they can accurately assess and determine pigs fertility without involving
extensive and expensive examinations. Also, this would help in the elimination of other expenses
such as frequent consultation with experts and veterinarians.
The proposed project relies greatly on the physical observations depicted in the pictorial
scan that may be subjected to some irregularities such as illness-induced swelling and mild
discoloration. These will prevent an entirely accurate reading that cascades into an erroneous
output. Also, this device does not cater to pigs that do not exhibit vulva swell and redness prior to
estrus. These are often referred to as Silent Heaters. Furthermore, the image database will only
include vulva images of swine. This suggests that the project does not extend to other gestating
farm animals as well as any other breed of swine except for Large White pigs.

Chapter II
REVIEW OF RELATED LITERATURE

This chapter deals with the review and analysis that are pertinent to the study. Related
literatures are given below, that will give a broader knowledge and more background about
determining the fertility state of swine through digital image processing.

Large White
Large Whites are the particular breed of swine commonly found in Philippine farms.
These pigs are usually described with rather quaint bearing, erect ears, somewhat concave facial
structures, pinkish white complexion, long deep sides, and large physical statures. From the
breeds first introduction into the industry, it is prized mainly on its capability to produce bacon.

Fig 2.1 Large White Pig


This type of swine is considered to be a sturdy breed that can adapt to changes in
temperature and environment. In relation to their huge builds, they usually rear relatively large
litters, produce heavy lactation, and exhibit notable maternal qualities. Aside from being lean and
active, their hind parts are usually observed to be in good condition. They maneuver through
their surroundings with relative ease despite their sizes. Their extra height, or length of leg, helps
them to remain active and have long useful lives in the breeding pen [1].

Estrous Cycle
An estrous cycle is the reproductive cycle that usually manifests in female mammals for a
certain period of time. With regards to swine, it occurs within a span of averages 21 days but can
also range from 17 to 25 days. The first day of standing heat records the females initial
receptiveness to the male and its tendency to remain steady when mounted. This stage of estrus is
referred to as day 0. The cycles progression of two or three days indicates that the female is
sexually receptive [2].
The management and understanding of the reproductive cycle in swine is vital since
estrus is often referred to starting point of herd generation. Behavioral estrus lasts 2-3 days, and
ovulation occurs near the end of behavioral estrus. The knowledge on the occurrence of estrus
and its detection further extends to the decision of inseminating the prospectively fertile female
pig 12-26 hours after initial signs of standing heat. This is for the purpose of depositing hog
sperm cells before ovulation that ensures a high rate of conception and low repeat breeders [3].

Vulva
In swine breeding, one of the most closely observed parts of swine are their vulva prior to
the start of the estrous cycle. The vulva is the external portion of the reproductive tract. It often
becomes red from its normal pinkish white color and noticeably swollen at the onset of standing
heat. This swelling is usually more pronounced in gilts than in sows [4]. A gilt is a female swine
not having farrowed yet. On the other hand, a sow has farrowed off-springs and consequently

experienced estrus for a number of times already. With this comparison, the repetition of giving
birth is determined to be reducing the swelling of the vulva.

Hue, Saturation and Intensity


Hue, Saturation and Intensity is the measure of the RGB components in an image. To be
more accurate they are the reference color in a pixel. Hue represents the most visible color which
in turn poses the greatest wavelength energy in the visible light spectrum.
On the other hand saturation refers to the intensity of the color whether it is at 100%
saturation or at 0%. The higher the percentage the more vivid the color appears to the eye. This
would be considered as a pure color. Depending on their RGB values, a color could appear too
bright or dark or produce different variety of colors.
Color Saturation may sometimes be misleading depending on what hue/color it is next to.
A 50% color saturation seated to a 25% saturated color may appear more vivid than a 75%
saturation.

Canny Edge Algorithm


Developed by John F. Canny, this popular edge detection algorithm consists of multiple
stages, namely: 1. Noise Reduction, 2. Finding Intensity Gradient of the Image, 3. Nonmaximum suppression, and 4. Hysteresis Thresholding. Noise Reduction deals with the
elimination of noise in the image through the use of a 5x5 Gaussian filter. The image is then

filtered using a Sobel kernel horizontally and vertically to get the corresponding derivatives.
After deriving the gradient magnitude and direction, removing unwanted pixels that stray from
the needed edge from the images full scan. This is achieved when every pixel is checked if it
resides as a local maximum in its surroundings in the gradients direction. Once the image is
checked if it is a local maximum or not, the output will then reveal a binary image with thin
edges. To further tune out the unneeded edges, the minVal and maxVal threshold values are
established. This convention identifies those above the maxVal point to be retained while those
below the minVal are discarded. However, if the said pixels were connected to a true edge, then
they are also considered a part of the edges.

FM Transformation
The Fourier-Mellin (FM) transformation is an image registration technique which allows
translation, rotation, and scaling of coordinate values of an image for a more precise image
matching. It considers an input of image outline from the output of a Canny Edge detector, using
the concept of overlapping images and similarity ratio.

MatLab
MatLab is the high-level language and interactive environment used by millions of
engineers and scientists worldwide. It lets you explore and visualize ideas and collaborate across

disciplines including signal and image processing, communications, control systems, and
computational finance.
With that being said, MatLab will be incorporated with the raspberry pi, to process the
snapped image from the device.

Chapter 3
METHODOLOGY

I. HARDWARE DESIGN AND DEVELOPMENT


The system contains two major systems: one is for image acquisition and processing for the
fertility state. The hardware and software that will be used in order to achieve this is enumerated
as follows:
a. Image Processing Library MATLAB
The image processing part of the project uses MATLAB version 6.0 (R12)
software. The implementation of GUI in MATLAB for all the algorithms used regarding
color segmentation and image matching allows registration of an image with comparison
to a reference image. An additional product requirement of an image processing toolbox
must be acquired for the necessary commands to be present.
b. Processing Platform Laptop installed with MATLAB
For MATLAB version 6.0 to function properly, the minimum operating system
requirement for the laptop is Windows 7.

c. Imaging Device Smartphone Camera


Smartphone cameras with at least 3 megapixel resolution should be used for an
accurate image matching. The smartphone should also have a flash for lighting
compensation.

II. CONCEPTUAL DIAGRAM


Fertility State Detector of Gilts
Image Acquisition
INPUT

Canny Edge
Image of Vulva
Detector

PROCESS
Image Retrieval
Via USB cable

Front View Image from


Android Camera

Fourier Mellin
Transformation

Hue, Saturation and Intensity


(HSI) Comparison

Laptop with MatLab Software

Recursive Algorithm
Image Comparison

OUTPUT
Fertility State of Gilts
Laptop Screen (GUI)
Fig 3.1 Conceptual Diagram

Figure 3.1 shows the conceptual diagram of the system. It is composed of three major
blocks which are the input block, the process block and the output block. The description of each
blocks are as follows:
1. INPUT
1.1 Image Acquisition
Through the use of a smartphone camera, the front view image of a vulva sample
will be taken. Four image processing techniques will be applied in order to determine the
fertility state of gilts.
1.2. Image Retrieval
After the image has been acquired through the use of a smartphone camera, the
researchers will now proceed on retrieving the image from the phones memory by
connecting it to the laptop with use of a USB cable.
2. PROCESS
2.1 Image Processing
Once the Graphical User Interface run, the image that will be stored from the
smartphone will be processed for image processing.
2.1.1 Canny Edge Detection
This algorithm will focus on removing the part of the picture that is
unnecessary and will highlight part of the image where the program will focus.

The raw picture will undergo noise reduction using a 5x5 Gaussian filter and will
then be subjected to finding its intensity gradient. Edge gradient and direction for
each pixel will be computed using the following equations [7]:
Edge Gradient(G)= G2x +G2y

Angle ()=tan 1

Gy
Gx

( )

(1)

(2)

Where Gx is the first derivative in the horizontal direction and Gy is the first
derivative in the vertical direction which would detect the edges in a blurred
image.
Since gradient direction is perpendicular to edges, it is approximated to
one of the four angles corresponding to vertical, horizontal, and two diagonal
directions. Then, every pixel is checked if it is found as a local maximum in its
region, as shown in the image below:

Fig. 3.2 Determination of local maximum membership of pixels

Fig. 3.2 is used as a basis if points are found in the local maximum.
Because the edge is normal to the gradient direction, point A is examined with
regards to points B and C. If it forms a local maximum, it goes through the next

stage. Otherwise, it will be suppressed and be held at zero. The image will then be
subjected to hysteresis thresholding.
Hysteresis thresholding determines the true edge and the fake edge. In
order to do this, a minimum and a maximum threshold value are established.
Edges lying above the maximum threshold value will already be classified as
true edges while those falling below the minimum threshold value are nonedges. However, pixels that are found between the threshold values and also
connected to true edges are considered true as well. Otherwise, they are
discarded.

2.1.2 FM Transformation
The outlines of the input vulvar image and the first reference image are
both extracted using the canny edge detection process. The first reference image is
obtained from the systems database. The two outlines are then subjected to FM
transformation technique [8]. This method plots both outlines onto a uniform
coordinate space. It also includes the use of Discrete Fourier transformation
(DFT), log-polar transformation (LPT), and phase correlation methods.
DFT is applied to both outlines. The resulting values will undergo logpolar transformation. An arbitrary point (x,y) will have a corresponding LPT (r,)
representation solved using:

( xx ) +( y y )
2

r =log 10

(3)

=tan

y y c
xx c

(4)

Where xc and yc are the centers respective abscissa and ordinate, r is the
radial distance from the center, and is the rotational angle.
After getting the LPT representation, the phase-correlation method is used
to estimate the relative translation between the images through the use of the Fast
Fourier Domain approach. Because of the different vulva sizes in the database,
proper scaling and rotation must be applied. These parameters are derived in
solving cross-power spectrum. It is defined by:
F F1
F F1

R=F

(5)

( x , y )=argmax (x , y) {R }

Where
y

F1

is a complex conjugate of

(6)
F , x

is the rotation, and

is the scale.
In order to compensate for the differences of the captured image to

relatively bigger and smaller vulvar picture, a specific similarity range is defined.
This is to identify the closest basis for the swelling of the vulva.

Now, the difference between the two outlines will be determined using the
overlapping similarity ratio given by the equation:
similarity ( A , B )=

T ( A B)
x 100
T ( A B)

(7)

Where A is the reference image, B is the input image, and T is a function


denoting the total number of pixels. This value ranges from 0 to 1, 0 being most
dissimilar and 1 being most similar.

2.2 HSI (Hue, Saturation and Intensity)


Once the input vulvar image has shown a similarity value indicating fertility, the
original image is forwarded to the next image processing step.
2.3 Color Segmentation
In this method, sample vulvar image will be converted to HSI color image. The
candidate image is found by using HSI color model on the basis of using hue, saturation
and intensity. Machine vision uses HSI color space in identifying the color of different
objects.
Gilts vulvar color information is used to detect candidate regions in this study
and area properties of vulva allows the reduction of other candidates.
One of the ways of color base recognition is identified as follows:

I iR, j > R ; I Gi , j > G ; I Bi , j > B


I iR, jI Gi , j > RG ;
I {i ,Rj|G|B }

(8)

I iR, jI Bi , j > RB

(9)

are red, green and blue components of i-th, i,j j-th pixel of image I and

and are predefined coefficients. Eq. (8) set up limitations for the minimal values of
pixel components. Eq. (9) formalizes dependences between pixel components for pigs
vulva. Generally, a color recognition is based on two types of restrictions:
First restriction is based on (8) and (9). These equations provides good results in
good lighting conditions, however it is not good in low-contrast images. To solve this
problem, sufficient lighting will be implemented when taking the pictures.

R
{1,(I Gi , j 0.85 I Ri , j)&0,otherwise
, j 0.9 I i , j ), if ( I i , j > I i , j > I i , j )
Ci , j
( I i (eqn.
The second restriction is the threshold value
10) which is defined by the user.
(10)

RGB model is represented by a 3-dimensional cube with red, green and blue at
the corners on each axis and HSI color space, hue, saturation and intensity are three
properties used to describe color. The hue (IH) is represented as angle 0, varying from 0
to 360. Saturation (IS) corresponds to the radius, varying from 0 to 1. Intensities (II)
vary along Z axis. The transform from (R, G, B) to (H, S, I) [5] is
(11)

Detection of fertile vulva binarization process is formulated as:

Where

R
i, j

I iH, j

I
I iH, j ( HR HR)

&
0.7) &
I
H
HR
HR
(12)
(
)
I
I

i, j
( i , j 0.95 )
I iI, j 0.05

1,
if
I iS, j and I iI, j are hue, saturation and intensity components of

i-th, j-th pixel of image I and

HR

HR

standard deviation (hue) of a fertile vulva.

and

CiR, j

HR

HR

are mean (hue) and

is a candidate region coordinate of

image C.
Color segmentation parameters were made sensitive in order to detect as much
candidate regions as possible. All false candidates will be filtered out on the next stages.
Region of interest must be in ellipse shape.

Fig. 3.2 Determination of local maximum membership of pixels

Figure 3.2 was provided to serve as a substitute to show what will happen to the
vulvar image after color segmentation

2.4 Labeling and Filtering


Recursive Algorithm [6] will be used to scan the binary image produced from
Color Segmentation. This works on one pixel at a time and moves all through the image.
In this algorithm, the connected components which have similar pixel intensity from the
binary image are identified and assigned with a unique label. In addition, they are
actually connected with respect to either the four-neighborhood or the eightneighborhood definition as shown on figure 3.2.

Figure 3.3. An image array and its connected component image

Four-neighborhood checks the four pixels that surround the pixel of the region of
interest namely the upper, lower, left and right pixels that are adjacent to it. On the other
hand, Eight-neighborhood checks the eight pixels that surround the pixel of the region of

interest namely the upper, lower, left and right and left and right diagonal pixels that are
adjacent to it.

Figure 3.3 Four-neighborhood

Figure 3.4 Eight-neighborhood

Once the candidate regions are determined, the area of the region of interest will
be computed and formalized by this formula:
n

B[i , j]
i=1 j=1

where n=number of rows

m=number of columns
B[i,j] = coordinate of the pixel of candidate region

The computation of the area of the candidate regions will help in the elimination
of undesired images.
3. OUTPUT

After executing the processing of the inputs, the system will output the fertility state of
the gilt. If the intensity of the filtered region is less than the range of intensities from the database
but not equal to 0, a statement NOT FERTILE will be projected onto the Graphical User
Interface as a form of output. Otherwise, FERTILE

III. CALIBRATION OF ALGORITHMS USED


Canny Edge Detection Calibration
After the Canny Edge detection algorithm determined the pixels that form edges
depending on their gradient directions, it further separates the real edges from the fake or
unnecessary ones. To demonstrate the intensity gradient simulation of a randomly
selected image, a graph is shown below:

Fig. 3.5. An example of a hysteresis thresholding plot


Since a portion of edge A lies above the maximum threshold value, edge C
connected to it is also considered as part of the true edge. Meanwhile, the pixels

consisting

edge

has

intensity

gradients

between the two threshold

values. This

indicates that it will be

discarded in

the final output.

FM

Transformation
The FM transformation is expected to compare the outlines of an input vulvar

image and a vulvar image from the system database. It is expected that the similarity
values to be determined should be between 0% and 100%. The values are recorded in the
table below:

Table 3.1 Similarity Value Calibration and Testing


Comparison of Input
Image to Database Entry#

Similarity Value
( 0 S 100 )

Projected Output
(Fertile or Not Fertile)

1
2
3
4
5
6
7
8
9
10

Since a pigs vulva can swell three to four times its normal size when fertile, the
likelihood of fertility based on the captured image depends greatly on the solved
similarity value S. It is suggested that once similarity is within the range between 0% and

33.33%, the image is that of a fertile pigs vulva. Otherwise, the image will be that of a
non-fertile pigs vulva. The result will then be compared to the HSI-derived values.

IV. DATA GATHERING


Start

Sample Vulvar Image (Front


View)

Canny Edge
Detection

FM Transformation

Is the similarity value


greater than 33.33%?

Not Fertile

YES
Color
Segmentation

Recursive
Algorithm

NO

Is 0 Intensity value <


database intensity
NO

Not Fertile

YES

Fertile

Fig. 3.6 Process Flow

TESTING
Accuracy of the system is verified through successful insemination resulting to swine
pregnancy. Based on the combinations of the possible outputs and their authenticity, two cases
can be derived, namely: 1.) pigs determined fertile and became pregnant; and 2.) pigs determined
fertile but did not become pregnant. Two fertility cycles will be observed for testing the systems
reliability. The findings are recorded in the table below:

Table 3.2. Gilt monitoring in first estrous cycle


Gilt Specimen #

Determined Fertility
(Fertile or Not Fertile)

Pregnancy Result
(Pregnant or Not Pregnant)

1
2
3
4
5
6
7
8
9
10

Table 3.3. Gilt monitoring in second estrous cycle


Gilt Specimen #

Determined Fertility
(Fertile or Not Fertile)

1
2
3
4
5
6
7
8
9
10

BIBLIOGRAPHY

Pregnancy Result
(Pregnant or Not Pregnant)

[1] Briggs, Hilton M. 1983. International Pig Breed Encyclopedia. Elanco Animal Health

[2] Almond, Glen. The Swine Ai Book : A Field and Laboratory Technicians' Guide to Artificial
Insemination in Swine. Mini Tube of America, Inc. 1994

[3]Pitcher,
P.
(1997).
Estrus
in
Swine.
http://cal.vet.upenn.edu/projects/swine/bio/fem/estr/hm.html

Retrieved

from

[4] Diekman, M. & Singleton, W. Reproductive Physiology and Anatomy of the Sow. Retrieved
from http://www.ansc.purdue.edu/swine/porkpage/repro/physiol/reppaper.htm

[5] S. E. Umbaugh, Computer Imaging: Digital Image Analysis and processing, CRC Press,

Florida, pp. 45-50, 93-100, 2005.


[6] L. G. Shapiro and G. C. Stockman, Computer Vision, Prentice-Hall, New Jersey, pp. 56-59,

76-78. 2001
[7]Green,
Bill
(2002).
Canny
Edge
Detection
Tutorial,
Retrieved
http://dasl.mem.drexel.edu/alumni/bGreen/www.pages.drexel.edu/_weg22/can_tut.html

from

S-ar putea să vă placă și