Acessibilidade / Reportar erro

Image processing techniques for lemons and tomatoes classification

Técnica de processamento de imagem para classificação de limões e tomate

Abstracts

Vegetable quality is frequently referred to size, shape, mass, firmness, color and bruises from which fruits can be classified and sorted. However, technological by small and middle producers implementation to assess this quality is unfeasible, due to high costs of software, equipment as well as operational costs. Based on these considerations, the proposal of this research is to evaluate a new open software that enables the classification system by recognizing fruit shape, volume, color and possibly bruises at a unique glance. The software named ImageJ, compatible with Windows, Linux and MAC/OS, is quite popular in medical research and practices, and offers algorithms to obtain the above mentioned parameters. The software allows calculation of volume, area, averages, border detection, image improvement and morphological operations in a variety of image archive formats as well as extensions by means of "plugins" written in Java.

fruits and vegetables selection; ImageJ software; machine vision


A qualidade vegetal freqüentemente se refere a tamanho, forma, massa, firmeza, cor e danos, em que podem ser classificados e ordenados. Porém, sua implementação tecnológica se torna inviável, para pequenos e médios produtores, devido ao alto custo de softwares, equipamentos, além dos custos operacionais. Com base nessas considerações, a proposta deste trabalho é estudar a adaptação de um novo software, com código-fonte aberto para habilitar o sistema de classificação reconhecendo forma, volume, cor e possivelmente danos. O software chamado ImageJ, compatível com o Windows, Linux e MAC/OS, é bastante popular em práticas e pesquisas médicas, e oferece algoritmos para obter os parâmetros mencionados acima. Entre os recursos oferecidos pelo pacote destaca-se a disponibilidade de diversos algoritmos com código-fonte abertos para: manipulação dos mais variados formatos de arquivo de imagens, detecção de bordas, melhoria de imagens, cálculos diversos (áreas, médias, centróides) e operações morfológicas. Este software disponibiliza também um ambiente gráfico que simplifica a utilização de tais recursos, além de permitir a extensão através de "plugins" escritos em Java.

seleção de frutas e hortaliças; software ImageJ; visão de máquina


POST HARVEST

NOTE

Image processing techniques for lemons and tomatoes classification

Técnica de processamento de imagem para classificação de limões e tomate

Antonio Carlos Loureiro LinoI* * Autor correspondente ; Juliana SanchesI; Inacio Maria Dal FabbroII

ICentro de Engenharia e Automação, Instituto Agronômico, Rodovia D. Gabriel P. B. Couto, km 65. Caixa Postal 26, 13201-970 Jundiaí (SP). E-mail: lino@iac.sp.gov.br; jsanches@iac.sp.gov.br

IIFaculdade de Engenharia Agrícola / UNICAMP, Cidade Universitária Zeferino Vaz, Caixa Postal 6011, 13083-875 Campinas (SP). E-mail: inacio@agr.unicamp.br

ABSTRACT

Vegetable quality is frequently referred to size, shape, mass, firmness, color and bruises from which fruits can be classified and sorted. However, technological by small and middle producers implementation to assess this quality is unfeasible, due to high costs of software, equipment as well as operational costs. Based on these considerations, the proposal of this research is to evaluate a new open software that enables the classification system by recognizing fruit shape, volume, color and possibly bruises at a unique glance. The software named ImageJ, compatible with Windows, Linux and MAC/OS, is quite popular in medical research and practices, and offers algorithms to obtain the above mentioned parameters. The software allows calculation of volume, area, averages, border detection, image improvement and morphological operations in a variety of image archive formats as well as extensions by means of "plugins" written in Java.

Key words: fruits and vegetables selection, ImageJ software, machine vision.

RESUMO

