Documente Academic
Documente Profesional
Documente Cultură
University of Khartoum
Faculty of Engineering
Agricultural and Biological
Engineering Department
By
Areej Saif El-Deen Muhammad Babiker 101002
Amr Muhammad Zain Ahmad Al-haj 101045
Muhammad Faisal Farah Muhammad 101060
Razaz El-Fatih El-Faki El-Mutasim 101031
Supervisor
Dr. ABBAS YOUSIF EL-TIGANI
Faculty of Engineering
AUGUST 2015
Dedication
-1-
Table of contents
CHAPTER 1:
1.1 Introduction………..……………………..……………………………….………………9
CHAPTER 2:
2.2.2 Orange……………………………..……..…………………….………………………18
2.2.2.1.3 Hamlin……..………………………………..………………………………...……19
2.2.2.3 Acidity……………………………………..…………………………………………22
-2-
2.2.2.4 Grading……………………………………..……………………………………….22
2.2.2.5 Harves……………………………………..…………………………………………23
2.2.3.1 Description…………………………………………………………………………..23
2.2.3.2 History……………………………………………………………………………….24
2.4.2 Immersion…………………………………..…………………………………………28
2.5 Drying………………………………..………………………………………………….28
-3-
2.8 Manual sorting…………………………………..……………………………………….35
CHAPTER 3:
-4-
3.3.3.3 Dryer views ………………………………………………………………….…60
CHAPTER 4:
4.2 Discussion…………………………..………………………………………………..83
CHAPTER 5:
5.2 Recommendation….………………………..……………………………………….86
-5-
References ………………………..……..…………………………………………... 87
APPENDIX
-6-
Abstract:
Washing, sorting and grading of fruits will increase its quality which is beneficial both to
the consumer and the producer. Therefore any system which perform the above operations will be
of a great value. The main objective of this project is to design a similar system for citrus fruits.
To design such a system fruits weight, sizes and surface area need to be found. Experiment were
carried out in the department of agricultural and biological engineering in which the surface areas
and weight of lemon are found to be in a range between (22.5-65)g , (32-109) cm2, for oranges
(102-241) g , (88-161) cm2 ,for grapefruits (432 – 935) g, the surface area and weights of lemon,
orange and grapefruits are used to design the washing, sorting and grading system.
A system consist of a washing unit, sorting unit using image processing, and a grading unit
-7-
الخالصة
غسل وفرز وتصنيف الفاكهة تزيد من جودتها الشيء الذي يؤدي الى رضا المنتج والمستهلك على حد سواء
لذا اي نظام مستخدم يشمل العمليات السابقة يعتبر نظام ذو قيمة عالية .المغزى من هذه الدراسة هو تصور
تصميم لنظام فرز للفواكه الحمضية.لتصميم نظام بالكفاءة المذكورة كان البد من قياس وزن ومساحة سطح
الفواكه المعنية .اجريت تجارب في قسم الهندسة الزراعية والبيولوجية جامعة الخرطوم ووجدت نتائج اوزان
ومساحة سطح الليمون بين ) (22.5-65جرام لألوزان و ) (32-109سم مربع لمساحة سطح الليمون ,وايضا
( )142-201جرام و( )262- 88سم مربع للبرتقال ,و( )539-431جرام و() 949.02-141.6سم مكعب
للقريب فروت .باستخدام النتائج المتحصل عليها ألوزان ومساحة سطح البرتقال والليمون والقريب فروت تم
وضع تصور تصميم نظام لغسل وفرز وتصنيف الفاكهة قيد التجربه .
صمم نظام يحوي وحدة غسل ووحدة فرز باستخدام نظام لتحليل الصور ووحدة لتصنيف االحجام بنجاح بسعة
-8-
Chapter (1)
-9-
1.0 Introduction
1.1 Introduction
sorting, grading, packing, transporting and storage. The fruits sorting and grading are considered
Fruit and vegetables grading: involves the inspection, assessment and sorting of various
fruits and vegetables regarding quality, freshness, legal conformity and market value. Fruit
grading often occurs by hand, in which fruits are assessed and sorted. Machinery is also used to
grade fruits, and may involve sorting products by size, shape and quality. For example, machinery
Sorting is any process of arranging items systematically, and has two common, yet distinct
meanings:
defects), texture, shape and sizes. Manual sorting is based on traditional visual quality inspection
performed by human operators, which is tedious, time-consuming, slow and non-consistent.It has
become increasingly difficult to hire personnel who are adequately trained and willing to undertake
the tedious task of inspection. A cost effective, consistent, superior speed and accurate sorting can
- 10 -
Color and size are the most important features for accurate classification and sorting of citrus.
Because of the ever-growing need to supply high quality fruits and vegetable products within a
short time, automated grading of agricultural products is getting special priority among many
farmer associations. The impetus for these trends can be attributed to increased awareness by
consumers about their better health well-being and a response by producers on the need to provide
quality guaranteed products with consistency. It is in this context that the field of automatic
inspection and machine vision comes in to play the important role of Quality control for
agricultural products. Fruit size estimation is also helpful in Planning, packaging, transportation
and marketing operations. Among the physical attributes of agricultural materials, volume, mass
Most raw materials contain some components that are inedible or have variable physical
characteristics. Processing techniques such as sorting, grading, screening and trimming are
necessary to obtain the required uniformity of the raw materials for further processing.
Modern industrialized supply chains have many established criteria and for producers to be
competitive, they must meet the specified requirements. Buyers will pay premium prices for fruit
of uniform size and color. In consumer use, sorted fruits are more attractive to the eye and allow
the serving of uniformly sized portions. This latter point is of particular importance in catering
packs.
In general, items should not be misshapen or bruised, and should be free of blemishes, diseases
and mechanical damage. Product that will be stored for a length of time prior to marketing must
also meet criteria for maturity, firmness and damage to ensure storability. The importance of the
sorting operation cannot be overstated, since variations in this operation will affect returns for most
- 11 -
1.2 Objectives of the study
2) To design a machine for washing, sorting and grading lemon, orange and grapefruit.
- 12 -
Chapter (2)
- 13 -
2.0 Literature review
Sorting is the separation of raw materials and/or food slurries into categories on the basis
of shape, size, weight, image and color. Sorting allows the separation of some undesirable
additional material (e.g. leaves, stones) of inappropriate raw material (immature or rotted fruits),
and aims at ensuring that only good quality fruit is preserved and passed through for further
processing.)
Sorting is the segregation of edible or marketable product into distinct quality categories
on the basis of shape, size, weight, image and color. Sorting of the marketable items is
accomplished by both mechanical equipment (sizes, color sorters) and by manual means (visual or
Sorting is often combined with grading, but in some applications both phases are separated
from each other and the sorting phase is only for removing produce with surface deformities or
For size sorting, various types of screens and sieves, with fixed or variable apertures, can
belt or roller-sorter.
Weight sorting is a very accurate method and is therefore used for more valuable fruits.
Image processing is used to sort fruits on the basis of length, diameter and appearance, i.e.
- 14 -
Color sorting can be applied at high rates using microprocessor controlled color sorters.
In this chapter, the major Rheological properties of fruits (lemon, grapefruit, orange) are discussed
and studied.
2.2.1 Lemon
The first substantial cultivation of lemons in Europe began in Genoa in the middle of the
15th century.] The lemon was later introduced to the Americas in 1493 whenChristopher
Columbus brought lemon seeds to Hispaniola on his voyages. Spanish conquest throughout the
New World helped spread lemon seeds. It was mainly used as an ornamental plant and for
medicine. In the 19th century, lemons were increasingly planted in Florida and California.
In 1747, James Lind's experiments on seamen suffering from scurvy involved adding lemon
The origin of the word "lemon" may be Middle Eastern. One of its earliest occurrences appears
in a Middle English customs document of 1420–1421. The word draws from the Old French limon,
thence the Italian limone, from the Arabic laymūn or līmūnليمون, and from the Persian līmūnليمو, a
generic term for citrus fruit, which is a cognate of Sanskrit (nimbū, “lime”).
2.2.1.1Lemon varieties
The 'Bonnie Brae' is oblong, smooth, thin-skinned, and seedless mostly grown in San Diego
- 15 -
The 'Eureka' grows year-round and abundantly. This is the common supermarket lemon, also
known as 'Four Seasons' (QuarterSeasons) because of its ability to produce fruit and flowers
together throughout the year. This variety is also available as a plant to domestic customers. There
is also a pink-fleshed Eureka lemon, whish’s outer skin is variegated from green and yellow stripes.
The 'Femminello St. Teresa', or 'Sorrento is native to Italy. This fruit's zest is high in lemon
The 'Meyer' is a cross between a lemon and possibly an orange or a mandarin, and was
named after Frank N. Meyer, who first discovered it in 1908. Thin-skinned and slightly less acidic
than the Lisbon and Eureka lemons, Meyer lemons require more care when shipping and are not
widely grown on a commercial basis. Meyer lemons have a much thinner rind, and often mature
to a yellow-orange color. They are slightly more frost-tolerant than other lemons.
The 'Ponderosa' is more cold-sensitive than true lemons; the fruit are thick-skinned and
Lemons were the primary commercial source of citric acid before the development of
The juice of the lemon may be used for cleaning. A halved lemon dipped in salt or baking
powder is used to brighten copper cookware. The acid dissolves the tarnish and the abrasives assist
the cleaning. As a sanitary kitchen deodorizer the juice can deodorize, remove grease, bleach
stains, and disinfect; when mixed with baking soda, it removes stains from plastic food storage
- 16 -
containers. The oil of the lemon's peel also has various uses. It is used as a wood cleaner and polish,
where its solvent property is employed to dissolve old wax, fingerprints, and grime. Lemon oil and
A halved lemon is used as a finger moistener for those counting large amounts of bills,
Lemon oil may be used in aromatherapy. Lemon oil aroma does not influence the human
immune system, but may enhance mood. The low pH of juice makes it antibacterial, and in India,
the lemon is used in Indian traditional medicines (Siddha medicine and Ayurveda).(9 Ohio State
Fat .3 grams
- 17 -
Protein 1.1 grams
Vitamin C 53 milligrams
Calcium 26 milligrams
Iron .6 milligrams
Magnesium 8 milligrams
Phosphorus 16 milligrams
From Julia F. Morton (1987). "Lemon in Fruits of Warm Climates". Purdue University.
pp. 160–168
Lemons are a rich source of vitamin C, providing 64% of the Daily Value in a 100 g serving.
Lemons contain numerous phytochemicals, including polyphenols and trepans. As with other
citrus fruits, they have significant concentrations of citric acid (about 47 g/l in juice).
2.2.2 Orange
- 18 -
Sweet oranges were mentioned in Chinese literature in 314 BC. As of 1987, orange trees were
found to be the most cultivated fruit tree in the world. Orange trees are widely grown in tropical
and subtropical climates for their sweet fruit. The fruit of the orange tree can be eaten fresh, or
processed for its juice or fragrant peel. As of 2012, sweet oranges accounted for approximately
In 2013, 71.4 million metric tons of oranges were grown worldwide, production being
Common oranges (also called "white", "round", or "blond" oranges) constitute about two-thirds
of all the orange production. The majority of this crop is used mostly for juice extraction.
The Valencia orange is a late-season fruit, and therefore a popular variety when navel oranges
are out of season. This is why an anthropomorphic orange was chosen as the mascot for the 1982
FIFA World Cup, held in Spain. The mascot was named Naranjo ("little orange") and wore the
Thomas Rivers, an English nurseryman, imported this variety from the Azores Islands and
catalogued it in 1865 under the name Excelsior. Around 1870, he provided trees to S. B. Parsons,
a Long Island nurseryman, who in turn sold them to E. H. Hart of Federal Point, Florida.
2.2.2.1.3 Hamlin
- 19 -
This cultivar was discovered by A. G. Hamlin near Glenwood, Florida, in 1879. The fruit is
small, smooth, not highly colored, seedless, and juicy, with a pale yellow colored juice, especially
in fruits that come from lemon rootstock. The tree is high-yielding and cold-tolerant and it
produces good quality fruit, which is harvested from October to December. It thrives in humid
subtropical climates. In cooler, more arid areas, the trees produce edible fruit, but too small for
commercial use.
Trees from groves in hammocks or areas covered with pine forest are budded on sour orange
trees, a method that gives a high solids content. On sand, they are grafted on rough lemon
rootstock. The Hamlin orange is one of the most popular juice oranges in Florida and replaces the
Parson Brown variety as the principal early-season juice orange. This cultivar is now the leading
early orange in Florida and, possibly, in the rest of the world. (Willard Hodgson (1967–1989))
Navel oranges are characterized by the growth of a second fruit at the apex, which protrudes
slightly and resembles a human navel. They are primarily grown for human consumption for
various reasons: their thicker skin makes them easy to peel, they are less juicy and their bitterness
– a result of the high concentrations of limonene and other limonoids – renders them less suitable
for juice. (Kimball, Dan A. (June 30, 1999 )Their widespread distribution and long growing
season have made navel oranges very popular. In the United States, they are available from
Blood oranges are a natural mutation of C. Sinensis, although today the majority of them
are hybrids. High concentrations of anthocyanin give the rind, flesh, and juice of the fruit their
- 20 -
characteristic dark red color. Blood oranges were first discovered and cultivated in Sicily in the
fifteenth century. Since then they have spread worldwide, but are grown especially in Spain and
Italy—under the names of sanguine and sanguinely, respectively.(Kimball, Dan A. (June 30,
1999).)
Aidless oranges are an early-season fruit with very low levels of acid. They also are called
"sweet" oranges in the United States, with similar names in other countries: douce in France,
sucrena in Spain, dolce or maltase in Italy, meski in North Africa and the Near East (where they
are especially popular), şekerportakal ("sugar orange") in Turkey, succari in Egypt, and lima in
- 21 -
Protein 0.94 grams
Vitamin A 11 micrograms
Calcium 40 milligrams
Magnesium 30 milligrams
Phosphorus 14 milligrams
Morton, J., Fruits of Warm Climates (1987) Miami, FL, pp. 134–142.
2.2.2.3 Acidity
- 22 -
The orange is acidic: its pH levels are as low as 2.9(Sinclair, Walton B.; Bartholomew, E.T.
and Raamsey, R. C. (1945)), and as high as 4.0. (Centers for Disease Control and Prevention
2.2.2.4 Grading
The United States Department of Agriculture (USDA) has established the following grades for
Florida oranges, which primarily apply to oranges sold as fresh fruit: US Fancy, US No. 1 Bright,
US No. 1, US No. 1 Golden, US No. 1 Bronze, US No. 1 Russet, US No. 2 Bright, US No. 2, US
No. 2 Russet, and US No. 3.[58] The general characteristics graded are color (both hue and
uniformity), firmness, maturity, varietal characteristics, texture, and shape. Fancy, the highest
grade, requires the highest grade of color and an absence of blemishes, while the terms Bright,
Grade numbers are determined by the amount of unsightly blemishes on the skin and firmness
of the fruit that do not affect consumer safety. The USDA separates blemishes into three categories:
1. General blemishes: ammunition, buckskin, caked melanose, creasing, decay, scab, split navels,
2. Injuries to fruit: bruises, green spots, oil spots, rough, wide, or protruding navels, scale, scars,
3. Damage caused by dirt or other foreign material, disease, dryness, or mushy condition, hail,
The USDA uses a separate grading system for oranges used for juice because appearance and
texture are irrelevant in this case. There are only two grades: US Grade AA Juice and US Grade a
- 23 -
Juice, which are given to the oranges before processing. Juice grades are determined by three
factors:
2. The amount of solids in the juice (at least 10% solids are required for the AA grade)
(United States Standards for Grades of Florida Oranges and Tangelos (USDA; February,
1997))
2.2.2.5 Harvest
oranges. Current canopy shaker machines use a series of six-to-seven-foot long tines to shake the
tree canopy at a relatively constant stroke and frequency .Normally, oranges are picked once they
2.2.3 Grapefruit
2.2.3.1 Description
The evergreen grapefruit trees usually grow to around 5–6 meters (16–20 ft.) tall, although
they can reach 13–15 m (43–49 ft.). The leaves are glossy dark green, long (up to 15 centimeters
(5.9 in)) and thin. It produces 5 cm (2 in) white four-petaled flowers. The fruit is yellow-orange
skinned and generally an oblate spheroid in shape; it ranges in diameter from 10–15 cm (3.9–5.9
in). The flesh is segmented and acidic, varying in color depending on the cultivars, which include
white, pink and red pulps of varying sweetness (generally, the redder varieties are sweeter). The
- 24 -
1929 US Ruby Red (of the Red blush variety) has the first grapefruit patent. (TexaSweet.
2.2.3.2 History
One ancestor of the grapefruit was the Jamaican sweet orange (Citrus sinensis), itself an
ancient hybrid of Asian origin; the other was the Indonesian pomelo (C. maxima). One story of
the fruit's origins is that a certain "Captain Shaddock brought pomelo seeds to Jamaica and bred
the first fruit. However, it probably originated as a naturally occurring hybrid. (Carrington, Sean;
The hybrid fruit, then called "the forbidden fruit", was first documented in 1750 by a
Welshman, Rev. Griffith Hughes, who described specimens from Barbados in The Natural History
The grapefruit was brought to Florida by Count Odet Philippe in 1823 in what is now
known as Safety Harbor. Further crosses have produced the tangelo (1905), the Minneola tangelo
The grapefruit was known as the shaddock or shattuck until the 19th century. Its current
name alludes to clusters of the fruit on the tree, which often appear similar to grapes. Botanically,
it was not distinguished from the pomelo until the 1830s, when it was given the name Citrus
paradise. Its true origins were not determined until the 1940s. This led to the official name being
An early pioneer in the American citrus industry was Kimball Chase Atwood, a wealthy
entrepreneur who founded the Atwood Grapefruit Co. in the late 19th century. The Atwood Grove
- 25 -
became the largest grapefruit grove in the world, with a yearly output of 80,000 boxes of fruit. It
was there that pink grapefruit was first discovered in 1906.(Hort.purdue.edu. Retrieved 2011-
12-17.)
pigmentation of the fruit with respect to its state of ripeness. The most popular varieties cultivated
today are red, white, and pink hues, referring to the internal pulp color of the fruit. The family of
flavors range from highly acidic and somewhat sour to sweet and tart. Grapefruit mercaptan, a
sulfur-containing terpene, is one of the substances which has a strong influence on the taste and
odor of grapefruit, compared with other citrus fruits.(A. Buettner, P. Schieberle (1999).)
- 26 -
Table (2.3) (continued.)
Calcium 12 milligrams
Magnesium 9 milligrams
Phosphorus 8 milligrams
Dowling, Curtis F.; Morton, Julia Frances (1987). Fruits of warm climates. Miami, FL: J. F.
Washing fruit is a cleaning product designed to aid in the removal process of dirt, wax and
- 27 -
All fresh produce, even organic, can harbor residual pesticides, dirt or harmful microorganisms on
the surface. Vegetable washes may either be a number specially-marketed commercial brands, or
Commercial vegetable washes generally contain surfactants, along with chelating agents,
antioxidants, and other agents. Home recipes are generally dilutions of hydrogen peroxide or
Neither the U.S. Food and Drug Administration nor the United States Department of
Agriculture recommend washing fruits and vegetables in anything other than cold water To date
there is little evidence that vegetable washes are effective at reducing the presence of harmful
microorganisms, though their application in removing simple dirt and wax is not contested.
At mealtime, all firm fruits and vegetables, such as apples, pears, tomatoes, peppers,
cucumbers, and avocados, should be washed in water between 80 and 110°F (that is, slightly warm
water). A vegetable brush will be more efficient at removing surface soil. Produce used in salads,
such as lettuce, radishes, carrots, etc., should be washed in the coldest tap water available to
maintain crispness.
The best method for washing ripe or fragile greens and berry fruits, such as spinach, leaf
lettuce, strawberries, raspberries, blackberries, and blueberries, is to spray with water from a
kitchen sink sprayer. Use a colander so the food can be gently turned as it is sprayed.
- 28 -
2.4.2 Immersion
If a sink sprayer is not available, berries, other soft fruit and leafy greens should be placed in
a wire basket or colander and into a 5 to 8 quart pot of clean water. Move the basket in and out of
the water several times. Change the water until the water remains clear. Don’t soak the food. If
fruit or greens absorb too much water, they will lose flavor, texture, and aroma.
2.5 Drying
Drying fruits is removing water from the external layer of the fruit and it’s performed by natural
Drying inhibits the growth of bacteria, yeasts and mold through the removal of water.
Dielectric drying.
Supercritical drying.
experience. This paper presents an integrating system for grading by considering different
- 29 -
attributes. A fruit color, size detecting, and grading system based on image processing. Weight of
fruit is used as a design metric to find out grading in food processing. For grading using
color and size after capturing the fruit side view image, some fruit characters is extracted by
using detecting algorithms. According to these characters, grading is realized. And for grading
using weight as a parameter the load cell arrangement can be used. Also by using GSM
module the consumer or head office can get the idea about the grading process easily.
Results show that this embedded system has the advantage of high accuracy of grading,
high speed and low cost. This proposed system will have a good prospect of application in fruit
with development in electronic and automobile sector, development in agriculture sector is very
slow. Hence, there is need to come up with some novel techniques so as to fore front the
agriculture sector again. As fruits plays vital role in day to day life, grading of fruits is necessary
in evaluating agricultural produce, meeting quality standards and increasing market value. It
is also helpful in planning, packaging. If the classification and grading is done through manual
techniques, the process will be too slow and sometimes it will be error prone.
Fruit quality attributes such as size, freedom from defects, color, and firmness, can be
measured by a number of different methods. The absolute reference point is the way a consumer
perceives and interprets the quality of fruit. Fruits are delicate materials, so they should be
tested via non-destructive techniques. Classification is vital for the evaluation of agricultural
produce. Fruit size is the most important physical property while color resembles visual
property.
- 30 -
The labors classify based on color, size, weight etc. if these quality measures are mapped
into automated system by using suitable programming language then the work will be faster and
error free.
Here two choices are provided for grading either by color and size or by weight. In
first case we are going to sort circular shaped fruits according color and grading is done
according to size. The proposed automated classification and grading system is designed to
combine three processes such as feature extraction, sorting according to color and grading
according to size. Software development is highly important in this color classification system
and for finding size of a fruit. The entire system is designed over C++ software to inspect the color
and size of the fruit. Here grading can be categories into four ways orange small, orangemedium,
orange big, Green small, green medium, Green big. Similarly here we can grade fruits according
to weight also by considering some reference point for weight measurement, and accordingly
it can be graded as a small or big weight fruit. For the same purpose loadcellarrangement is
required. Here grading can be categories into two ways small weight, medium weight, big weight
and development environment for a visual programming language from National Instruments.
The graphical language is named "G" (not to be confused with G-code). Originally released
for the Apple Macintosh in 1986, LABVIEW is commonly used for data acquisition, instrument
- 31 -
control, and industrial automation on a variety of platforms including Microsoft Windows, various
versions of UNIX, Linux, and Mac OS X. The latest version of LABVIEW is LABVIEW 2014,
LABVIEW includes extensive support for interfacing to devices, instruments, cameras, and other
devices. Users interface to hardware by either writing direct bus commands (USB, GPIB, and
Serial) or using high-level, device-specific, drivers that provide native LABVIEW function nodes
LABVIEW includes built-in support for NI hardware platforms such as CompactDAQ and
Compatriot, with a large number of device-specific blocks for such hardware, the Measurement
and Automation explorer (MAX) and Virtual Instrument Software Architecture (VISA) toolsets.
National Instruments makes thousands of device drivers available for download on the NI
In terms of performance, LABVIEW includes a compiler that produces native code for the
CPU platform. The graphical code is translated into executable machine code by interpreting the
syntax and by compilation. The LABVIEW syntax is strictly enforced during the editing process
and compiled into the executable machine code when requested to run or upon saving. In the latter
case, the executable and the source code are merged into a single file. The executable runs with
the help of the LABVIEW run-time engine, which contains some precompiled code to perform
- 32 -
common tasks that are defined by the G language. The run-time engine reduces compile time and
also provides a consistent interface to various operating systems, graphic systems, hardware
components, etc. The run-time environment makes the code portable across platforms. Generally,
LABVIEW code can be slower than equivalent compiled C code, although the differences often
Many libraries with a large number of functions for data acquisition, signal generation,
mathematics, statistics, signal conditioning, analysis, etc., along with numerous graphical interface
elements are provided in several LABVIEW package options. The number of advanced
mathematic blocks for functions such as integration, filters, and other specialized capabilities
usually associated with data capture from hardware sensors is immense. In addition, LABVIEW
includes a text-based programming component called Math Script with additional functionality for
signal processing, analysis and mathematics. Math Script can be integrated with graphical
programming using "script nodes" and uses a syntax that is generally compatible with MATLAB.
LABVIEW is an inherently concurrent language, so it is very easy to program multiple tasks that
are performed in parallel by means of multithreading. This is, for instance, easily done by
drawing two or more parallel while loops. This is a great benefit for test system automation,
where it is common practice to run processes like test sequencing, data recording, and hardware
interfacing in parallel.
- 33 -
2.6.2 Microsoft Visual Studio
is used to develop computer programs for Microsoft Windows, as well as web sites, web
applications and web services. Visual Studio uses Microsoft software development platforms
such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and
Microsoft Silverlight. It can produce both native code and managed code.
Visual Studio includes a code editor supporting IntelliSense (the code completion
component) as well as code refactoring. The integrated debugger works both as a source-level
debugger and a machine-level debugger. Other built-in tools include a forms designer for
building GUI applications, web designer, class designer, and database schema designer. It
accepts plug-ins that enhance the functionality at almost every level—including adding support
for source-control systems (like Subversion) and adding new toolsets like editors and visual
designers for domain-specific languages or toolsets for other aspects of the software
development lifecycle (like the Team Foundation Server client: Team Explorer).
Visual Studio supports different programming languages and allows the code editor and
debugger to support (to varying degrees) nearly any programming language, provided a
language-specific service exists. Built-in languages include C, C++ and C++/CLI (via Visual
C++), VB.NET (via Visual Basic .NET), C# (via Visual C#), and F# (as of Visual Studio 2010)
Support for other languages such as M, Python, and Ruby among others is available via language
services installed separately. It also supports XML/XSLT, HTML/XHTML, JavaScript and CSS.
- 34 -
2.6.3 Microsoft Visual C++
Microsoft Visual C++ is Microsoft's implementation of the C and C++ compiler and associated
languages-services and specific tools for integration with the Visual Studio IDE. It can compile
either in C mode or C++ mode. For C, it follows the ISO C standard with parts of C99
specification along with MS-specific additions in the form of libraries. For C++, it follows the
ANSI C++ specification along with a few C++11 features. It also supports the C++/CLI
specification to write managed code, as well as mixed-mode code (a mix of native and managed
code). Microsoft positions Visual C++ for development in native code or in code that contains
both native as well as managed components. Visual C++ supports COM as well as the
MFClibrary. For MFC development, it provides a set of wizards for creating and customizing
MFC boilerplate code, and creating GUI applications using MFC. Visual C++ can also use the
Visual Studio forms designer to design UI graphically. Visual C++ can also be used with the
Windows API. It also supports the use of intrinsic functions, which are functions recognized by
the compiler itself and not implemented as a library. Intrinsic functions are used to expose the
SSE instruction set of modern CPUs. Visual C++ also includes the OpenMP (version 2.0)
specification.
Fruits are usually graded according to their quality. Grading process is classifying fruits
according to size, shape, weight, color and ripening stage. Due to the lack of the small grading
machines to fit small farms and higher prices of large grading machines, therefore this study
aimed to design, manufacture and evaluate of a prototype for orange grading based on the fruit
- 35 -
dimensions. The prototype uses different successively operating components, such as
phototransistors and actuators, each performing a specific task. The operating principle
depends on the phototransistor, signal gathering and output circuit for distributing unit. When it
works, the system receives digital signals produced by fruits that shadow the light from a
phototransistor sensor during fruit measuring. After digital signals processed by the electronic
circuit, every fruit’s sizing level is deduced. Then, the system will output switch signals to open
the sorting switches according to fruit size. The prototype was evaluated concerned with three
control factors which were conveyor chain velocity, sphericity percentage of fruit and
stopping time and the affected parameters were grading efficiency, damage percentage and
productivity.
The method used by the farmers and distributors to sort agricultural products is through
traditional quality inspection and handpicking which is time-consuming, laborious and less
efficient.
The maximum manual sorting rate is dependent on numerous factors, including the workers
experience and training, the duration of tasks, and the work environment (temperature, humidity,
noise levels, and ergonomics of the work station). More fundamentally, viewing conditions
(illumination, defect contrast, and viewing distance) must be optimal to achieve maximum
sorting rates.
Attempts to develop automatic produce sorters have been justified mostly by the
inadequacies of manual sorters, but few authors provide results that demonstrate the degree of
- 36 -
manual sorting inefficiencies. Flaws were more accurately identified when the inspector knew
that only one type of flaw was present in the sample. The detectability of each flaw decreased
when the sample contained more than one type of flaw. The authors indicated that different flaws
must be mentally processed separately in a limited amount of time, and that these separate
decisions may interfere with each other when more than one flaw is present in the sample. It was
Geyer and Perry (1982) showed that samples with more than one flaw required a longer
inspection time to achieve similar accuracy than a sample with only one flaw type. It was
thought that inspector would have to search differently types of flaws, and this may have
contributed to the longer inspection time. The increased inspection time improved correct
rejection. The rejection of sound items was blamed on the increased false alarm rate due to more
decision cycles.
More than the ability to discern a defect is required for optimal defect detection. Meyers et al.
(1990) indicated that inspection tasks were complicated by the fact that acceptable defect limits
periodically change. Also, individuals must apply absolute limits to continuous variables, such as
color. In addition to the interpretation of the allowable limits, inspector must be able to see the
defect if they are to reject the produce using a standard peach grading line with uniform spherical
balls, theoretically only 88.7% of the surface area was presented to the inspector when standing
at the side of the conveyor . Actual tests showed that only 82% of the defects on the balls were
made visible to the inspector. The amount of surface area inspected is increased by placing
Many of the decision that are made during manual inspection are based on qualitative
measurements, and Muir et al. (1989) illustrated individual “human sensors” are quite variable
- 37 -
and difficult to calibrate. When qualified inspector were asked to quantify the amount of surface
defect on a fruit (in percentage of the total tuber surface), the values for a single sample ranged
from 10 to 70%. The repeatability of individual inspectors was also very poor. Differences
between two consecutive readings were as high as 40 percentage points in some cases.
Appropriate imagines sensors are more accurate, with a maximum variation of 15 percentage
points.
Rehkugelr and Throop (1976) indicate that a manual sorter was able to remove bruised fruits
from sound fruit with acceptable sorting efficiencies at a rate of approximately 1fruit/s.
Similarly, Stephenson (1976) showed that rates for sorting tomatoes into immature and mature
lots should not exceed 1fruit/s per inspector. A slightly faster rate, 1.2 fruit/s, was identified as
the maximum rate for an inspector to reject 72% of serious defects in oranges. These results
demonstrated the shortfalls of manual inspection and re-enforced the need for a more consistent
grading system. Implementation of automated sorting machines may improve accuracy, decrease
A typical sorting operation consists of a continuous flow of product passing in front of one or
more stationary sorters. Normally, the task of the sorter is to remove items are placed into a flow
to packing areas for lower quality markets. The design of sorting equipment has a considerable
- 38 -
The ability of humans to perceive a visual image depends on both physical and cognitive
factors. Changes in color and intensity of light alter the image received by the eye. The method
of presenting the product to the sorters also has an important effect on perception.
The basic sorting operation has developed over a long period of time. Most design and
operating conditions have been determined by trial and error for parameters such as table width,
A sorting table should be designed at a height that is comfortable for the sorter to reach
product on both sides of the table, and it should be easy to deposit rejects on the appropriate belt.
The design philosophy is to minimize hand movements, to enable rapid location and grading of
items. Hand movements should also occur within a comfortable envelope of space.
Translation speed is the velocity at which products pass the sorter. If the feed rate for
incoming items is constant, then changes in translation speed will vary the amount of product on
the table at any given time. In other words, translation speed controls the number of fruit per
row. If the table rotates the fruit using a static friction drive, then changing translation speed also
varies the rotational speed of the product. Most researchers suggest speeds of 6.5-9.0 meters per
minute.
The quantity of product is often described in terms of product density on the table (kg/m2 or
fruit/m2) or in terms of number of fruit per row. Loading should be regulated to ensure the
- 39 -
sorters are capable of maintaining a desired accuracy, and to ensure that sufficient product can be
handled when incoming quality has a high reject level. Product loading is generally between
To achieve effective sorting, the product must be rotated in front of the sorter. It is desirable
that the fruit is rotated completely at least twice within the immediate field of view. In general,
The most efficient sorting operations require two sorters per table for a line carrying products
with low levels of defects. Sorting productivity is reduced if the sorters stand directly opposite
each another, since they tend to compete for the same product and do not use the full width of the
table.
Computer vision system can simulate human vision to perceive the three dimensional feature
of spatial objects and has partial function of human brain. The system will transfer, translate,
abstract, and identify the perceived information, and consequently work out a decision and then
send a command to carry out expectant task. The simple computer vision system consists of
illuminating chamber, CCD camera, image collecting card and computer. The chamber maintains
an optimal work condition for the camera, namely, keeping a symmetrical and identical
- 40 -
illumination in CCD vision area. CCD camera is an image sensor for capturing image. The
image collecting card abstracts the image and translate video signal into digital image signal. The
computer handles and identifies the digital signal to work out a conclusion and explain.
important study object and a basis of grading in computer vision system. Some color models
should be adopted for evaluating color feature of the fruit surface in color discrimination.
- 41 -
Chapter (3)
- 42 -
3.0 Materials and methods
Due to the lack of information and describincess in weight and surface area of lemon, orange
and grapefruits, experiments were carried out at the department of agricultural and biological
engineering at the faculty of engineering, U.OF.K ., Planimeter, sensitive balance were used to
measure surface area and weight (Fig. 3.1 and Fig. 3.2). The data obtained from the experiment
- 43 -
Table (3.1.1): Lemon weight and surface areas
- 44 -
Table (3.1.3): Grapefruit weight and surface area
1 432.0 242.5832
2 602.5 376.8494
3 884.5 497.0553
4 935.0 554.0117
The first part in the system is the washer it start after elevating the fruit from the feeding tank,
the brushes do the cleaning work and the water coming from the sprinkler.
After that comes the drying part which is composed of conveying rollers and fans to
- 45 -
3.2 Design of the machine component
The machine consist of many component the first one is the feeding tank which designed to feed
the machine by the fruit and it consist of elevator work by electric motor and the tank material is
- 46 -
3.2.2 Calculation of the feeding tank component
If we assumed that the capacity we need from the tank will be 3 tons then
=90cm*60cm= 5400m2
=16200cm2
=1.6200m2
= 1.6200*1 = 1.6200m3
= 1.62/5.14*10-4
= 3164 grapefruits
80
= 6.15 = 6 grapefruit for a row
13
- 47 -
The row width should be more than the half of the grapefruit diameter so it can prevent the fruit
from falling.
P = F *V ………………………… (3.6)
F=w*µ………………….(3.7)
F≡ force KN
W≡ total weight KN
= 1.478 hp ≈ 1.5 hp
- 48 -
Fig (3.2): below shows the feed tank Dimensions
Dimensions
- 49 -
Fig (3.3) below show the feed tank part name
1. Feeding Tank
2. Elevator conveyor
3. Motor
- 50 -
Fig (3.4) below show the three views of the feed tank
- 51 -
3.3.1 The Washer part
The second component of this machine is the washer which receive the
fruit from the feeding tank and wash the fruit using brushers and water
from sprinkler which contact with pipe line from storage tank of water.
Fruit washer
- 52 -
3.3.3.2 Fruit washer parts names
1 Sprinkler holder
2 Sprinklers
3 Pulley case
5 Driven pulley
6 Motor
7 Conveying belt
8 Drain pipe
9 Brushes case
10 Conveying belt
11 Brushes
12 Water reservoir
- 53 -
(3.14) fruit washer parts names
Dimensions
- 54 -
Fig (3.15) fruit washer views
Speed = distance/time……………………….(3.8)
The width of the washer is calculated by assuming there is 4 fruits in the line
In this case we will consider grapefruits since are the larger fruit
Width = 4D+X
Is 120mm
- 55 -
=1.14/2 =1.75sec
.07sec → 1 grapefruit
1.75sec → x grapefruit
X= 1.75/.07= 25 grapefruit
1 grapefruit= 935g
µfor plastic=0.4
- 56 -
Power required from eq. (3.6)
= .8330265*1.14= 0.949647 KW
= .949647*1.341=1.27 HP
Dimensions
3
0
0
2000mm
4 1800mm 1
5 220mm
5
m 0
5
4
6 8 0
0 0 m
0
1 220mm 400mm
0
0 5m
0 2m
50 mm
0
- 57 -
3.3.3 Dryer design and calculation
Name Dryer
- 58 -
3.3.3.2 Dryer parts names
- 59 -
3.3.3.3 Dryer views
Views
- 60 -
3.3.3.4 Fruit dryer calculations
V =1.14m/sec
W= using eq.(3.10)
WT=23.375+85.174=108.549kg
=1.14 * .6871456=.783345984 KW
.783345984*1.341 =1.05047 HP
- 61 -
Fans calculations:
𝑸
T * Hfg * w = * (Ta –Tw) *Cp ……………………………….. (3.11)
𝑽
T≡ time used for drying Hfg≡ enthalpy for the drying air
W ≡ water content on the surface area of the product Q ≡ air flow (Kg/sec)
V ≡ specific volume for the air of the fans Ta≡ air flow temperature (ᵒC)
Tw ≡ the washing water temperature (ᵒC) Cp≡ specific heat (J/w. ᵒc)
T = 0.7 sec
W = weight of the surface water = weight of washed fruit - weight of dry fruit
Ta= 35 ᵒc
Tw = 30 ᵒc
Cp = 4.168 kj/kg. ᵒk
𝑷
𝝓= ……………… … (3.12)
𝑷𝒔
- 62 -
Ps from saturated pressure tables when Ta= 35 ᵒc
Ps = 5.643 Kpa
V = .872 m3 / kgda
𝑄
.7 * 2418.62 * 1.87 = .872 * 5 * 4.163
Q = 132.63 m3/sec
- 63 -
3.3.3.5 Fruit dryer dimensions
Dimensions
- 64 -
3.3.4 Color sorter design and calculation
- 65 -
Table (3.13): the color sorter parts
- 66 -
Views
- 67 -
3.3.4.2 Color sorter calculations
Time used in this operation for processing and analysis of the image is estimated to be 70msec
(70/1000) sec
To calculate the number of fruit moving in the belt Speed of the belt /length of
the part
Speed = 1.14m/sec
1.5/1.14 =1.3sec
Which is time required to move the fruit from the beginning of the part till it’s end
.07sec → 1 fruit
- 68 -
WT= 17.765+.3694 = 18.134kg
= .204579*1.14 = 0.23322 KW
=0.23322*1.341 = 0.3127 hp
- 69 -
Dimension
- 70 -
the color sorter part which is consist of camera and lights and the control unit which is
works by Microsoft visual studio (C++) , and according to the code of the (C++)(appendix(A.1))
the camera starts to track and determine the color of the fruits and send a signal to the micro
- 71 -
After the image processing part there is the motion detector and the pusher.
The detector is composed of laser facing a mirror when unwanted fruit cut the flow of the laser it
The pusher system is consist of a compressor connected with a piston to eject the unwanted
- 72 -
The capacity estimated from color sorter depends on many factors one of them is the type of
processing camera, the more the camera accuracy increased the more pixels are in the image
which it take longer time for processing, so in the need to increase or to decrease the capacity,
- 73 -
3.3.5 Size grader
- 74 -
3.3.5.2 Size grader parts names
1 Tapered rollers
2 Slide
3 Gates
4 Transmition gears
5 Conveying belt
6 Motor
7 Packaging boxes
8 Roller holder
- 75 -
3.3.5.3 Size grader views
Views
- 76 -
3.3.5.4 Size grader calculation
Since the length of this part is equal to the previous part then the same amount of
WT = 24.80368+17.765= 42.56868 kg
=0.38085*1.341= 0.5107 HP
- 77 -
3.3.5.5 Size grader dimensions
Views
- 78 -
In this last part of the machine (size grader) a servo motor is connected to separation gates to
actuate them
- 79 -
Chapter (4)
- 80 -
4.0 Results and discussion
After designing the machine the resulted dimensions and requirement are discussed below
Area 1.6200m2
Volume 1.6200m3
Capacity 3164 grapefruits
Length 1.800 m
Width 1.500 m
Height 2.500 m
Velocity 1.140 m
Power 1.500 hp.
Elevator conveyor width 0.800 m
- 81 -
4.1.2 Washer specification
Length 2.000 m
Width 0.600 m
Height 1.560 m
Velocity 1.140 m/s
Power 1.270 hp.
Space between sprinklers 0.220 m
Sprinklers length 0.045 m
Water reservoir length 1.000 m
Water reservoir diameter 0.500 m
Brushes height 0.040 m
Roller diameter 0.052 m
Weight of all rollers + brushes 741.30 kg
Time of taking and analyzing a fruit 0.070sec
Length 2.000 m
Width 0.600 m
Height 1.500 m
- 82 -
4.1.4 Color sorter specification
Table (4.4) dimensions of the washer part
Length 1.500 m
Width 1.080 m
Height 0.950 m
Velocity 1.140 m/s
Power 0.313 hp.
Length 1.50 m
Width 1.10m
Height 1.10 m
Power 0.510hp
- 83 -
Table (4.8) : Estimated cost for the system
Water hoes 1m 20 1 20
Small Piston 150 1 150
Camera 180 1 180
Washer Rollers 1000 8 8000
Dryer rollers 1000 10 10,000
Size sorting rollers 1000 2 2000
Chase 1400 _ 1400
Lights 14 3 42
Motor pulleys 150 4 600
∑ = 31,382 SDG
4.2 Discussion
This machine has been designed to meet the market demands in sorting fruits’ operation for
domestic consumption and exporting, every part or stage does specific operation from the feed
tank, washing, color sorting and size grading of fruit considering the color sorter the basic unit in
- 84 -
the system. Compared to manual sorting this system has saved time, effort and high sorting
accuracy.
The estimated capacity in this study and this design could be used for costumers or
In this case the only solution is to duplicate the number of the basic units for sorting which in
this case is the image processing unite to raise the production rate of the machine and to raise the
- 85 -
Chapter (5)
- 86 -
5.0 Conclusion and recommendation
5.1 Conclusion
1.
The average weight of Lemon, orange and grapefruit = 41.11gm, 185.33gm, 713.5gm
respectively. And the standard deviationfor weight of lemon, orange and grapefruit
=15.4011 cm2, 56.48gm, 237.9 cm2 respectively. The average value of surface area of
standard deviation for surface area of lemon, orange and grapefruit =24.02cm2, 29.86 cm2,
138.09cm2 respectively.
2. 3ton capacity washing, sorting and grading of lemon, orangeand grapefruit system was
successfully designed.
3. The system consist of feeding unit, washing, sorting and grading unit. .
5.2 Recommendation
1. Fabrication, testing and evaluating of the proposed system components need to be
carried out.
2. Packaging system need to be designed to the proposed system.
3. To study the possibility of applying the system for sorting and grading other types of
fruits.
5. The sorting component in the system is critical in determining the system capacity, so a
- 87 -
References
- 88 -
References:
1. "6 ingredients for a green, clean home". Shine. Retrieved April 24, 2008.
2. "Building a Stand-Alone Application". National Instruments.
3. "Case 3: Naval Medicine: The Fight against Scurvy". King's College at London.
4. "Complete List of Four Winds Dwarf Citrus Varieties". Fourwindsgrowers.com.
Retrieved June 6, 2010.
5. "Lemon Power". California Energy Commission. Retrieved December 7, 2014.
6. "New Zealand Citrus". Ceventura.ucdavis.edu. Retrieved June 13, 2010.
7. "Production of Lemon and Limes, by Countries". UN Food & Agriculture Organization.
2011. Retrieved January 29, 2015.
8. "Taste of a thousand lemons". Los Angeles Times. September 8, 2004. Retrieved
November 21, 2011.
"Using the Lab VIEW Run-Time Engine". National Instruments.
9. 9 Ohio State University Research, March 3, 2008 Study is published in the March 2008
issue of the journal Psych neuroendocrinology.
10. 9.http://www.ext.colostate.edu/pubs/foodnut/09380.html Fonseca, J.M., &Ravishankar,
11. a b c Gerald M. Sapers; James R. Gorny; Ahmed Elmeleigy Yousef (29 August 2005).
Microbiology Of Fruits And Vegetables. CRC Press. p. 393. ISBN 978-0-8493-2261-7.
12. American Scientists95: 494-501.
13. bcd "The origins". limmi.it.
14. b Wright, A. Clifford. "History of Lemonade". CliffordAWright.com.
15. Buchan, Ursula (January 22, 2005). "Kitchen garden: lemon tree". The Daily
Telegraph (London). Retrieved January 24, 2014.
16. Calque, Otto (2006) [1923]. Rational Diet: An Advanced Treatise on the Food
Question. Los Angeles, California: Kissinger Publishing. p. 195. ISBN 978-1-4286-4244-
7. Retrieved March 2, 2012.
17. Douglas Harper. "Online Etymology Dictionary".
18. Embedding a C/C++ Interpreter Ch into LabVIEW for Scripting.
- 89 -
19. Gerald M. Sapers; Ethan B. Solomon; Karl R. Matthews (28 May 2009). The Produce
Contamination Problem: Causes and Solutions. Academic Press. pp. 405–406. ISBN 978-
0-12-374186-8.
20. Gulsen, O.; M. L. Roose (2001). "Lemons: Diversity and Relationships with Selected
Citrus Genotypes as Measured with Nuclear Genome Markers". Journal of the American
Society of Horticultural Science 126: 309–317.
21. Harshavardhan G. Naganur, Sanjeev S. Sannakki, Vijay S Rajpurohit, Arunkumar R,
“Fruits Sorting and Grading using Fuzzy Logic,” International Journal of Advanced
Research in Computer Engineering & Technology (IJARCET) Volume 1, Issue 6,
August 2012,pp 117-122.
22. Hongshe Dang, Jinguo Song, Qin Guo, “A Fruit Size Detecting and Grading System
Based on Image Processing,” 2010 Second International Conference on Intelligent
Human-Machine Systems and Cybernetics,pp83-86.
23. http://www.ni.com/white-paper/5920/en/
24. https://decibel.ni.com/content/docs/DOC-13859
25. J. V. Frances, J. Calpe, E. Soria, M. Martinez, A. Rosado, A.J. Serrano, J. Calleja, M.
Diaz, “Application of ARMA modeling to the improvement of weight estimations in fruit
sorting and grading machinery,” IEEE 2000, pp 3666-3669.
26. James Lind (1757). A treatise on the scurvy. Second edition. London: A. Millar.
27. John B. Njoroge. Kazunori Ninomiya. Naoshi Kondo and Hideki Toita, “Automated
Fruit Grading System using Image Processing,” The Society of Instrument and
Control Engineers(SICE2002), Osaka, Japan, August 2002, pp 1346-1351.
28. Julia F. Morton (1987). "Fruits of warm climates". Purdue University. pp. 160–168.
29. Lemon Myrtle
30. M. Hofrichter (2010). Industrial Applications. Springer. p. 224. ISBN 978-3-642-11458-
8.
31. NI Instrument Driver Network
32. Palumbo, M.S., Gorny, J.R., Gombas, D.E., Beuchar, L.R., Bruhn, C.M., Cassens, B.,
Delaqauis, P., Farber, J.M., Harris, L.J., Ito, K., Osterholm, M.T., Smith, M., & Swanson,
K.M.J. 2007. Recommendations for handling fresh-cut leafy green salads by consumers
and retail foodservice operators. Food Protection Trends27:892-898.
- 90 -
33. Rauf A, Uddin G, Ali J (2014). "Phytochemical analysis and radical scavenging profile of
juices of Citrus sinensis, Citrus anrantifolia, and Citrus limonum". Org Med
ChemLssett 7 (4): 5. Doi: 10.1186/2191-2858-4-5. PMC 4091952. PMID 25024932.
34. Robin Lane Fox, The Unauthorized Version, 1992:116.
35. S. 2007. Safer Salads.
36. Spalding, William A. (1885). The orange: its culture in California. Riverside,
California: Press and Horticulturist Steam Print. p. 88. Retrieved March 2, 2012.
37. Spolsky, Joel. "Why are the Microsoft Office file formats so complicated? (And some
workarounds)". Retrieved March 8, 2009.
38. Talmud Bavli Sukkah 48b
39. Variegated pink at the Citrus Variety Collection.
40. Wong Bing Yit, NurBadariah Ahmad Mustafa,Zaipatimah Ali, Syed Khaleel Ahmed,
ZainulAbidinMdSharrif, “Design and Development of a Fully Automated Consumer-
based Wireless Communication System For Fruit Grading”, ISCIT 2009 , pp 364-369.
41. Yang, H., Kendall, P., Medeiros, L., &Sofos, J. Inactivation of Listeria monocytogenes,
Escherichia coliO157:H7, and SalmonellaTyphimurium with compounds available in
households. 13 .J Food Prot72 (6):12-1-1208.
42. Zander, A. "Washing Fruits and Vegetables." Colorado State University Cooperative
Extension, Boulder County. June 30, 2000.
- 91 -
Appendix
- 92 -
Appendix A
A.1 Code used in Microsoft visual studio for color
detecting
#define _CRT_SECURE_NO_DEPRECATE
#include<sstream>
#include<string>
#include<iostream>
#include<opencv\highgui.h>
#include<opencv\cv.h>
usingnamespace cv;
voiddrawObject(int x, int y, Mat &frame);
voidOrangeDetected(Mat &cameraFeed,intx,int y)
{
putText(cameraFeed, "Orange Object", Point(0, 50), 2, 1, Scalar(0, 255, 0), 2);
//draw object location on screen
drawObject(x, y, cameraFeed);
- 93 -
//these will be changed using trackbars
//oRANGE
int H_MIN = 0;
int H_MAX = 100;
int S_MIN = 114;
int S_MAX = 193;
int V_MIN = 110;
int V_MAX = 256;
//GREEN
int H_MIN1 = 47;
int H_MAX1 = 109;
int S_MIN1 = 61;
int S_MAX1 = 205;
int V_MIN1 = 75;
int V_MAX1 = 177;
// YELLOW
int H_MIN2 = 0;
int H_MAX2 = 256;
int S_MIN2 = 0;
int S_MAX2 = 256;
int V_MIN2 = 0;
int V_MAX2 = 256;
voidon_trackbar(int, void*)
- 94 -
{//This function gets called whenever a
// trackbar position is changed
}
stringintToString(int number){
std::stringstreamss;
ss<< number;
returnss.str();
}
voidcreateTrackbars(String trackbarWindow)
{
//create window for trackbars
if(trackbarWindow.compare(trackbarWindowName)==0)
{
NamedWindow(trackbarWindowName, 0);
//create memory to store trackbar name on window
charTrackbarName[50];//Orange
sprintf(TrackbarName, "H_MIN", H_MIN);
sprintf(TrackbarName, "H_MAX", H_MAX);
sprintf(TrackbarName, "S_MIN", S_MIN);
sprintf(TrackbarName, "S_MAX", S_MAX);
sprintf(TrackbarName, "V_MIN", V_MIN);
sprintf(TrackbarName, "V_MAX", V_MAX);
//create trackbars and insert them into window
//3 parameters are: the address of the variable that is changing when the trackbar is
moved(eg.H_LOW),
//the max value the trackbar can move (eg. H_HIGH),
//and the function that is called whenever the trackbar is moved(eg. on_trackbar)
// ----> ----> ---->
createTrackbar("H_MIN", trackbarWindowName, &H_MIN, H_MAX,
on_trackbar);
createTrackbar("H_MAX", trackbarWindowName, &H_MAX, H_MAX,
on_trackbar);
createTrackbar("S_MIN", trackbarWindowName, &S_MIN, S_MAX,
on_trackbar);
createTrackbar("S_MAX", trackbarWindowName, &S_MAX, S_MAX,
on_trackbar);
- 95 -
createTrackbar("V_MIN", trackbarWindowName, &V_MIN, V_MAX,
on_trackbar);
createTrackbar("V_MAX", trackbarWindowName, &V_MAX, V_MAX,
on_trackbar);
}
elseif(trackbarWindow.compare(trackbarWindowName1)==0)
{
namedWindow(trackbarWindowName1, 0);//green
//create memory to store trackbar name on window
charTrackbarName[50];
sprintf(TrackbarName, "H_MIN1", H_MIN1);
sprintf(TrackbarName, "H_MAX1", H_MAX1);
sprintf(TrackbarName, "S_MIN1", S_MIN1);
sprintf(TrackbarName, "S_MAX1", S_MAX1);
sprintf(TrackbarName, "V_MIN1", V_MIN1);
sprintf(TrackbarName, "V_MAX1", V_MAX1);
//create trackbars and insert them into window
//3 parameters are: the address of the variable that is changing when the trackbar is
moved(eg.H_LOW),
//the max value the trackbar can move (eg. H_HIGH),
//and the function that is called whenever the trackbar is moved(eg. on_trackbar)
// ----> ----> ---->
createTrackbar("H_MIN1", trackbarWindowName1, &H_MIN1, H_MAX1,
on_trackbar);
createTrackbar("H_MAX1", trackbarWindowName1, &H_MAX1, H_MAX1,
on_trackbar);
createTrackbar("S_MIN1", trackbarWindowName1, &S_MIN1, S_MAX1,
on_trackbar);
createTrackbar("S_MAX1", trackbarWindowName1, &S_MAX1, S_MAX1,
on_trackbar);
createTrackbar("V_MIN1", trackbarWindowName1, &V_MIN1, V_MAX1,
on_trackbar);
createTrackbar("V_MAX1", trackbarWindowName1, &V_MAX1, V_MAX1,
on_trackbar);
}
elseif(trackbarWindow.compare(trackbarWindowName2)==0)
{
namedWindow(trackbarWindowName2, 0);
//create memory to store trackbar name on window
charTrackbarName[50];
sprintf(TrackbarName, "H_MIN2", H_MIN2);
sprintf(TrackbarName, "H_MAX2", H_MAX2);
sprintf(TrackbarName, "S_MIN2", S_MIN2);
sprintf(TrackbarName, "S_MAX2", S_MAX2);
sprintf(TrackbarName, "V_MIN2", V_MIN2);
sprintf(TrackbarName, "V_MAX2", V_MAX2);
- 96 -
//create trackbars and insert them into window
//3 parameters are: the address of the variable that is changing when the trackbar is
moved(eg.H_LOW),
//the max value the trackbar can move (eg. H_HIGH),
//and the function that is called whenever the trackbar is moved(eg. on_trackbar)
// ----> ----> ---->
createTrackbar("H_MIN2", trackbarWindowName2, &H_MIN2, H_MAX2,
on_trackbar);
createTrackbar("H_MAX2", trackbarWindowName2, &H_MAX2, H_MAX2,
on_trackbar);
createTrackbar("S_MIN2", trackbarWindowName2, &S_MIN2, S_MAX2,
on_trackbar);
createTrackbar("S_MAX2", trackbarWindowName2, &S_MAX2, S_MAX2,
on_trackbar);
createTrackbar("V_MIN2", trackbarWindowName2, &V_MIN2, V_MAX2,
on_trackbar);
createTrackbar("V_MAX2", trackbarWindowName2, &V_MAX2, V_MAX2,
on_trackbar);
}
}
voiddrawObject(int x, int y, Mat &frame){
- 97 -
putText(frame, intToString(x) + "," + intToString(y), Point(x, y + 30), 1, 1, Scalar(0,
255, 0), 2);
}
voidmorphOps(Mat &thresh){
//create structuring element that will be used to "dilate" and "erode" image.
//the element chosen here is a 3px by 3px rectangle
- 98 -
{
Moments moment =
moments((cv::Mat)contours[index]);
double area = moment.m00;
YellowDetected(cameraFeed,x,y);
- 99 -
}
- 100 -
//filter HSV image between values and store filtered image to
//threshold matrix
inRange(HSV, Scalar(H_MIN, S_MIN, V_MIN), Scalar(H_MAX, S_MAX,
V_MAX), threshold);//orange
inRange(HSV, Scalar(H_MIN1, S_MIN1, V_MIN1), Scalar(H_MAX1, S_MAX1,
V_MAX1), threshold1);//green
inRange(HSV, Scalar(H_MIN2, S_MIN2, V_MIN2), Scalar(H_MAX2,
S_MAX2, V_MAX2), threshold2);//yellow
}
//pass in thresholded frame to our object tracking function
//this function will return the x and y coordinates of the
//filtered object
if (trackObjects)
{
trackFilteredObject(x, y, threshold,threshold1,threshold2,
cameraFeed);
//trackFilteredObject(x, y, threshold1, cameraFeed);
//trackFilteredObject(x, y, threshold2, cameraFeed);
//show frames
imshow(windowName1, threshold);
imshow(windowName2, threshold1);
imshow(windowName3, threshold2);
imshow(windowName, cameraFeed);
- 101 -
return 0;
}
- 102 -