Sie sind auf Seite 1von 39

RASPBERRY PI BASED MICRO CRACK AND FERTILITY DETECTOR FOR

CHICKEN EGGS IN TANAUAN HENS AND ROOSTER FARM

A Project Proposal
Presented to the Faculty of the
Information and Communications Technology Program
STI College Lucena

In Partial Fulfillment
Of the Requirements for the Subject
Software Engineering

Caryl M. Caday
Richjohn Aaron A. Contreras
Nathaniel N. Diaz
Stefano M. Salcedo

April 11, 2019


Table of Contents

Page
Title Page I
Table of Contents II
List of Tables III
List of Figures IV
List of Appendices V
Acknowledgement VI
1.0 Introduction 1
1.1 Background of the Study
1.2 Statement of the Problem
1.3 Objectives of the Study
1.3.1 General Objective
1.3.2 Specific Objective
1.4 Significance of the Study
1.5 Scope and Limitation
2.0 Methodology of the Study
3.0 Data Gathering Procedures and Outputs
4.0 Documentation of the Current System
5.0 Software/Project Estimation
5.1 Schedule of Activities
5.2 Cost Estimation
6.0 Requirements Analysis Specification
6.1 Process Specification/ Modeling
6.2 Data Specification/ Modeling
7.0 Software Design Specification
7.1 Process Specification
7.2 Data Specification
7.3 Screen/ Interface Specification
7.4 Program/ Module Specification
8.0 Software Implementation
8.1 Programming Considerations, Issues, and Tools
8.2 System Requirements Specification
8.2.1 Hardware Requirements
8.2.2 Software Requirements
8.2.3 Human Resource Requirements
8.3 Software Testing
8.3.1 Testing Activities
8.3.2 Test Cases
8.4 Installation Process
9.0 Software Maintenance Plan
Appendices
Bibliography
Resource Persons
LIST OF TABLES
LIST OF FIGURES
LIST OF APPENDICES
ACKNOWLEDGEMENT

The success and final outcome of this project required a lot of guidance and assistance from many

people and we are extremely privileged to have got this all along the completion of my project.

All that we have done is only due to such supervision and assistance and we would not forget to

thank them.

We respect and thank Prof. Bill Marlow O. Estibal, for providing us the opportunity to do the

project work in our software engineering subject and giving us all support and guidance which

made us partially complete the project duly. We are extremely thankful to him for providing such

a nice support and guidance, although he had busy schedule managing other subjects.

We owe our deep gratitude to our thesis adviser Engr. Jun Ruperto C. Garnace, who took keen

interest on our project work and guided us all along, till the partial completion of our project work

by providing all the necessary information for developing a good system.

We are thankful and fortunate enough to get constant encouragement, moral support and guidance

from all our parents which helped us in partially completing our project work. Also, I would like

to extend our sincere esteems to all our friends in school for their timely support.
INTRODUCTION

Chicken egg hatcheries are one of the main industries in the food supplement chain. Hatchability

of eggs is an important factor in chicken eggs hatching process. It is influenced by many factors

such as egg handling, fertility of eggs, breeder flock problem, etc. Tanauan Hens and Rooster Farm

owned by Mrs. Flor Ilagan and manage by Mr. Rico Contreras. It is located in Plaridel, Quezon

and started in year 2017 which they saw that hatching industry is quite a good business for them

due to the lack of chicken breeders and hatchers within their area. They raised and sell native

chicken in pet owners or other farms and some of egg produce will be sold in the market. Due to

the manual incubation that they are using they suffer from 30% mortality rate which is 37.5 out of

125 eggs die due to hen’s urine and feces exposure and sometimes due to the eggs being stepped

on by the hens. And not all the eggs that they incubate in other farms born out to be good which is

a loss for their business due to the expensive rate of other farms that has incubators.

The study concerns to help the hatcher in assuring the egg shell micro crack and embryo fertility

to avoid the contamination in exploder eggs. Detection of infertile and non-hatchable eggs would

benefit hatcheries and poultry breeding farms by saving space, handling costs, and preventing

contamination from exploder eggs. In most hatching centers, the process of separating fertilized

and non-fertilized eggs is performed by experts (through human vision and traditional ways) before