A qualidade vegetal freqüentemente se refere a tamanho, forma, massa, firmeza, cor e danos, em que podem ser classificados e ordenados. Porém, sua implementação tecnológica se torna inviável, para pequenos e médios produtores, devido ao alto custo de softwares, equipamentos, além dos custos operacionais. Com base nessas considerações, a proposta deste trabalho é estudar a adaptação de um novo software, com código-fonte aberto para habilitar o sistema de classificação reconhecendo forma, volume, cor e possivelmente danos. O software chamado ImageJ, compatível com o Windows, Linux e MAC/OS, é bastante popular em práticas e pesquisas médicas, e oferece algoritmos para obter os parâmetros mencionados acima. Entre os recursos oferecidos pelo pacote destaca-se a disponibilidade de diversos algoritmos com código-fonte abertos para: manipulação dos mais variados formatos de arquivo de imagens, detecção de bordas, melhoria de imagens, cálculos diversos (áreas, médias, centróides) e operações morfológicas. Este software disponibiliza também um ambiente gráfico que simplifica a utilização de tais recursos, além de permitir a extensão através de "plugins" escritos em Java.

Palavras-chave: seleção de frutas e hortaliças, software ImageJ, visão de máquina.

Introduction

Fruits and vegetables production and related activities face significant losses in Brazil, which are close associated to the lack of appropriate technology. Vegetable quality is frequently referred to size, shape, mass, firmness, color and bruises from which it can be classified and sorted. However, technological implementation in that sector turns unfeasible by software, equipment as well as operational costs. For delicate products as eggs, fruits and others plant organs, optical techniques, including moiré methods, are especially useful for geometrical characterization as well as to implement sorting techniques, due to speedy, non-physical contact with the specimens, low cost and automation possibilities.

The ImageJ software was created by Wayne Rasband from the Research Services Branch, National Institute of Mental Health, in Bethesda, Md, USA. The letter J on its name stands for JAVA language. Its first release, version 0.50, was dated from September/23/1997 and its now in version 1.31, released on February/2004. That software is in public domain, it runs on any operating system, it is easy to use, can perform a full set of imaging manipulations exhibiting a great and knowledgeable community of users. ImageJ acquires images from scanners, other video sources, cameras, including cameras compatible with TWAIN, FireWire, frame grabber boards from Cooke, National Instruments and PixelSmart.

The program supports all image manipulations as reading and writing of image files, operation on individual pixels, image regions, whole images and volumes. Volumes ordered as a sequence of images can be operated upon as a whole. It also can perform basic operations as convolution, edge detection, Fourier transform, histogram, editing and color manipulation, dilatation as well as mathematical operation on sets of images such as multiplication and/or division. Visualization operations includes color space conversions from as from RGB to Hue Saturation Intensity color space, 2D and 3D plotting as well as surface and volume rendering. ImageJ can also run on different platforms as Microsoft, Macintosh and Linux.

