Sunteți pe pagina 1din 103

‫بسم هللا الرحمن الرحيم‬

University of Khartoum
Faculty of Engineering
Agricultural and Biological
Engineering Department

Design of sorting, and grading system for citrus


fruits based on machine vision

A Thesis Submitted in Partial Fulfillment of the Requirement for the Degree of


B.Sc. in Agricultural and Biological Engineering

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

To our families who enlightened our way through Day


and night,

To our great friends whom we shared with the brilliant


road of light,

To our mentors who gave us the lucid knowledge and


honorable sight

We dedicate these thesis for their honor, blessing, and


supportive might

-1-
Table of contents

CHAPTER 1:

1.1 Introduction………..……………………..……………………………….………………9

1.2 Objectives of the study…………………………………………..……………………….11

CHAPTER 2:

2.1 Sorting terminology…………………...………………...…………….…………………13

2.2 Fruit properties………………………………………….………………………………14

2.2.1 Lemon …………………………………….……………………………………………14

2.2.1.1Lemon varieties ……………………………..…..……………………………………14

2.2.1.2 Industrial uses of lemon…………………………………..…………………………15

2.2.1.3 Lemon as cleaning agent ..………………………………….…………….…………15

2.2.1.4 Uses of Lemon in Medicine………..…………….………………..…………………16

2.2.1.5 Nutritional value and photochemical…………………..………………………..…16

2.2.2 Orange……………………………..……..…………………….………………………18

2.2.2.1 Orange Varieties………………………………………..……………………………18

2.2.2.1.1 Valencia orange……..…………………………………..…………………………18

2.2.2.1.2 Hart’s Tardif Valencia……………………………………………..……...………18

2.2.2.1.3 Hamlin……..………………………………..………………………………...……19

2.2.2.1.4 Navel oranges………………..………………………..……………………………19

2.2.2.1.5 Blood oranges ………………………………………..……………………………20

2.2.2.1.6 Acidless oranges…………………………………………..……………………….20

2.2.2.2 Nutritional value and phytochemicals…………………………………………..…20

2.2.2.3 Acidity……………………………………..…………………………………………22

-2-
2.2.2.4 Grading……………………………………..……………………………………….22

2.2.2.5 Harves……………………………………..…………………………………………23

2.2.3 Grapefruit ………………………………………………………………..……..…….23

2.2.3.1 Description…………………………………………………………………………..23

2.2.3.2 History……………………………………………………………………………….24

2.2.3.3 Colors and flavors………………………………………..…………………………25

2.2.3.4 Nutritional value and phytochemicals……………….……………………..…..…25

2.3 Fruits washing ………………………………………………………………………….26

2.3.1 Washing water temperature………………………..………………..………………27

2.4 washing methods …………………………………....………………………………….27

2.4.1 Spray washing……………………...……………..…………………………………..27

2.4.2 Immersion…………………………………..…………………………………………28

2.5 Drying………………………………..………………………………………………….28

2.5.1 Methods of drying……………………………………..……………………………..28

2.6 Color sorting…………………………………..………………………………………..28

2.6.1 Laboratory Virtual Instrument Engineering Workbench (LABVIEW) …………30

2.6.1.1 Benefits of LABVIEW……………………………………..……………..…………31

2.6.1.1.1 Interfacing to Devices………………………………………..……………………31

2.6.1.1.2 Code compilation……………………….……………..………………..…………31

2.6.1.1.3 Large libraries………………...…………………..……………………….………32

6.1.1.4 Parallel programming…...…………………………………..………………………32

2.6.2 Microsoft Visual Studio……..………………………………..………………….……33

2.6.3 Microsoft Visual C++……….……………………………..………………………..…34

2.7 Size grading of fruits……………………………..……..………………………………34

-3-
2.8 Manual sorting…………………………………..……………………………………….35

2.8.1 Manual inspection…...………………………………..………………………………..35

2.8.2 Manual sorting equipment………………………………………..……………………37

2.8.3 Sorting table size…………………..………………..…………………………………..38

2.8.4 Translation speed…………..………………………..…………………………….……38

2.8.5 Product feeding for manual sorting …………………………………………..………38

2.8.6 Fruit rotational speed during manual sorting……………………………………..…39

2.8.7 Sorter position………………………………………………………..……….………..39

2.9 Automatic grading of fruit……………………………………...………….……………39

2.9.1 Fruit color detection……………………………………………………………………40

CHAPTER 3:

3.1Physical properties of Lemon, Orange and Grapefruit…………………………………42

3.2 Design of the machine component…………………………………….………………….45

3.2.1 Feeding tank…………………………………………………………..…………………45

3.2.2 Calculation of the feeding tank component …………………………………………...46

The Washer part …………………………………………………..…………………….……52

3.3.1.1 Fruit washer design …………………………………………………….……...…..…52

