Real Time Fruit Inspection

The following outlines a real-time fruit inspection application.  To measure the quality of fruit, the colors and shapes are used. The fruit is imaged with a color digital imaging system, the images are analyzed, and results reported to a host computer to determine the final disposition of each piece of fruit. The fruit is presented to the imaging system at a rate of 10 per second. It is a design requirement that all the fruit be inspected.

 

Application Steps

Collecting the Image

During this phase of the application the fruit is imaged by a camera that captures the fruit from six directions – front, left, back, right, top, and bottom – and supplies these images to the computer system as six separate images, each at 256x256 pixels. The six images are merged into one image of 768x512 for ease of handling, three images across and two down. This image is digitized as 24-bit RGB data.

Color Evaluation

The image is color space converted from RGB to HSI (hue, saturation and intensity). The three 8-bit values are converted to one 8-bit value by converting the ‘I’ value to a 4-bit value via a LUT (look up table), taking the H and S values and converting them to an 8-bit value via another LUT. The 12-bit value formed from the 4-bit intensity value and the 8-bit color value is converted to an 8-bit value via a final LUT. (In principle this could be done with one LUT of 16 MB deep.)

The values in the LUT's are precomputed to allow the color differences in the fruit that are significant to its grading to be easily detected. After the RGB pixel values are converted to the 8-bit pixels, a blob analysis is run on the image. Regions of constant color (8-bit value) are labeled in each of the 6 views. A table of regions is reported to the host computer containing the location of the blob, its size, color and bounding box. These values are used by the host computer to determine if the fruit is ripe, over-ripe, or damaged.

Shape Evaluation

Shape evaluation is performed in each view by determining the perimeter of the fruit in each view, the area enclosed by the perimeter, the convex hull of the perimeter, and the area enclosed by the convex hull. The host computer uses the convex hull and the perimeter to determine if a piece of the fruit is missing or if the fruit is oddly shaped. For example, in the case of spherical fruit, the area of the convex hull and the perimeter should be nearly the same. However, for a banana, the convex hull will enclose more area than the perimeter.

Computational and Bus Bandwidth Requirements

The table below shows the counts of the number of operations and usage of memory for the selected processors. The number of processors required can be determined by computing the time it would take one processor to do the processing, and dividing that by the time actually available.

Operations CPU Ops BUS Bytes-R BUS Bytes-W I/O Bytes
Acquire front
-
-
786,000 786,000
Acquire left
-
-
786,000 786,000
Acquire back
-
-
786,000 786,000
Acquire right
-
-
786,000 786,000
Acquire top
-
-
786,000 786,000
Acquire bottom
-
-
786,000 786,000
Calibration
-
4,718,000
-
-
Stitch image together 4,718,000
-
1,179,000
-
Convert from RGB to HSI 17,694,000 1,179,000
-
-
Convert HSI to color index 7,077,000
-
393,000
-
Blob analysis 524,000 786,000 786,000
-
Inspect Shape 866,000 430,000 720 720
Report enclosed area 786,000 393,000 240 240
Report perimeter length 64,000 21,000 240 240
Report convex hull area 15,000 15,000 240 240
Entire Application 30,881,000 7,114,000 7,078,000 4,719,000


Inspection Results

The same set of processors are used as compared before, but this time their computational performance is significant. The performance of the processors is shown in the table below.

When the design requirement to process 10 fruit per second is considered, the total operations and memory bus cycles dictate the number of processors required. In this application the PIII processor is able to participate as the data rate is below PCI’s 132 MB/s limitation.

Number of processors required for fruit inspection application.

Intel PIII-450 Philips TM1300 TI C6701 ADI 21160
2 1 3 2

Click to register to Download the application note in pdf format