The far limit of the program allows user written Macros to make easier oft-repeated tasks though it is easy - to – use macro – language, being not necessary to know Java. Plug-ins are external programs mostly written in Java language which do not exist in the ImageJ core. Imaging library is the third way of extending the program, by means of the API (application programmer's interface), which means that the user.

The literature also reports that an electronic system can classify fruits by mass with one gram of precision, by diameter with one mm of precision, by color, by bruising, shape and density. An electronic sorter can be adjusted for 16 sizes, 08 colors and 04 sorting criteria in a total of 512 possible criteria. This class of equipment is generally composed of a camera, a lenses, a light source, a filter and a PC (SARKAR and WOLFE, 1985; VON BECKMANN and BULLEY, 1978; HAHN, 2002). KONDO and TING (1998) describe the basic setup for data acquisition, including color, mass and size. In spite the authors consider the components of simple conception they would depend of reliable software to forward the product to proper channels. Modern equipment can sort up to 10 fruits per second, differentiating color, size, shape, spots, bruising, presence of stem, etc. JAHNS et al. (2001) observed that the absolute error in sorting tomatoes by mass by means of image analysis, run close to 2,06%.

For the greater number of the fruits, color is associated to the physiological ripeness, and can be used as a sorting pattern. ARIAS et al. (2000) report that the surface color of tomato is a major factor in determining the ripeness of this fruit. JAHNS et al. (2001) also report that color, spots and bruises are easily recognized by the pixel level. HAHN (2002) reports the application of a multi color system to select tomatoes considered physiologically immature, claiming an approximation of 85%. POLDER et al. (2003) report that they found good correlation between spectral images and the lycopen content of tomato, that is responsible for the fruit red color, which varies according to the ripeness stage.

Usually sorting equipments have algorithm selection for a determined range of colors. KADER (2002) reports that it was necessary to capture a certain number of images to obtain fruit diameter, recommending the application of video images to inspect the fruit appearance. VON BECKMANN and BULLEY (1978) states that simultaneous fruit sorting by size and color would save time, reducing fruit handling.

Based on these considerations, the proposal of this research work was conceived as to adapt the ImageJ open software to enable the classification system in recognizing shape, volume, color and possibly bruises at a unique glance, driving at to develop low cost and reliable techniques applicable to fruit sorting.

Materials and Methods

The experimental setup, as it is shown on Figure 1, is composed only by a CCD camera and a PC, since no special color sensors were needed, because the ImageJ software is able to process the colored image to RGB components percentages.


Classification of lemons by size

A number of six lemons were selected and measured at the equatorial diameter by means of a digital caliper, as recommended by the State of São Paulo Whole Sale Market, PBMH (2000), for classification purposes. Fruits were them illuminated with a conventional white light source and the images captured by a CCD camera which, in turn, was connected to a PC. The software processed the image, by the transformation in 8 bits image. It was eliminated the background through the menu "Image/Adjust/Threshold". The pixels correspondent to the photographed fruit surface was calculated through the menu "Analyze/ Analyzer Particles". Equatorial diameter values were compared with the surface area expressed in pixels and the R coefficient was calculated.

Classification of tomatoes by color

Tomatoes at braker, turning and red ripeness levels (Pbmh, 2004), with five repetitions of each level, were illuminated with conventional white light source and the images captured by a CCD camera which, in turn, is connected to a PC. The ImageJ software processed the images, through the menu "Image/Analyzer/Tools/Color Histogram", yielding the average values and the histograms for R, G, B. Luminance is formed as a weighted sum of linear RGB components, and was obtained by the transformation of the colored image to gray image (8 bits). The average values and the histogram was obtained through the menu "Analyze/Histogram".

Results and Discussion

Lemon:

Figure 2 displays the equatorial diameter of lemons in mm, as well as the surface area expressed in pixels, as a mean of diameter optical evaluation.


The correlation between these two parameters can be expressed by the equation y = 0,0084x + 30,048, holding R2 = 0.8973. YIBIN (1999) and PAULUS and SCHREVENS (1999) obtained similar results when investigated the correlation between equatorial diameter and surface area, in pear and apple, respectively. TEOH and SYAIFUDIN (2006) measured the area of mango by image analysis against the actual weight of mango in a graph and the results showed that the area measured by image analysis has high correlation with the actual weight of mango with R2 = 0.934.

Tomatoes:

Figure 3 exhibits the RGB images separated in green, blue, red and luminance of tested tomatoes. As ripening progress, luminance, blue and green intensities increased to a maximum value referred as turning, decreasing beyond that point meanwhile the red color is noticed to increase. JAHNS et al. (2001) reported that the results of color discrimination of 'Pannovy' tomatoes is compared to human grading, when the tomatoes having the same luminance as the tomatoes in the illumination of sensorial chamber and an RGB image is acquired.


Figure 4 shows that during the ripening of tomato occurred an increase of the red color and a decrease of the green color, indicating chlorophyll degradation meanwhile lycopen started to be produced. VAN DER HEIJDEN et al. (2000), POLDER et al. (2000) and POLDER et al. (2002) also compared images with standard RGB images for classifying tomatoes in different ripeness classes using individual pixels and obteined similars results.


The results presented above allow concluding that classification of lemons by size as well as the classification of tomatoes by color can be supported by image analysis open software. The correlation of lemons diameter with pixel surface supports the application of this software to evaluate equatorial diameter. It should be noted that the software in study can handle several parameters, or attributes at a single glance, which is considered an important feature to support the development of fruit classification technology. Remaining software features should be examined for further applications on fruit attributes. In the near future we plan to repeat the experiment using a large set of tomatoes and lemons in different ripeness stages and sizes to deepen the research.

Received for publication in October 30, 2006 and accept in February 29, 2008.

  • ARIAS, R.; L., TUNG CHING; LOGENDRA, L.; JANES, H. Correlation of lycopene measured by HPLC with the L*, a*, b* color readings of a hydroponic tomato and the relationship of maturity with color and lycopene content. Journal of Agricultural and Food Chemistry, Washington, v.48, n.5, p.1697-1702, 2000.
  • HAHN, F. Multi-spectral prediction of unripe tomatoes, Biosystems Engineering, Bedford, v.81, n.2, p.147-155, 2002.
  • JAHNS, G.; NIELSEN, H. M.; WOLFGANG, P. Measuring image analysis attributes and modeling fuzzy consumer aspects for tomato quality grading. Computers and Electronics in Agriculture, Davis, v.31, p.17-29, 2001.
  • KADER, A. A. Standardization and inspection of fresh fruits and vegetables. In: KADER, A. A. Postharvest technology of horticultural crops 3. ed. Davis: University of California, 2002. p. 287-289.
  • KONDO, N., TING, K. C. Robotics in bioproduction systems ed. St. Joseph: ASAE, The Society for engineering in agricultural, food, and biological systems, 1998. 325p.
  • PAULUS, I., SCHREVENS, E. Evaluating and modelling the size classifcation of apples. Journal of Agricultural Engineering Research, Bedford, v. 74, p. 411-419, 1999.
  • PBMH - PROGRAMA BRASILEIRO PARA A MODERNIZAÇÃO DA HORTICULTURA. Normas de classificação do limão (Lima ácida) Tahiti São Paulo: CEAGESP, 2000.
  • PBMH - PROGRAMA BRASILEIRO PARA A MODERNIZAÇÃO DA HORTICULTURA. Normas de classificação de Tomate. São Paulo: CEAGESP, 2004.
  • POLDER, G., VAN DER HEIJDEN, G. W. A. M.; YOUNG, I.T. Hyperspectral image analysis for measuring ripeness of tomatoes. In: ASAE International Meeting, 2000, Milwaukee. Proceedings... Milwaukee: ASAE, 2000, Paper Nş 003089.
  • POLDER, G., VAN DER HEIJDEN, G. W. A. M.; YOUNG, I.T. Spectral image analysis for Measuring ripeness of tomatoes. Transactions of the ASAE, St. Joseph, v. 45, n. 4, p. 1155-1161, 2002.
  • POLDER, G., VAN DER HEIJDEN, G. W. A. M.; YOUNG, I.T. Tomato sorting using independent component analysis on spectral images. Real-Time Imaging, London, v.9, p.253-259, 2003.
  • SARKAR, N.; WOLFE, R. R. Computer vision based system for quality separator of fresh-market tomatoes. Transactions of the ASAE, St. Joseph, v. 28, n. 5, p. 1714-1718, 1985.
  • TEOH, C. C., SYAIFUDIN, A. R. M. Use of image analysis for grading size of mango. Acta horticulturae, Leuven, v.710, p.485-490, 2006.
  • VAN DER HEIJDEN, G. W. A. M., POLDER, G., GEVERS T. Comparison of multispectral images across the Internet. In: SPIE: Internet Imaging, 2000, Washington. Proceedings... Washington: SPIE, 2000. v.3964, p.196206.
  • VON BECMANN, J. W.; BULLEY, N. R. Electronic sizer and color grader for tomatoes. Transactions of the ASAE, St. Joseph, v.21, n.1, p.25-30, 1978.
  • YIBIN, Y. New method to identify shape, size and surface defect of huanghua Pear with machine vision-Part: Development of hardware and image preprocessing method. In: International Conference on Agricultural Engineering, 99, 1999, Beijing. Proceedings... Beijing: Natural Science Funds of China, 1999. p.79-86.
  • *
    Autor correspondente
  • Publication Dates

    • Publication in this collection
      07 Nov 2008
    • Date of issue
      2008

    History

    • Accepted
      29 Feb 2008
    • Received
      30 Oct 2006
    Instituto Agronômico de Campinas Avenida Barão de Itapura, 1481, 13020-902, Tel.: +55 19 2137-0653, Fax: +55 19 2137-0666 - Campinas - SP - Brazil
    E-mail: bragantia@iac.sp.gov.br