loading the eggs into the incubators. After loading the eggs into the incubators, some experts

periodically check them to make sure that they are truly fertilized. Sometimes, candling machines

are used in this process. In these machines, eggs are exposed to a sharp dim of light. Hence, the

inner side of the eggs can be visible and one can decide whether there exists an embryo in-side

them or not. If the inside of an egg is totally clear without any stains, it means that it is not fertile;

but if there is a black spot alongside with some blood veins (spider like), it is considered as a fertile

egg. To date, various works have been done based on image processing techniques to perform
some tasks in this industry. Some of the research is dedicated to the detection of cracks and dirt on

eggs, or measuring physical coordinates of eggs. In a similar manner to the candling machines,

most of these researches usually use light sources such as the incandescent lamp, fluorescent lamp

or halogen lamp to back-illuminate the egg. The candled eggs are imaged, and the captured images

are processed to extract some physical features from the eggshells surface. The extracted features

are used to perform the target inspections. Although, the above mentioned light sources are suitable

to provide necessary illumination for detection of defects on the eggshell surface from the captured

images, the acquired images lack the sufficient quality to determine the fertility of eggs. In other

words, the conventional light sources used in the candling machines and the previous works are

not appropriate enough to reveal the details of the inner side of eggs such as embryo and its blood

veins. Some researchers have tried to determine the fertility of eggs by employing equipment such

as MRI, infrared hyper spectral imaging, or thermal cameras. However, using this expensive

equipment would not be economical, especially in the case of mass production. Additionally,

possible radiation produced from such equipment may harm the embryos. While considering the

illumination power of the light source, we should also take into account its power consumption

and its coolness. Considering the physical and the chemical structure of an egg, heat can change

the content inside of it and damage its embryo. Usually, embryos cannot tolerate a heat increase

of more than 2 °C. The researchers gathered data by means of conducting interview with the

manager of the Tanauan Hens and Rooster Farm. and to Mr. Rene C. Santiago, the chief of region

IV-A in Bureau of Animal Industry- National Swine and Poultry Research and Development

Center(BAI-NSPRDC)

The study aims to design and develop a system which is capable of detecting chicken eggs embryo

fertility and micro cracks, which is the fertility detector that is in a room and has a microprocessor

with camera that is programmed with image processing algorithms for efficiently detecting cracks
in the eggs before incubating the eggs then check the fertility of incubated eggs before being

returned into the incubator or being transferred into the egg hatching room.

Background of the study

Tanauan hens and rooster farm is a small farm located in Plaridel, Quezon. It was established 2

years ago and is currently using the manual process of candling of chicken eggs.

The process entails a lot of effort due to the manual process of checking cracks in the egg by sound

testing each eggs while bumping them with each other gently but risking eggs being cracked even

more if the hatcher accidentally bumped the eggs harder than it should be which could risk the egg

having bacterial infection that may cause the egg to die before being incubated and be transformed

to an exploder egg. And candling the eggs are certain days of hen incubation which is composed

of a bulb lighting a certain focal point of a box and a dark room to reveal the insides of the eggs to

determine if it’s fertile or infertile but due to the undetermined size of the focal point and the grip

of the hatcher holding the egg the assessment of fertility won’t be that accurate.

Both process requires a lot of labor which therefore requires a device that can help the hatchers

detect micro cracks and embryo fertility easily and reduces the risk factors within their manual

process of detection.

Statement of the problem

Candling is a method used in embryology to study the growth and development of an embryo

inside an egg. It is known for using a bright light source behind the egg to show details through

the shell, and is also called candling because the original sources of light used were candles. The
candling method is designed to help hatchers identify if the eggs are fertile or non-fertile after days

of incubation.

The candling process is also labor intensive, and is not very efficient due to exhaustion and sight

mistakes of workers who have to check hundreds of eggs per week and one of the important factors

in increasing the productivity of the incubation industry is to be sure that the eggs placed in the

incubators are fertile. Usually only some eggs are randomly selected for determination of egg

fertility, which means most infertile eggs will remain in the incubator. Moreover to the capacity

issue, the remaining infertile eggs inside the incubator will be contaminated, and, as a

consequence, some gases will be released into the environment making the situation problematic