3.3.3.2 Fruit washer parts names……………………………………………………………..53

3.3.3.3 Fruit washer views ……………………………………………………………………54

3.3.3 The calculation of the washer component …………………………………………….55

3.3.3 Dryer design and calculation ………………………………………………………….58

3.3.3.1 Dryer design ………………………………………………………………………….58

3.3.3.2 Dryer parts names ……………………………………………………………...……59

-4-
3.3.3.3 Dryer views ………………………………………………………………….…60

3.3.3.4 Fruit dryer calculations …………………………………………………….…61

3.3.3.5 Fruit dryer dimensions …………………………………………………….….64

3.3.4 Color sorter design and calculation ……………………………………………65

3.3.4.1 Color sorting design ……………………………………………………..……65

3.3.4.2 Color sorter calculations …………………………………………………..….68

3.3.5 Size grader ………………………………………………..……………….…….74

3.3.5.1 Size grader design ……………………………………….……….……………74

3.3.5.2 Size grader parts names ………………………………………………………77

3.3.5.3 Size grader views ……………………………………...…………….…………76

3.3.5.4 Size grader calculation …………………………………...……………………77

3.3.5.5 Size grader dimensions………………………….……..………………………78

CHAPTER 4:

4.1 Machine parts specification …………………………..…..………………………80

4.1.1 Feed tank specification.………………..……………..……………………….…80

4.1.2 Washer specification……………………………..………………………………81

4.1.3 Dryer specification……...……………………..…………………………………81

4.1.4 Color sorter specification………………………………..……………………….82

4.1.5 Size sorter specification……...………………………..………………………….82

4.2 Discussion…………………………..………………………………………………..83

CHAPTER 5:

5.1 Conclusion ………………………..…………………………………………………86

5.2 Recommendation….………………………..……………………………………….86

-5-
References ………………………..……..…………………………………………... 87

APPENDIX

A.1 Code used in Microsoft visual studio for color detecting……………………….92

-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

with 3 ton/hr. capacity were successfully designed.

-7-
‫الخالصة‬

‫غسل وفرز وتصنيف الفاكهة تزيد من جودتها الشيء الذي يؤدي الى رضا المنتج والمستهلك على حد سواء‬

‫لذا اي نظام مستخدم يشمل العمليات السابقة يعتبر نظام ذو قيمة عالية‪ .‬المغزى من هذه الدراسة هو تصور‬

‫تصميم لنظام فرز للفواكه الحمضية‪.‬لتصميم نظام بالكفاءة المذكورة كان البد من قياس وزن ومساحة سطح‬

‫الفواكه المعنية‪ .‬اجريت تجارب في قسم الهندسة الزراعية والبيولوجية جامعة الخرطوم ووجدت نتائج اوزان‬

‫ومساحة سطح الليمون بين )‪ (22.5-65‬جرام لألوزان و )‪ (32-109‬سم مربع لمساحة سطح الليمون ‪ ,‬وايضا‬

‫(‪ )142-201‬جرام و(‪ )262- 88‬سم مربع للبرتقال ‪ ,‬و(‪ )539-431‬جرام و(‪) 949.02-141.6‬سم مكعب‬

‫للقريب فروت ‪ .‬باستخدام النتائج المتحصل عليها ألوزان ومساحة سطح البرتقال والليمون والقريب فروت تم‬

‫وضع تصور تصميم نظام لغسل وفرز وتصنيف الفاكهة قيد التجربه ‪.‬‬

‫صمم نظام يحوي وحدة غسل ووحدة فرز باستخدام نظام لتحليل الصور ووحدة لتصنيف االحجام بنجاح بسعة‬

‫انتاجية تقدر ب‪ 3‬طن‪/‬الساعة ‪.‬‬

‫‪-8-‬‬
Chapter (1)

-9-
1.0 Introduction

1.1 Introduction

(Post-harvest) process of fruits and vegetables is completed in several steps: washing,

sorting, grading, packing, transporting and storage. The fruits sorting and grading are considered

the most important steps of handling.

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

can be used to remove spoiled fruits from fresh product.

Sorting is any process of arranging items systematically, and has two common, yet distinct

meanings:

1. Ordering: arranging items in a sequence ordered by some criterion;

2. Categorizing: grouping items with similar properties.

Sorting of agricultural products is accomplished based on appearance (color and absence

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

be achieved with automated sorting.

- 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

and projected areas are the most important.

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

other parts of postharvest supply chains.

- 11 -
1.2 Objectives of the study

The objectives of the study are:

1) To determine the properties of Lemon, Orange and Grapefruit.

2) To design a machine for washing, sorting and grading lemon, orange and grapefruit.

- 12 -
Chapter (2)

- 13 -
2.0 Literature review

2.1 Sorting terminology

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