for the other healthy embryos. Also the method of detecting micro cracks is mainly by hand, by

which hatchers bumping eggs with each other so as to listen to the produce sound of the egg shell

which may cause further damage to the eggs.

This states the main problem and its disadvantage. Therefore, it is needed to create and develop a

system which is equipped with rapid and cheap image processing system for detecting micro

cracks before being incubated and fertility detection within certain days of incubation to determine

non-fertile eggs in appropriate time to prevent this kind of problem.

Objectives of the Study

General Objective

To develop an automated incubator that will transfer the eggs to the fertility detector to monitor

the eggs which will help the hatchers determine if the eggs are not cracked, and if the incubated

eggs are fertile, it will be put back to the incubator and the infertile eggs to a room.
Specific Objectives

1. To develop a device used to determine if the eggs are fertile and infertile after certain days

of incubation.

The proposed project will provide hatchers a device that will provide appropriate lighting inside

the enclosed device to determine the incubated eggs within 10 days of time to gather data of what

percentage the eggs are developing and what it looks like A light source under the eggs is placed

to reveal the internals of the egg to detect the embryo clearly then after it’s been revealed the

raspberry pi camera will take a picture of the eggs to be processed in the image processing

algorithms in the raspberry pi while using OpenCV with python codes to determine if the eggs are

fertile or infertile. Then will be transferred to the sorting part of the fertile or infertile eggs.

2. To develop a component for the device for detecting micro cracks in the eggs

The proposed project will provide hatchers a device that will provide appropriate lighting inside

the enclosed device to determine if the eggs consist of micro cracks by candling the eggs

automatically. A light source under the fertility detector is placed to reveal the internals of the egg

to detect inside cracks, after it’s been revealed the raspberry pi camera will scan the eggs to

determine if the eggs are cracked, then will be transferred to the non-fertile / cracked eggs room.

3. To develop a device that can alert the user if there are eggs in the infertile/cracked, egg

hatching room and display data/status about the eggs in a web server.

The proposed project will provide hatchers a system that count the scanned eggs, determine if its

cracked/ non-fertile which will then be displayed to a web based information centre which can be

accessed by the owner through its own web server.


Significance of the study

The results of the study would greatly benefit the following:

 Incubating Industry – Those who are in the incubation industry would have a device that

can detect fertility and cracks which is more precise, safe and accurate than being manually

candled by the hatchers which is prone to man-made errors.

 Hatchers –To those who are responsible for handling the incubation and hatching process

of the eggs would have a device that will help them lessen the time to identify if the eggs

does have crack, is it still viable for incubation, or the egg is already infertile.

 Future Researchers - This research will be a useful reference for the researchers who

would plan to make any related study precisely the standard underlying in the Bachelor of

Science in Computer Engineering program.

Overall, this study will benefit all the people who have small breeding farms and other

incubation industry by having a precise and accurate device capable of detecting cracks and

signs of fertility after a certain time of incubation which can save time, money, and space inside

the incubator and can prevent exploder eggs which releases bacteria once it explodes.

Scope and Limitations of the Study

This section covers the range of boundaries of “Monitoring Embryo Fertility and Micro Crack

Detection in Chicken Eggs Using Image Processing” based on the conducted survey
Scope of the Study

Fertility Detection Module

The system will be using The Raspberry Pi 3B+ for handling the image processing techniques

and the Raspberry Pi Camera Module v2 for capturing high quality images. This module is

combined with a 310 lumens led bulb in a dark room for candling the eggs that will be used for

crack detection and embryo fertility detection and decide where will the egg go after it has been

scanned.

LCD Display Module

This module is for displaying of the basic information and operation of the system on the LCD

display screen. The device displays the current temperature inside the incubator and provides the

buttons which will begin and stop the incubation process

Power Supply Module

This module includes the distribution of power needed in the device. As the power supply

converts the alternating current into direct current, it then regulates the power distribution from

220 volts into proper amount of voltage or usable power enough to run the device. With the use

of power supply module, the device maintains the proper voltage input and power distribution to

avoid hardware malfunction. This module provides a power supply that will provide +5VDC

Wi-Fi Module

This module serves as the communicator with the microprocessor for displaying the data inside

the device to the information center created in a web server that will be accessed by the user to