tactical).(Stanley E. Prussia Academic Press, 9 Apr 2014)

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

blemishes and foreign / unwanted objects.

For size sorting, various types of screens and sieves, with fixed or variable apertures, can

be used. The screens may be stationary, rotating or vibrating.

Shape sorting can be accomplished manually or mechanically withmachines, for example, a

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.

surface defects and orientation of fruits on a conveyor.

- 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 Fruit properties

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

juice to their diets, though vitamin C was not yet known.

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”).

(Julia F. Morton (1987).

2.2.1.1Lemon varieties

The 'Bonnie Brae' is oblong, smooth, thin-skinned, and seedless mostly grown in San Diego

County. (Spalding, William A. (1885))

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

(Fourwindsgrowers.com. Retrieved June 6, 2010).

The 'Femminello St. Teresa', or 'Sorrento is native to Italy. This fruit's zest is high in lemon

oils. It is the variety traditionally used in the making of Limon cello.

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

very large. It is likely a citron-lemon hybrid.(Ceventura.ucdavis.edu. Retrieved June 13, 2010.)

2.2.1.2 Industrial uses of lemon

Lemons were the primary commercial source of citric acid before the development of

fermentation-based processes.(M. Hofrichter (2010)

2.2.1.3 Lemon as cleaning agent:

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

orange oil are also used as a nontoxic insecticide treatment.

A halved lemon is used as a finger moistener for those counting large amounts of bills,

such as tellers and cashiers.(Shine. Retrieved April 24, 2008.)

2.2.1.4 Uses of Lemon in Medicine

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

University Research, March 3, 2008)

2.2.1.5 Nutritional value and photochemical

Table (2.1) the chemical components of lemon

Nutritional value per 100 g

Energy 121 kilojoule

Sugars 2.5 grams

Dietary fiber 2.8 grams

Fat .3 grams

Table (2.1) (continued)

- 17 -
Protein 1.1 grams

Thiamine (B1) .04 milligrams

Riboflavin (B2) .02 milligrams

Niacin (B3) .1 milligrams

Pantothenic acid (B5) .19 milligrams

Vitamin (B6) .08 milligrams

Folate (B9) 11 micrograms

Choline 5.1 milligrams

Vitamin C 53 milligrams

Calcium 26 milligrams

Iron .6 milligrams

Magnesium 8 milligrams

Manganese .03 milligrams

Phosphorus 16 milligrams

Potassium 138 milligrams

Zinc .06 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.

Other essential nutrients, however, have insignificant content.

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

70% of citrus production.

In 2013, 71.4 million metric tons of oranges were grown worldwide, production being

highest in Brazil and the U.S. states of Florida and California.

2.2.2.1 Orange Varieties

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.

2.2.2.1.1 Valencia orange

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

colors of the Spanish national football team.

2.2.2.1.2 Hart’s Tardif Valencia

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.

(Coit, John Eliot (1915))

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))

2.2.2.1.4 Navel oranges

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

November to April, with peak supplies in January, February, and March.

2.2.2.1.5 Blood oranges

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

2.2.2.1.6 Acid less oranges

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

Brazil. (Kimball, Dan A. (June 30, 1999).)

2.2.2.2 Nutritional value and phytochemicals

Table (2.2) chemical component of orange

Energy 197 kilojoule


Carbohydrates 11.75 grams
Sugars 9.35 grams
Dietary fiber 2.4 grams
Fat 0.12 grams

Table (2.2) (continued)

- 21 -
Protein 0.94 grams

Vitamin A 11 micrograms

Thiamine (B1) 0.087 milligrams

Riboflavin (B2) 0.04 milligrams

Niacin (B3) 0.282 milligrams

Pantothenic acid (B5) 0.25 milligrams

Vitamin (B6) 0.06 milligrams

Folate (B9) 30 micrograms

Choline 8.4 milligrams

Vitamin C 53.2 milligrams

Vitamin E 0.18 milligrams

Calcium 40 milligrams

Iron 0.1 milligrams

Magnesium 30 milligrams

Manganese 0.025 milligrams

Phosphorus 14 milligrams

Potassium 181 milligrams

Zinc 0.07 milligrams

Water 86.75 grams

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

(CDC) (July 16, 1999) )

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,

Golden, Bronze, and Russet concern solely discoloration.

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,

spray burn , undeveloped segments, unhealed segments, and wormy fruit

2. Injuries to fruit: bruises, green spots, oil spots, rough, wide, or protruding navels, scale, scars,

skin breakdown, and thorn scratches

3. Damage caused by dirt or other foreign material, disease, dryness, or mushy condition, hail,

insects, riciness or woodiness, and sunburn.

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:

1. The juiciness of the orange

2. The amount of solids in the juice (at least 10% solids are required for the AA grade)

3. The proportion of a hydric citric acid in fruit solids.