determine how many eggs have been deemed fertile and infertile/cracked.
Limitations of the study

The prototype model is not portable.

The proposed system is not a portable device as the incubation and candling is only done within a

designated area. The system is designed to be stationary and is also composed of heavy

components like wood, battery and containers which makes it difficult to be moved to other places.

The prototype model doesn’t support solar charging.

Due to the device already being connected to 220 AC supply voltage to charge the battery, the

system is not designed for solar charging the battery which is only essential if blackouts occur for

several days and there is no power source to supply charge to the battery which therefore can’t

supply power to the components in the device.

In case of blackout the battery can still operate for the system but not longer than a day

Due to power consumptions of the devices which operates from 5V to 12V, the system is not

designed for a monitoring during blackout which can shut down the whole system if there is not

enough power source to supply the devices and when there is no power source to charge the battery

as the charger is connected to 220 AC supply voltage.

The lead acid battery charger must not be removed during the automatic incubation which

is required for an automatic charging of battery.

The lead acid battery charger is needed for charging the battery during monitoring as the devices

consumes the source from the battery since it will supply the whole system power source, as the

solar charge controller determines the charging state of the battery at 10V at this state battery will

be charge automatically through solar charge controller only is lead acid battery charger is not

removed or connected to the battery. Hence removing the charger during the monitoring might
cause power interruptions when solar charge controller have reached the charging state for battery

where it will stop supplying power to the loads when battery is at charging state and lead acid

battery charger is not connected to charge the battery.

Displaying of other data or characteristics about the egg on the information center is not

included in the study.

The proposed system is to develop an automated incubator which has bots that will transfer the

eggs, scan the eggs and hold the eggs in place while being incubated. Displaying and measuring

the characteristics of the eggs like height, shape, color and thickness might affect the performance

of the device, might increase the expenses due to the additional hardware components and might

become unstable due to the complexity of the system and other components that will be put into

the image processing part of the system which is already pressingly intensive.
METHODOLOGY

In view of the study being performed, the proponents have narrowed their choices to the following

methodologies: the rapid application development, the waterfall model and the prototyping model

paradigms.

The proponents decided to use the prototyping methodology due to it being the most efficient way

to make this project. The prototyping methodology is a method used to determine the requirements

needed. A prototype will be immediately built to solve identified problems and to know what the

project requires and can be evaluated by the end users through feedback and determine which

must be furtherly improved or not.

Prototype development starts with an initial requirements gathering phase. A quick design is

carried out and a prototype is built. The developed prototype is submitted to the customer for

evaluation. Based on the customer feedback, the requirements are refined and the prototype is

suitably modified. This cycle of obtaining customer feedback and modifying the prototype

continues till the customer approves the prototype.


FIGURE 3.1 Prototyping Diagram
Prototyping is composed of the following steps.

Requirements Gathering and Refinement

In this stage, this is the process to gather the requirements for building the hardware and software

from the client, analyze and document them which is also known as requirements gathering. The

goal of requirements gathering is to develop and maintain sophisticated and descriptive system

requirements specification document.

Quick Design

When requirements are known, a preliminary design or quick design for the system is created. It

is not a detailed design and includes only the important aspects of the system, which gives an idea

of the system to the user. A quick design helps in developing the prototype.

Building Prototype

Information gathered from quick design is modified to form the first prototype, which represents

the working model of the required system.

Customer Evaluation

Next, the proposed system is presented to the user for thorough evaluation of the prototype to

recognize its strengths and weaknesses such as what is to be added or removed. Comments and

suggestions are collected from the users and provided to the developer.
Refining Prototype

Once the user evaluates the prototype and if he is not satisfied, the current prototype is refined

according to the requirements. That is, a new prototype is developed with the additional

information provided by the user. The new prototype is evaluated just like the previous prototype.

This process continues until all the requirements specified by the user are met. Once the user is

satisfied with the developed prototype, a final system is developed on the basis of the final

prototype.

Engineering Product

Once the requirements are completely met, the user accepts the final prototype. The final system

is evaluated thoroughly followed by the routine maintenance on regular basis for preventing large-

scale failures and minimizing downtime.

The Waterfall model is neither applicable to use since it is difficult for the user to state all

requirements at once explicitly. Real project rarely follows the sequential flow of the model in

order to finish the project which is time consuming for the developers. Not suitable for projects

where requirements are at a moderate to high risk of changing.

The spiral model has a risk of not meeting the schedule due to risk analysis assessment and

complex structures of the project or budget works. It is also best for large projects which also

demands risk assessment expertise and it is not advisable for smaller projects because it might cost

a lot.
Data Gathering and Procedure

For the purposes of this research, in depth interviews were used. In depth interviews are personal

and unstructured interviews, whose aim is to identify participant’s emotions, feelings, and opinions

regarding a particular research subject. The main advantage of personal interviews is that they

involve personal and direct contact between interviewers and interviewees, as well as eliminate

non-response rates, but interviewers need to have developed the necessary skills to successfully

carry an interview. What is more, unstructured interviews offer flexibility in terms of the flow of

the interview, thereby leaving room for the generation of conclusions that were not initially meant

to be derived regarding a research subject. However, there is the risk that the interview may deviate

from the pre-specified research aims and objectives.

The researchers made a letter for the approval to conduct the study at Tanuan hens and rooster

farms through the manager Mr. Rico Contreras. After collecting all data the researchers need

through interview, with the help of center chief of NSPRDC Dr. Rene C. Santiago. The result

would hopefully be the basis for a much more precise and accurate fertility/crack detection device.
Documentation of the Current System

Manual Incubation and Candling

COLLECTING

INCUBATION

CANDLING

Fig. 1 Chicken egg process incubation

Based on the interview in the manager, collecting egg perform once a day in the morning

before noon in the chicken breeder house. In cleaning eggs they use knife to remove dirt in

egg shell. Storing eggs the breeding hens takes 7 days to 14 days but the researcher retrieved

from the poultry world article that hatchability decreases the longer the eggs are stored. For

best results, set the eggs to incubate within 7 to 10 days of laid.

The hatcher sorting process for crack detection within the egg is determining the non-visible

crack to human sight within the egg by inspecting the produce sound of the rotating egg while

bumping with each other. Crack- free eggs sound fine and solid while cracked eggs sound

broken. It is followed by separating the crack egg and the good egg quality will transfer to the

breeding hen for incubation manually. According to Mr. Rene C. Santiago, a center chief of

NSPRDC the only way to tell if the egg is fertile is by incubating it for a few days, and then

candling the egg to see its progress. This involves going into a dark room, and shining a bright

light underneath the large end of the egg. If the egg is fertile, it should has a dark spot around
the middle of the egg with some spider-like veins beginning to form around it. If it’s not fertile

the shape of the yellow yolk inside the egg without any signs of an embryo or veins. Candling

can be done multiple times throughout the incubation process on Day 10th and Day 18th for

optional re- candling.

If day 10th if there is still no growth, remove the eggs to avoid them exploding. This helps

identify whether the fertile egg is developing as it should, or whether the embryo may have

died. The dead embryo does not have any blood veins and stick to the eggshell, and usually a

pink ring, so called blood ring, surrounds it and needs to be removed by preventing

contamination from exploder eggs.

Incubating egg consist of 99.5° F- 100°F temperature and 50% to 60% of humidity. On the

18th day, eggs are transferred to a different tray, which cannot be tilted. Eggs are transferred to

hatcher so that the hatching chicks do not contaminate other batches of eggs being incubated.

By the end of the 21st day all chicks have hatched and are ready to remove from hatcher tray.

Hatching process in 21st days and egg transforms from what is essentially similar to a fertilized

table egg into a live, complete chick.


Software/Project Estimation

Schedule of Activities
Cost Estimation

Approximate Actual Actual


Quantity Specifics
Cost (PHP) Quantity Cost
1pc. Raspberry Pi 3 B+ 2500.00
1 pc. Raspberry Pi Camera 8MP 2000.00
1 pc. Led Bulb 200.00
1 pc. Solar Charge Controller 500.00
1 pc. RS321 RTC Module 200.00
1 pc. Stepper Motor 200.00
2 pc. Stepper Motor Driver 300.00
1 pc. 2 Channel Relay 150.00
1pc. 20*4 LCD Display 250.00
10pcs. LED (Light Emitting Diode) 30.00
1 pc. Lead Acid Battery 1500.00
20 pcs. Connecting Wires (1M) 100.00
3D printer T8 Screw Lead Screw
1 pc. 400.00
400mm Steel Lead Screw Shaft
TOTAL P 8,330.00
Requirements Analysis and Specification

 Process Specification / Modeling