(United States Standards for Grades of Florida Oranges and Tangelos (USDA; February,

1997))

2.2.2.5 Harvest

Canopy-shaking mechanical harvesters are being used increasingly in Florida to 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

are pale orange.("Fresh Citrus Direct".)

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.

Retrieved 2 July 2008.)

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;

Fraser, HenryC (2003).)

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

of Barbados. Currently, the grapefruit is said to be one of the "Seven Wonders of

Barbados.(Welchman Hall Gully, Barbados".)

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

(1931), and the oroblanco (1984).

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

altered to Citrus × paradise, the "×" identifying its hybrid origin.

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

2.2.3.3 Colors and flavors

Grapefruit comes in many varieties, determinable by color, which is caused by the

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

2.2.3.4 Nutritional value and phytochemicals

Table (2.3) chemical components of grapefruit

Nutritional value per 100 g

Energy 138 kilojoule

Carbohydrates 8.41 grams

Sugars 7.31 grams

Dietary fiber 1.1 grams

Fat 0.10 grams

Protein 0.69 grams

Thiamine (B1) 0.037 milligrams

- 26 -
Table (2.3) (continued.)

Riboflavin (B2) 0.020 milligrams

Niacin (B3) 0.269 milligrams

Pantothenic acid (B5) 0.283 milligrams

Vitamin (B6) 0.043 milligrams

Folate (B9) 10 micrograms

Choline 7.7 milligrams

Vitamin C 33.3 milligrams

Vitamin E 0.13 milligrams

Calcium 12 milligrams

Iron 0.06 milligrams

Magnesium 9 milligrams

Manganese 0.013 milligrams

Phosphorus 8 milligrams

Potassium 148 milligrams

Zinc 0.07 milligrams

Water 90.48 grams

Dowling, Curtis F.; Morton, Julia Frances (1987). Fruits of warm climates. Miami, FL: J. F.

Morton. ISBN 0-9610184-1-0. OCLC 16947184

2.3 Fruits washing

Washing fruit is a cleaning product designed to aid in the removal process of dirt, wax and

pesticides from fruit and vegetables before they are consumed.

- 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

they may be home recipes.

Commercial vegetable washes generally contain surfactants, along with chelating agents,

antioxidants, and other agents. Home recipes are generally dilutions of hydrogen peroxide or

vinegar, the former of which may be dangerous at high concentrations.

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.

2.3.1 Washing water temperature

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.

2.4 washing methods

2.4.1 Spray washing

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

ventilation or using different types of high power fans.

Drying inhibits the growth of bacteria, yeasts and mold through the removal of water.

2.5.1 Methods of drying

There are many methods of drying such as:

 Application of hot air.

 Indirect or contact drying.

 Dielectric drying.

 Supercritical drying.

 Natural air drying.

2.6 Color sorting

Traditionally, classification and grading is performed based on observations and through

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

quality detecting and grading areas.

Agriculture sector plays an important role in economic development of India. As compared

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

fruit by considering one reference point for weight measurement.

2.6.1 Laboratory Virtual Instrument Engineering Workbench (LABVIEW)

Laboratory Virtual Instrument Engineering Workbench (LABVIEW) is a system-design platform

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,

released in August 2014.

2.6.1.1 Benefits of LABVIEW

2.6.1.1.1 Interfacing to Devices

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

for controlling the device.

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

Instrument Driver Network (ID Net).

2.6.1.1.2 Code compilation

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

lie more with program optimization than inherent execution speed.

2.6.1.1.3 Large libraries

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.

6.1.1.4 Parallel programming

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

Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It

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.

Java (and J#) were supported in the past.

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

2.7 Size grading of fruits

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.

2.8 Manual sorting

2.8.1 Manual inspection

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

also proposed that a speed-accuracy relationship existed.

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

multiple manual graders at both sides of a conveyor.

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

labor costs, and result in a final product free of defects.

2.8.2 Manual sorting equipment

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

effect on efficiency of the sorter in detecting, sorting and grading items.

- 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,

table speed, and number of sorters and speed of product rotation.

2.8.3 Sorting table size

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.

2.8.4 Translation sorting speed

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.

2.8.5 Product feeding for manual sorting

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

three and five fruit per row, irrespective of table width.

2.8.6 Fruit rotational speed during manual sorting

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,

rotational speeds above 50 revolutions per minute are detrimental.

2.8.7 Sorter position

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.

2.9 Automatic grading of fruit

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.

2.9.1 Fruit color detection

Color is extrinsic reflection of intrinsic quality of fruit. Consequently, it becomes an

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

3.1Physical properties of Lemon, Orange and Grapefruit

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

are shown in tables (3.1.1)-(3.1.3)

Fig. (3.1) Sensitive balance Fig. (3.2) Planimeter

- 43 -
Table (3.1.1): Lemon weight and surface areas

Product NO. Weight (g) Surface Area (cm2)


1 22.5 31.921
2 23.0 32.0983
3 27.5 34.83
4 33.5 41.8539
5 41.5 49.9692
6 51.0 59.2722
7 52.0 56.1643
8 55.0 60.9671
9 65.0 109.2206
Average value 41.22222 52.92184
Standard deviation 15.4011 24.0268
Maximum value 65 109.2206
Minimum value 22.5 31.921

Table (3.1.2):Orang weight and surface areas

Product NO. Weight (g) Surface Area (cm2)


1 102.0 87.5196
2 129.0 99.7308
3 198.0 146.6363
4 217.0 140.5476
5 225.0 150.25046
6 241.0 160.7276
Average value 185.3333 130.9021

Maximum value 241.0 160.7276

Minimum value 102.0 87.5196

- 44 -
Table (3.1.3): Grapefruit weight and surface area

Product NO. Weight (g) Surface Area (cm2)

1 432.0 242.5832

2 602.5 376.8494

3 884.5 497.0553

4 935.0 554.0117

Average value 713.5 417.6249

St. deviation 237.9541 138.0975

Maximum value 935.0 554.0117

Minimum value 432.0 242.5832

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

remove the water from the surface of the fruit

- 45 -
3.2 Design of the machine component

3.2.1 Feeding tank

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

iron sheet covered with stainless steel.

The figure (3.1) below view the feed tank

Name Feed tank

- 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

Area of trapezoidal = (B * H) of tringles + (B * w) of rectangular

Area of rectangular = base *width…………………………(3.3)

=90cm*60cm= 5400m2

Total area of trapezoidal = 10800+5400

=16200cm2

=1.6200m2

Volume = area *depth…………………………………… (3.4)

= 1.6200*1 = 1.6200m3

(.083)= 512cm3= 5.12*10-4

Capacity of the tank =V (for tank) /V (for fruit) …………………………(3.5)

= 1.62/5.14*10-4

= 3164 grapefruits

The width of the elevator = 80 cm

And the fruit diameter (grapefruit) = 13 cm

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.

The row width = 𝟏⁄𝟐 *diameter of fruit + X

P = F *V ………………………… (3.6)

P≡ power required for the machine (KW)

F≡ force applied on the machine (KN)

V≡ speed required for the part (m\sec)

Weight of fruits (grapefruits) = 6 * 11 * 953 = 62898 g = 62.898 Kg

Weight of pulleys and conveyor =15019.08 g = 15.01908 kg

F=w*µ………………….(3.7)

F≡ force KN

W≡ total weight KN

µ≡ Coefficient of friction (unit less)

F= (62.898+15.01908)* 9.81*1.15 = 966.92 N = .96692 KN

Using eq. (3.6)

P = 0.96692 *1.14 = 1.10229 KW

= 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

Part NO. NAME of the feed tank part

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

3.3.1.1 Fruit washer design

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

The Figure (3.5) Fruit washer

- 52 -
3.3.3.2 Fruit washer parts names

Part NO. Part Name

1 Sprinkler holder

2 Sprinklers

3 Pulley case

4 Slide for the product

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

3.3.3.3 Fruit washer views

Dimensions

- 54 -
Fig (3.15) fruit washer views

3.3.3 The calculation of the washer component

The washer part length is 2 m

The distance of camera parameter is 8cm

Time of taking and analyzing a fruit is 70msec =.07sec

Speed = distance/time……………………….(3.8)

.08/.07 = 1.14 m/sec

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

D≡ diameter of the grapefruit

X≡ spacing between grapefruits and the edges of the washer

The largest diameter of grapefruits based on the (SSMO)

Is 120mm

Estimating the value needed of x =120mm

(4*120)+120 = 600mm= 60cm

Time of washing 1 fruit = speed of washer / length of washer……………… (3.9)

- 55 -
=1.14/2 =1.75sec

Number of fruits in the washer:

.07sec → 1 grapefruit

1.75sec → x grapefruit

X= 1.75/.07= 25 grapefruit

Power required for the washer:-

To calculate power use eq. of power (3.6)

W=weight of fruits + weight of conveyer ……………….. (3.10)

1 grapefruit= 935g

25 grapefruit = 25 *935 =23375g = 23.375 kg

Weight of 1 roller (steel) + brushes = 74130g = 74.130kg

Weight of all rollers + brushes = 10*74.130 = 741.30 kg

WT= 741.30+23.375 = 764.675kg

Using eq. (3.7) to calculate the force

µfor plastic=0.4

F = 764.675 *9.81 *.4=833.0265 N =.8330265 KN

- 56 -
Power required from eq. (3.6)

= .8330265*1.14= 0.949647 KW

= .949647*1.341=1.27 HP

Fig (3.6) below show the washer dimension

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

3.3.3.1 Dryer design

Name Dryer

Fig (3.10) Dryer design view

- 58 -
3.3.3.2 Dryer parts names

Part NO. Part name


1. Fan
2. Fan holders
3. Driven pulley
4. Conveying belt
5. Motor
6. Conveying rollers

Fig (3.11) dryer parts names

- 59 -
3.3.3.3 Dryer views

Views

Fig (3.12) fruit dryer views

- 60 -
3.3.3.4 Fruit dryer calculations

Same speed in the washer will be applied on the dryer

V =1.14m/sec

And the same weight of fruits

The difference will be on the rollers weight and coefficient of friction

From eq. (3.7)

W= using eq.(3.10)

Weight of fruits = 935 *25 =23375g = 23.375kg

Weight of 1 roller (stainless steel) =8517.4g = 8.5174kg

Weight of 10 rollers = 10 * 8.5174= 85.174 kg

WT=23.375+85.174=108.549kg

µfor stainless steel=0.8

F= 108.549 * 9.81 *.8 =687.1456 N= .6871456 KN

Power by using eq. (3.6)

=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

Hfg= 2418.62 KJ/Kg dry air (from saturated vapor tables)

W = weight of the surface water = weight of washed fruit - weight of dry fruit

Experimentally W = 454.94 - 453.07 = 1.87 g

Ta= 35 ᵒc

Tw = 30 ᵒc

Cp = 4.168 kj/kg. ᵒk

To find the V we need to calculate the relative humidity

𝑷
𝝓= ……………… … (3.12)
𝑷𝒔

P = 101.325 Kpa (1 atm)

- 62 -
Ps from saturated pressure tables when Ta= 35 ᵒc

And from interpolation

Ps = 5.643 Kpa

𝝓 = 101.325/5.643 = 17.95% ≈ 18%

V = from psychometric chart (from ϕ and Ta)

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

Fig (3.13) fruit dryer dimensions

- 64 -
3.3.4 Color sorter design and calculation

3.3.4.1 Color sorting design

Name Image processing

Fig (3.11) color sorter

- 65 -
Table (3.13): the color sorter parts

Part Part Name


NO.
1 Image processing cover
2 Belt conveyor
3 Camera and light case
4 Light source
5 Camera
6 Small Movement motors
7 Camera holder
8 Pusher
9 Slide
12 Motion detector (laser)
11 Control box

Fig (3.12) shows the color sorter parts

- 66 -
Views

Fig (3.13) shows the views of the color sorter

- 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

For power required using eq (3.6)

To calculate force using eq. (3.7)

WT=weight of fruit + weight of rollers

To calculate the number of fruit moving in the belt Speed of the belt /length of

the part

Length of the part = 1.5m

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

1.3 sec → x fruit

X = 1.3/.07 = 18.5 ≈19 fruit

19 *935g (weight of grapefruit) =17765g = 17.765kg

Weight of roller = 184.73 g

Weight of two rollers = 2*184.73=369.46g = 0.36946kg

- 68 -
WT= 17.765+.3694 = 18.134kg

Using eq (3.9) and fond the force = 18.134*9.81*1.15 = 204.579 N = .204579 KN

µFOR rubber =1.15

Using power eq. (3.6) found power

= .204579*1.14 = 0.23322 KW

=0.23322*1.341 = 0.3127 hp

- 69 -
Dimension

Fig (3.14): color sorter 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

controller to control the separation gates.

Fig (3.15) microsoft visual studio (orange tracking )

Fig (3.16) Microsoft visual studio (lemon tracking)

- 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

sends a signal to the pusher to start working.

Fig (3.17) detector

The pusher system is consist of a compressor connected with a piston to eject the unwanted

Or the rotten fruit

Fig (3.18) pneumatic pusher

- 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,

the camera specification and type must be taken into consideration.

- 73 -
3.3.5 Size grader

3.3.5.1 Size grader design

part Name Size sorter

Fig (3.19) size grader parts

- 74 -
3.3.5.2 Size grader parts names

Part NO. Part Name

1 Tapered rollers

2 Slide

3 Gates

4 Transmition gears

5 Conveying belt

6 Motor

7 Packaging boxes

8 Roller holder

Fig (3.20) shows the size grader parts

- 75 -
3.3.5.3 Size grader views

Views

Fig (3.18) size grader views

- 76 -
3.3.5.4 Size grader calculation

Total weight of rollers = 2*12401.84 = 24803.68 g = 24.80368 kg

Since the length of this part is equal to the previous part then the same amount of

fruits is moved throw it which is 19 fruit

Weight of fruits = 19*935= 17.765 kg

Speed of the rollers = 1.14m/sec

µFOR STAINLESS STEEL =0.8

WT = 24.80368+17.765= 42.56868 kg

Using eq. (3.7) to calculate the force

= 42.56868 *9.81*.8=334.079 N= 0.334079 KN

By using eq. (3.6) for power requirement

=0.334079 *1.14 =0.38085 KW

=0.38085*1.341= 0.5107 HP

- 77 -
3.3.5.5 Size grader dimensions

Views

Fig (3.19) size grader dimensions

- 78 -
In this last part of the machine (size grader) a servo motor is connected to separation gates to

actuate them

Fig (3.7) size grader gates

Servo motor fig (3.8)

- 79 -
Chapter (4)

- 80 -
4.0 Results and discussion

After designing the machine the resulted dimensions and requirement are discussed below

4.1 Machine parts specification


4.1.1 Feed tank specification

Table (4.1) parts dimensions

Parts Length Width Height


(m) (m) (m)
Feed tank 1.80 1.50 2.50

Washer 2.00 0 .60 1.56


Dryer 2.00 0.60 1.50
Image processing 1.50 1.08 0 .95

Size sorter 1.50 1.10 1.10

Table (4.2) dimensions of the feed tank part

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

Table (4.4) dimensions of the washer part

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

4.1.3 Dryer specification


Table (4.4) dimensions of the washer part

Length 2.000 m
Width 0.600 m

Height 1.500 m

Velocity 1.400 m/s


Power 1.050hp
Roller outer diameter 0.150 m
Roller inner diameter 0.050 m
Fan diameter 0.030 m
Weight of 10 rollers 85.174 kg

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

Image processing belt width 0.250 m

4.1.5 Size sorter specification:

Table (4.7) dimensions of the size sorting parts

Length 1.50 m

Width 1.10m

Height 1.10 m

Velocity 1.14 m/s

Power 0.510hp

Number of Packaging boxes 6.00

Number of gates 12.00

Maximum tapered rollers diameter 0.200 m

Minimum tapered rollers diameter 0.100 m

Packaging boxes width 0.240 m

Total weight of rollers 24.804 kg

- 83 -
Table (4.8) : Estimated cost for the system

Unite name Unit cost SDG Unit quantity Total


1 hp motor 1200 3 3600
𝟏⁄ hp motor 850 1 850
𝟐
2 hp motor 1800 1 1800
Sprinkler 15 18 270
Conveying belt2m 60 2 120
Fans 600 2 1200
Water pump 150 1 150
Water reservoir 650 1 650
Compressor 20 bar 350 1 350

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

manufacturers with private production.

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

efficiency of the production.

- 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

lemon, orange and grapefruit= 52.92cm2,130.40 cm2, 417.62cm2 respectively. And

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.

4. To study the possibility of increasing or decreasing the proposed system based on

increasing or decreasing the capacity(s) of the different system components.

5. The sorting component in the system is critical in determining the system capacity, so a

close study is needed to evaluate the feeding to the sorter.

- 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);

// do your control here


}
voidGreenDetected(Mat &cameraFeed,intx,int y)
{
putText(cameraFeed, "Green Object", Point(0, 50), 2, 1, Scalar(0, 255, 0), 2);
//draw object location on screen
drawObject(x, y, cameraFeed);

// do your control here


}
voidYellowDetected(Mat &cameraFeed,intx,int y)
{
putText(cameraFeed, "Yellow Object", Point(0, 50), 2, 1, Scalar(0, 255, 0), 2);
//draw object location on screen
drawObject(x, y, cameraFeed);

// do your control here


}
//initial min and max HSV filter values.