The

o Data Flow Diagram

 Data Specification / Modeling


Software Design Specification

 Process Specification

The proposed system is composed of three main modules, Image capturing module where the

camera captures an image of the egg, the image processing module, where the image processing

techniques performs its duty to detect cracks and embryo fertility within the egg, and the web

server module, where the information center displays the scanned eggs if how many are fertile or

infertile/ cracked.

The process begins with the entry of the captured image (module 1). This is where the camera

captures the image of the egg when it detected an egg in front of it.

Using the image from the camera, the system will then process the image using image processing

techniques/ algorithm (module 2).

The information is then stored in the web database and then retrieved by using the mobile device

for accessing the web server by the user. (Module 3).


o Data Flow Diagram

BASIC DIAGRAM

DATA INPUT PROCESS INFORMATION OUTPUT

IMAGE PROCESSING
CAPTURED TECHNIQUES / DISPLAY RESULT IN
WEB
IMAGE ALGORITHM

SOFTWARE DATA FLOW DIAGRAM

EGGS INFORMATION

HATCHER FERTILITY DETECTOR WEB SERVER


EGGS

PROCESS CAPTURED
EGGS

IMAGE PROCESSING
TECHNIQUES /
ALGORITHM
DISPLAY EGG COUNT

FERTILE AND INFERTILE/CRACKED


 Data Specification

o Entity Relationship Diagram

Capture Image

Image Processing

Web Server
Software Implementation

Programming Considerations, Issues, and Tools

Region of Interest

import cv2
import numpy as np

# import image
image = cv2.imread('C:\\Users\\PC\\Desktop\\roi.png')

# grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('gray', gray)

# binary
ret, thresh = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY_INV)
cv2.imshow('threshold', thresh)

# dilation
kernel = np.ones((10, 1), np.uint8)
img_dilation = cv2.dilate(thresh, kernel, iterations=1)
cv2.imshow('dilated', img_dilation)

# find contours
im2, ctrs, hier = cv2.findContours(img_dilation.copy(), cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)
# sort contours
sorted_ctrs = sorted(ctrs, key=lambda ctr: cv2.boundingRect(ctr)[0])

for i, ctr in enumerate(sorted_ctrs):


# Get bounding box
x, y, w, h = cv2.boundingRect(ctr)

# Getting ROI
roi = image[y:y + h, x:x + w]

# show ROI
# cv2.imshow('segment no:'+str(i),roi)
cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)
if w > 15 and h > 15:
cv2.imwrite('C:\\Users\\PC\\Desktop\\output\\{}.png'.format(i), roi)

cv2.imshow('marked areas', image)


cv2.waitKey(0)

Histogram Equalization

import java.util.ArrayList;
import java.util.List;

import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

public class HistoTest {


public static void main (String[] args) {
#Loading the OpenCV core library
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );

# Reading the Image from the file and storing it in to a Matrix object
String file ="E:/OpenCV/chap20/histo_input.jpg";

#Load the image


Mat img = Imgcodecs.imread(file);

# Creating an empty matrix


Mat equ = new Mat();
img.copyTo(equ);

#Applying blur
Imgproc.blur(equ, equ, new Size(3, 3));

#Applying color
Imgproc.cvtColor(equ, equ, Imgproc.COLOR_BGR2YCrCb);
List<Mat> channels = new ArrayList<Mat>();

#Splitting the channels


Core.split(equ, channels);

#Equalizing the histogram of the image


Imgproc.equalizeHist(channels.get(0), channels.get(0));
Core.merge(channels, equ);
Imgproc.cvtColor(equ, equ, Imgproc.COLOR_YCrCb2BGR);
Mat gray = new Mat();
Imgproc.cvtColor(equ, gray, Imgproc.COLOR_BGR2GRAY);
Mat grayOrig = new Mat();
Imgproc.cvtColor(img, grayOrig, Imgproc.COLOR_BGR2GRAY);

Imgcodecs.imwrite("E:/OpenCV/chap20/histo_output.jpg", equ);
System.out.println("Image Processed");
}
}

Noise Removal

import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
img = cv.imread('die.png')
dst = cv.fastNlMeansDenoisingColored(img,None,10,10,7,21)
plt.subplot(121),plt.imshow(img)
plt.subplot(122),plt.imshow(dst)
plt.show()

Binarization
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
img = cv.imread('noisy2.png',0)
# global thresholding
ret1,th1 = cv.threshold(img,127,255,cv.THRESH_BINARY)
# Otsu's thresholding
ret2,th2 = cv.threshold(img,0,255,cv.THRESH_BINARY+cv.THRESH_OTSU)
# Otsu's thresholding after Gaussian filtering
blur = cv.GaussianBlur(img,(5,5),0)
ret3,th3 = cv.threshold(blur,0,255,cv.THRESH_BINARY+cv.THRESH_OTSU)
# plot all the images and their histograms
images = [img, 0, th1,
img, 0, th2,
blur, 0, th3]
titles = ['Original Noisy Image','Histogram','Global Thresholding (v=127)',
'Original Noisy Image','Histogram',"Otsu's Thresholding",
'Gaussian filtered Image','Histogram',"Otsu's Thresholding"]
for i in xrange(3):
plt.subplot(3,3,i*3+1),plt.imshow(images[i*3],'gray')
plt.title(titles[i*3]), plt.xticks([]), plt.yticks([])
plt.subplot(3,3,i*3+2),plt.hist(images[i*3].ravel(),256)
plt.title(titles[i*3+1]), plt.xticks([]), plt.yticks([])
plt.subplot(3,3,i*3+3),plt.imshow(images[i*3+2],'gray')
plt.title(titles[i*3+2]), plt.xticks([]), plt.yticks([])
plt.show()

Region of interest

The input RGB image is converted to grayscale image. Then, the region of interest is localized and

a sub image is created to be processed in the next steps. By assuming that the background of the

images is almost black, extraction of sub images done using the intensity information and applying

some morphology operations. In other words, the sub-image is easily obtained by detecting the

area whose brightness changes abruptly.

Histogram Equalization

In order to increase the visibility of embryo inside the egg, we increased the image contrast. To

this method, we equalize the histogram of the sub-image by using the contrast limited adaptive

histogram equalization (CLAHE). Adaptive histogram equalization is an image processing

technique that is used to improve the contrast in images. It differs from ordinary histogram

equalization in respect that the adaptive method computes several histograms, each corresponding

to a distinct section of the images, and uses them to redistribute the lightness values over the image.

It is therefore suitable for improving the local contrast and enhancing the definitions of edges in

each region of an image. CLAHE was used to prevent the over-amplification of noise that adaptive

histogram equalization can arise to.


Noise Removal

To remove possible noises due to use of inexpensive camera or small spots on the shell, a median

filter with a 3x3 template and Gaussian smoothing is used to eliminate noises. The median filter is

a nonlinear digital filtering technique that is often used to remove noise. Such noise reduction is a

typical preprocessing step to improve the results of later processing. Median filtering is very

widely used in digital image processing because, under certain conditions, it preserves edges while

removing noise

Binarization and Classification

We use a thresholding scheme to convert the preprocessed image to a binary image. This is to

distinguish pixels of the embryo (dark points) from the other regions (light parts). As different

eggs and the embryos differ in some physical properties such as color, size, and blood veins, hence

using a fixed threshold value or applying common threshold finding methods such as Otsu

algorithm is not applicable in this system. Therefore, we propose a dynamic threshold finding

algorithm to measure a proper threshold value for each individual image. By performing the

thresholding task, the embryo and its blood veins are indicated with black pixels and the remaining

parts are indicated with white pixels. However, the obtained binary image may contain some noise

due to spars blood stains or spots on the eggshell surface. The noise is present in the form of small

black holes. To remove these holes, a filter with 3×3 template size is used.
System Requirements Specification

 Hardware

 Central Processing Unit

 Microprocessor or PC

 Pentium, Dual Core, or higher processor. The higher the processor, the