- 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;

constint MIN_OBJECT_AREA = 30 * 30;

//default capture width and height


constint FRAME_WIDTH = 480;
constint FRAME_HEIGHT = 260;
//max number of objects to be detected in frame
constint MAX_NUM_OBJECTS =5;
//minimum and maximum object area

constint MAX_OBJECT_AREA = FRAME_HEIGHT*FRAME_WIDTH / 1.5;


//names that will appear at the top of each window
const string windowName = "Original Image";
const string windowName1 = "ORANGE";
const string windowName2 = "GREEN";
const string windowName3 = " YELLOW";

const string trackbarWindowName = "ORANGETrackbars";


const string trackbarWindowName1 = "GREENTrackbars";
const string trackbarWindowName2 = "YELLOWTrackbars";

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){

//use some of the openCV drawing functions to draw crosshairs


//on your tracked image!

//UPDATE:JUNE 18TH, 2013


//added 'if' and 'else' statements to prevent
//memory errors from writing off the screen (ie. (-25,-25) is not within the window!)

circle(frame, Point(x, y), 20, Scalar(0, 255, 0), 2);


if (y - 25>0)
line(frame, Point(x, y), Point(x, y - 25), Scalar(0, 255, 0), 2);
else line(frame, Point(x, y), Point(x, 0), Scalar(0, 255, 0), 2);
if (y + 25<FRAME_HEIGHT)
line(frame, Point(x, y), Point(x, y + 25), Scalar(0, 255, 0), 2);
else line(frame, Point(x, y), Point(x, FRAME_HEIGHT), Scalar(0, 255, 0), 2);
if (x - 25>0)
line(frame, Point(x, y), Point(x - 25, y), Scalar(0, 255, 0), 2);
else line(frame, Point(x, y), Point(0, y), Scalar(0, 255, 0), 2);
if (x + 25<FRAME_WIDTH)
line(frame, Point(x, y), Point(x + 25, y), Scalar(0, 255, 0), 2);
else line(frame, Point(x, y), Point(FRAME_WIDTH, y), Scalar(0, 255, 0), 2);

- 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

Mat erodeElement = getStructuringElement(MORPH_RECT, Size(3, 3));


//dilate with larger element so make sure object is nicely visible
Mat dilateElement = getStructuringElement(MORPH_RECT, Size(8, 8));

erode(thresh, thresh, erodeElement);


erode(thresh, thresh, erodeElement);

dilate(thresh, thresh, dilateElement);


dilate(thresh, thresh, dilateElement);

boolcheckForObject(int&x, int&y, Mat threshold)


{
Mat temp;
threshold.copyTo(temp);
//these two vectors needed for output of findContours
vector< vector<Point>> contours;
vector<Vec4i> hierarchy;
//find contours of filtered image using openCVfindContours function
findContours(temp, contours, hierarchy, CV_RETR_CCOMP,
CV_CHAIN_APPROX_SIMPLE);
//use moments method to find our filtered object
doublerefArea = 0;
boolobjectFound = false;
if (hierarchy.size() > 0)
{
intnumObjects = hierarchy.size();
//if number of objects greater than MAX_NUM_OBJECTS we
have a noisy filter
if (numObjects<MAX_NUM_OBJECTS)
{
for (int index = 0; index >= 0; index =
hierarchy[index][0])

- 98 -
{
Moments moment =
moments((cv::Mat)contours[index]);
double area = moment.m00;

//if the area is less than 20 px by 20px then it is


probably just noise
//if the area is the same as the 3/2 of the image
size, probably just a bad filter
//we only want the object with the largest area so
we safe a reference area each
//iteration and compare it to the area in the next
iteration.
if (area>MIN_OBJECT_AREA &&
area<MAX_OBJECT_AREA && area>refArea)
{
x = moment.m10 / area;
y = moment.m01 / area;
objectFound = true;
refArea = area;
}
else
{
objectFound = false;
}
}
}
}
returnobjectFound;
}

voidtrackFilteredObject(int&x, int&y, Mat threshold,Mat threshold1,Mat threshold2, Mat


&cameraFeed)
{
if(checkForObject(x,y,threshold))
{
OrangeDetected(cameraFeed,x,y);
}
elseif(checkForObject(x,y,threshold1))
{
GreenDetected(cameraFeed,x,y);
}
elseif(checkForObject(x,y,threshold2))
{

YellowDetected(cameraFeed,x,y);

- 99 -
}

int main(intargc, char* argv[])


{
//some boolean variables for different functionality within this
//program
booltrackObjects = true;
booluseMorphOps = true;
//Matrix to store each frame of the webcam feed
Mat cameraFeed;
//matrix storage for HSV image
Mat HSV;
//matrix storage for binary threshold image
Mat threshold;
Mat threshold1;
Mat threshold2;
//x and y values for the location of the object
int x = 0, y = 0;
//create slider bars for HSV filtering
createTrackbars(trackbarWindowName);
createTrackbars(trackbarWindowName1);
createTrackbars(trackbarWindowName2);

//video capture object to acquire webcam feed


VideoCapture capture;
//open capture object at location zero (default location for webcam)
capture.open(0);
//******* 0 =built-in, 1 = external
//set height and width of capture frame
capture.set(CV_CAP_PROP_FRAME_WIDTH, FRAME_WIDTH);
capture.set(CV_CAP_PROP_FRAME_HEIGHT, FRAME_HEIGHT);
//start an infinite loop where webcam feed is copied to cameraFeed matrix
//all of our operations will be performed within this loop
while (1){
//store image to matrix
capture.read(cameraFeed);
if (cameraFeed.empty())
{
std::cout<<"is empty";
continue;
}
//convert frame from BGR to HSV colorspace
cvtColor(cameraFeed, HSV, COLOR_BGR2HSV);

- 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

//perform morphological operations on thresholded image to eliminate noise


//and emphasize the filtered object(s)
if (useMorphOps)
{
morphOps(threshold);
morphOps(threshold1);
morphOps(threshold2);

}
//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);

//delay 30ms so that screen can refresh.


//image will not appear without this waitKey() command
waitKey(30);

- 101 -
return 0;
}

- 102 -

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