faster is the processing time

 At least 1GB RAM (Random Access Memory)

 SD Card / Hard Disk

 USB Port

 Input Devices

 Raspberry Pi Cam 2 8mp – used in capturing images that will be used for

image processing to determine the micro cracks or embryo fertility.

 Output Devices

 Mobile Device - a device where the user can access the web based

information center through the web server.

 Software

 Operating System: Raspbian OS or Windows 7

 Application Software: OpenCV or Matlab


Human Resource

The system that we developed is simple and user friendly such that no special skills are needed to

operate it. Basically, the system will need the hatcher which is responsible for the eggs, to put the

eggs inside the device for detecting micro crack or embryo fertility. The hatcher is the one in

charge of the entire system. This person should be knowledgeable of the process of candling the

eggs.

Software Testing

In this part the system is tested. The separate modules are bought together and tested as a complete

system. The system is tested to ensure that modules work and with the expected volume of data

and that the system does what user requires.

 Testing Activities

We employed three testing stages in the development system. The first testing stage was during

the creation of the image processing modules. We tested each modules with random images to

know if it is working.

The second testing was conducted when the different image processing modules were put together.

Testing begun immediately after joining the first two modules to make sure that data are

synchronized, both image processing modules are performing what they are supposed to do, and

there are no broken links. This process was repeated until all the modules were put together.
The last stage was testing the entire system using egg sample data. Here, we asked the help of the

hatchers to try our system if all expectations are met. We also tested the system with other types

of chicken eggs provided in their farm to test the accuracy of the device.

 Test Cases

 March 16 – Individual testing of all image processing modules, checking for the

accuracy of the camera to capture image and the algorithm of detecting cracks and

embryo fertility.

 March 27 – Systems test. We tested the whole system after errors were corrected.

 April 02 – The system was tested in a computer. No problems were encountered.

Installation Process

 Site preparation

Prior to the installation of the Micro crack and Fertility Detector, a site inspection is conducted to

determine if their candling room is sufficient enough for maximizing the efficiency of the device.

Then the device will be placed in a designated place within the candling room, where the hatchers

will place the eggs to start candling procedure.

 Personnel Training

A two-day training program on the operation of the system will be conducted for all the hatchers.

This training program will be held at Tanauan Hens and Rooster Farm and will be scheduled before

summer, when the managers and the hatchers are not much busy with their work.
The training program will include a brief introduction to the developed system, emphasizing on

how the usual activities done in the manual system bumping the eggs with each other/ sound testing

for micro crack and candling for fertility detection are automated. Program modules that perform

each step of the manual process will be explained, highlighting the results of the processes and

their connection to the entire system. Each process will be tackled so that the users would know

which is which.

The main part of the training program is visualization, which will be running on the entire system

with sample data so that the users will be confident in using the system. The sample data to be

used are the eggs stored for incubation so the users would have a clear understanding of the entire

system

 Process Conversion

The manual candling process will be replaced by the Micro Crack and Fertility Detector, upon

installation, program modules are checked and the necessary alterations are done to ensure that the

camera will capture and detect signs of crack and embryo fertility.

 Implementation Schedule

The implementation of the Micro crack and Fertility Detector will be implemented on April 13,

2019, the restart of their incubation of the month April 13 – May 4


Software Maintenance

Inevitably, the system will need maintenance. Maintenance operation takes place after the system

has been installed.

Periodic maintenance of the system will be performed to address problems that may arise during

post implementation period. Contact numbers will be provided to Tanauan hens and rooster farm

that they can use in case of problems arising from the use of the system.

Appendix

Bibliography

Websites

https://www.ijarcce.com/upload/2015/may-15/IJARCCE%2045.pdf

https://opencv-python-

tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_table_of_contents_imgproc/py_

table_of_contents_imgproc.html

https://www.programming-techniques.com/2013/01/histogram-equalization-using-c-image-

processing.html

https://www.mathworks.com/help/images/roi-based-processing.html

https://www.ijsr.net/archive/v6i3/25031706.pdf

https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7784945

Resource Persons

Mr. Rico Contreras


Manager
Tanauan Hens and Rooster Farms
Plaridel, Quezon

Das könnte Ihnen auch gefallen