Introduction

Aflatoxins are a family of closely related secondary metabolites produced by some strains of moulds (i.e., Aspergillus flavus and Aspergillus parasiticus). These are such highly toxic and carcinogenic compounds that even low levels of contamination are important. The studies have revealed that there are two major groups of aflatoxins, AFB and AFG, which are fluorescent when observed under UV light. In particular, AFB emit fluorescence in the bright-blue region of the spectrum (425–480 nm), while AFG emit fluorescence in the blue-green range (480–500 nm).

Aflatoxins can be found in a wide range of food and feeding stuffs and are hazardous to humans and animals (Stroka and Anklam 2002). Since aflatoxin contamination is unavoidable and unpredictable (Lopez-Garcia et al. 1999), permitted aflatoxin levels are regulated in many countries worldwide. The European Commission has adopted strict regulations for official controls (European Community 2006): products exceeding the maximum levels should not be placed on the market in the EU.

Several analytical methodologies have been developed in order to identify lots contaminated by aflatoxins: methods based on thin-layer chromatography (TLC), high-performance liquid chromatography (HPLC), and enzyme-linked immunosorbent assays (ELISA) are used in routine analysis (Stroka and Anklam 2002). These methodologies are quite accurate, but none of them are amenable to rapid and simple automation (Pasikatan and Dowell 2001). Besides, they can be so slow, costly, and laborious that food authorities may not be able to test a sufficient fraction of suspicious products, so a large percentage of products potentially contaminated with aflatoxins are not chemically analyzed. Consequently, contaminated products have a high probability of passing the controls set by the food authorities. It is known that many food authorities currently have the capacity to test only about 5–25 % of imported food products for mycotoxins (Stroka and Anklam 2002). Therefore, aflatoxins are frequently found in food and feed at significant levels. Since fungal contamination may not be removed completely by typical cleaning equipment (Pasikatan and Dowell 2001), the systematic and complete monitoring of aflatoxins is a major challenge. The major question is whether a complete and accurate aflatoxin monitoring is technically feasible. Actually, new strategies based on simple methods for the identification of suspect goods to reduce and focus on further analytical work are viable. In spite of this, in 2010, the number of notifications in the Rapid Alert System for Food and Feed (R.A.S.F.F.) increased 12 % compared to 2009, an all-time-high number. Two thirds of alert notifications in 2010 related to products originating in the EU, and most of these problems were detected by controls carried out on the market (R.A.S.F.F. 2010). This means that there is a need for a technique that has the resolution and computational power to identify the majority of contaminated products.

Sorting System Based on Optical Methods

A sorting system based on optical methods has the potential to rapidly detect and physically remove seeds contaminated by fungi (Pasikatan and Dowell 2001). Promising results in photoacoustic spectroscopy (PAS) and transient infrared spectroscopy (TIRS) have been reported for detecting fungal infection in seeds (Greene et al. 1992; Gordon et al. 1999, 1998). However, neither PAS nor TIRS were designed for removal of infected seeds, which requires singulation and high speeds (Jones and McClelland 1992; Gordon et al. 1998).

If a food exhibits a bright greenish yellow fluorescence (BGYF), it indicates the presence of aflatoxigenic moulds, and it is an indicator of a likely aflatoxin contamination. The principle of this method is the detection of characteristic fluorescence under long-wave ultraviolet (LW-UV) light (365 nm) associated with the presence of kojic acid, a metabolite of A. flavus and A. parasiticus or possibly aflatoxin itself. Several uses for BGYF have been developed. The relationship between A. flavus infection, BGYF, and aflatoxin was first reported in cottonseed by Marsh et al. (1969). They concluded that the BGYF serves as a diagnostic marker to locate A. flavus infections in cotton fiber at harvest, and later, evidence indicated that BGYF might yield similar results with other plants. BGYF is used routinely to screen corn (“black light test”) during food production (Shotwell and Hesseltine 1981). In addition, UV lamps are used to screen cashew kernels and separate damaged and foreign matter before mechanical grading occurs (Paramount Farms 1991; Matz 1984), but no scientific papers have been published about aflatoxin identification using BGYF in cashews. In dried figs, the relationship of BGYF under LW-UV light to colonization by four Aspergillus spp. was determinate (Doster and Michailides 1998). The feasibility of using BGYF as a discriminating factor for identification of most A. flavus-infected pistachio nuts, and consequently, the substantial majority of aflatoxin-contaminated samples was also investigated (Hadawi 2005). The results show a strong relationship between BGYF and aflatoxin content.

A sorting system based on color differences between “accept” and “reject” samples and other quality factors that are detectable visually is being used with some commodities, such as coffee, beans, peanuts, etc. To recognize the color of contaminated pistachio nuts, Karami and Mirabolfathy (2006) developed a sorting method based on a vision system endowed with a LW-UV lamp. Contaminated samples were separated by applying neural network algorithms.

Other researchers have studied the feasibility of optical sorting machines using indices for product segregation. Various sorting indices have been formulated, including a single wavelength or two wavelengths in the form of a ratio, differences, normalized differences, etc. (Sims and Gamon 2002). Farsaie et al. (1978) showed that the ratio of fluorescence in pistachios at 490 and 420 nm could be the basis for detecting BGY fluorescence. These two wavelengths were used in an automatic sorter to find aflatoxin-infected pistachio nuts (McClure and Farsaie 1980; Farsaie et al. 1981). However, no report about the viability of this method at a commercial level has been published.

As can be concluded from the brief review above, most of the work investigating the feasibility of using BGYF under LW-UV excitation as a discriminating factor to identify aflatoxin-contaminated crops has showed successful results. Coupling this technique with spectroscopy and image processing could facilitate the evaluation of spatial data and could allow the simultaneous screening of a larger population of samples.

The aim of this study was to apply a static artificial vision system utilizing an LW-UV light in order to identify BGYF compound eventually present on the pistachio and cashew nuts' surface that is likely associated with aflatoxin contamination. The main strategy was to achieve an image algorithm formulated from a few wavelengths to give the end users a user-friendly, fast, and economic technology that could be employed to automatically and rapidly detect suspect goods with a high degree of precision. This preliminary study would constitute the first important step towards the development of a new accurate aflatoxin screening method based on a vision system that is able to separate the contaminated product from the uncontaminated stream.

Materials

Nuts Sample

Kernel cashew and in-shell pistachio nut samples were supplied by an Italian nut processor. Aflatoxin tests were carried out by an independent accredited laboratory using the AOAC Official Method 999.07. The test portion is extracted with NaCl and methanol (MeOH), after adding hexane and blending the mixture in a high-speed blender. The mixture is filtered, diluted with water, and applied to an immunoaffinity column containing antibodies specific to aflatoxins B1, B2, G1, andG2. The column is washed with water and dried by applying a vacuum; aflatoxins are removed from the affinity column with MeOH. Aflatoxins are quantitated using reversed-phase high-performance liquid chromatography with post-column derivatization using a kobra cell and fluorescence detector. The lower limits of detection were 0.3 and 1.2 μg/kg for aflatoxin B1 and total aflatoxins, respectively. The limit of quantification was 1 and 2 μg/kg for aflatoxin B1 and total aflatoxins, respectively. Following laboratory analysis results, samples were divided into two groups: contaminated, nuts that came from lots known to be contaminated with aflatoxin (weight and total aflatoxin concentration of the lots, 23 kg, B1 + B2 + G1 + G2 = 190 μg/kg, for pistachio nuts; 23 kg, B1 + B2 + G1 + G2 = 184 μg/kg, for cashews), and uncontaminated, nuts that came from uncontaminated lots. A total of 352 nut samples, 184 pistachios and 168 cashews, were considered for the analysis: 92 pistachio nuts and 84 cashews were randomly chosen from the contaminated lots, and 92 pistachio nuts and 84 cashews were randomly selected from the uncontaminated lots.

Vision System

Images were acquired by coupling a charged coupled device (CCD) camera to a filter wheel to allow rapid acquisition of 18 images at different spectral bands, including those in the range between 380 and 1,060 nm. The filters allowed a 10-nm full-width, half-maximum (FWHM) band of light to pass through. The camera was equipped with a Nikon AF lens manually regulated (focal length, 50 mm, maximum shutter aperture 1.8). The resolution of the camera was 480 × 640 pixels. A rectangular chamber (0.75 × 0.4 × 0.3 m) with black walls was put around the vision test station in order to create a uniform light field around the object (Fig. 1). Although the images were acquired using this black chamber, it was impossible to eliminate any effect of environmental light, and a small amount of visible light could enter in the vision test station. The light source was provided by six Wood lamps (LUMILUX COMBI EL-N7P, 18 W, λ = 365 nm, Osram, Munich, Germany) attached at equidistant points on the inside of the chamber. These lamps emit LW-UV radiation, also called “black light”, generated by a high pressure mercury arc fitted with a compound filter made of barium silicate with 9 % nickel oxide, the “Wood's filter.” This filter is opaque to all light rays except a band between 320 and 400 nm with a peak at 365 nm (Wood 1919). Nut samples were manually placed in the chamber through a rectangular opening in the upper side. The images were acquired using a black background. In order to adjust the color balance of the images (calibration image), all the images were subjected to a white balancing by using a standard white card (whose intensity values in the RGB space color was 255–255–255). The distance between the lens system and the sample was 0.625 m. Figure 1 shows a schematic diagram of the vision system.

Fig. 1
figure 1

Schematic diagram of machine vision system (upper panel) and the experimental rectangular chamber (lower panel): a outside view, b inside view showing wood lamps

Methods

The experiment was carried out on all samples on the same day and under the same conditions at laboratory scale. Due to the potent biological effects of aflatoxins, researchers wore latex gloves to handle samples. Images of contaminated and uncontaminated samples were acquired using the vision system described above. Only the optical filters with a bandpass of 410, 440, 480, 520, 560, and 600 nm were employed, in order to include the wavelengths where aflatoxins emit fluorescence (425–490 nm) and the wavelengths corresponding to the colors of the nut tissue, i.e., 560–580 nm (yellow) and 581–600 nm (orange). As quality properties can vary significantly, depending on the area or side of the nut one views, two areas, considered to be divided by the lengthwise suture of the hull (for pistachio nut samples) or the kernel (for cashew samples), were differentiated when acquiring the images: the front side (F) and the back side (B). Single nut sides were considered as sample units in this work. An image was acquired for each unit and for each wavelength, so we obtained 704 image sequences for a total of 4,224 images. The images acquired by the camera were stored and processed off-line in MATLAB®.

Isolation of the Fluorescent Stains

At first, all the images were processed in order to select only the samples with fluorescent stains caused by BGYF (corresponding to the region of interest, ROI) (Fig. 2). Several tests were performed to search for an appropriate color combination image that was able to enhance the fluorescent stains. All tests confirmed that the extraction of the 480 nm color plane (I 480) from the 600 nm one (I 600) allowed us to obtain a D image (D = I 600 − I 480) in which the background and the nut surface without fluorescent stains were black (gray level = 0), while the ROI was displayed as light gray (gray level ≠ 0). D images were computed for each sample and were converted to binary images through the Otsu segmentation method (Otsu 1979). The objective was to achieve a binary image (D bw), wherein white pixels (active pixels, gray level = 1) represented the fluorescent stains present in the original image and black pixels represented the background (gray level = 0). This operation resulted in a binary image that could be considered as an image mask. For each sample, the obtained image mask was applied to the six images of the sequence. In this way, the pixels of the image coinciding with the pixels of the image mask with value 0 were set to 0, and the pixels coinciding with the pixels of the image mask with value 1 retained their original value. This means that all background pixels were set to 0, so that only an image of fluorescent stains was obtained. The samples exhibiting fluorescent stains were put into the fluorescent stains (FS) group, while samples without fluorescent stains were put into the not-fluorescent stains group (NFS).

Fig. 2
figure 2

Visible fluorescent stain in a monochromatic cashew image (sample belonging to contaminated lot) acquired under 365 nm illumination

Reference Test

After the image analysis, both FS and NFS samples were analyzed for aflatoxin in the same laboratory which supplied the first analysis results, according to the AOAC Official Method 999.07 (Stroka et al. 2000). The aim was to insure detection of aflatoxin contamination obtained through the vision system.

Reflectance Data Evaluation

For each image of samples belonging to the FS group, a sub-region (SROI, 4 × 4 pixels) was manually selected that corresponded to fluorescent stains. In the same way, for each image of the NFS samples, an SROI was selected that corresponded to tissue not emitting fluorescence. Measurements were in triplicates and the average of the gray level (a m) and the corresponding standard deviation (v im) of the selected SROI was calculated for each sample and wavelength. In order to identify the optimal optical range to separate FS and NFS groups, v im values of the selected SROI were compared. The statistical analysis applied was a forward stepwise discriminant analysis carried out using Statistical®, in order to reduce the original number of variables (k) to a subset of dependent variables (p). In a stepwise discriminant function analysis, a model of discrimination is built step-by-step, guided by the respective F to enter (F in) and F to remove (F out) (the F value for a variable indicates its statistical significance in the discrimination between groups). Specifically, at each step, all variables are reviewed and evaluated to determine which one will contribute most to the discrimination between groups. That variable will then be included in the model, and the process starts again.

Results and Discussion

Image Processing

Since a small amount of visible environmental light could enter in the vision test station, also the uncontaminated tissue of nuts was visible in all the acquired images. The extraction of the 480 nm color plane (I 480) from the 600 nm one (I 600) led to enhancement of the fluorescent stains (Fig. 3), probably because the 480 nm color plane corresponds to the blue plane, a color that is not present in the tissue (yellow-orange) of nuts or in the background (black), while AFB and AFG emit bright-blue and blue-green. The proposed image processing method for thresholding fluorescent stains from the background fit the characteristics of the D images and was able to correctly threshold 100 % of the images. In this way, in the D images, it was possible to recognize clearly the fluorescent stains and select the samples with a likely aflatoxin contamination (FS group). As shown in Table 1, only 42.4 % of pistachio nuts and 38.6 % of cashews belonging to contaminated lots were placed into the FS group. This result was quite expected: at first, in this work an image was acquired for each front (F) and back (B) side of the samples, and each image was considered as a single unit in the further analysis. This means that if a sample had exhibited fluorescence on the F side but not on the B side, only the first image would have been placed in the FS group. Second, since aflatoxin is usually concentrated in a very small percentage of the product and only a few nuts can contain high concentrations of aflatoxin (Whitaker et al. 1970; Steiner et al. 1992), it is probably true that not all the analyzed samples were contaminated. Besides, the result corresponded to findings of other researchers: Cucullu et al. (1966) found that in a lot of shelled peanuts with a percentage of aflatoxin-contaminated samples less than 0.1 %, the contamination level on a single kernel could be as high as 1.000.000 μg/kg. Hirano et al. (1998) reported that the removal of just 5 % of the peanuts lowered the aflatoxin content of an entire lot of peanuts from 4.5 to 0.2 μg/kg. In Table 1, one can see that about 17.4 % of pistachio nuts and 10.7 % of cashews belonging to the uncontaminated lots also exhibited fluorescence. This result could be due to samplings errors in testing the nuts for aflatoxin contamination (Dickens and Welty 1975). This is a problem often mentioned in the literature: Steiner et al. (1992) during 3 years of analyzing several samples of pistachio nuts certificated as being free of aflatoxins found aflatoxin concentrations above 90 μg/kg. On the other hand, Mahoney and Rodriguez (1996) found that a single pistachio nut with an aflatoxin concentration of 60,000 μg/kg can contaminate an aflatoxin-free lot of 4.5 kg to 20 μg/kg toxin.

Fig. 3
figure 3

The applied image processing led to enhancement of fluorescent stains: a scaled image of a cashew sample acquired at 600 nm (I 600); b scaled D image (D = I 600 − I 480); c Otsu segmented binary D image (D bw, image mask); d scaled I 600 after applying image mask (D bw * I 600)

Table 1 Number and corresponding total aflatoxin concentration of sample images placed in the fluorescent stains group (FS) and the non-fluorescent stains group (NFS) according to camera classification

Reference Test

In Table 1, the laboratory analysis results of FS and NFS pistachio nut and cashew samples are also reported. The results show a high correlation with the camera classification: total aflatoxin concentration both in pistachio and cashew samples placed in the FS group passed the European Commission permitted levels of aflatoxins in nuts (B1 + B2 + G1 + G2 > 4 μg/kg). Since laboratory analysis results were expressed as total concentration, it was not possible to affirm that samples classified as uncontaminated by the processor and included in the FS group were effectively contaminated. Besides, studies carried out by Dickens and Welty (1975) on a large number of pistachio samples indicated that all lots of pistachio nuts contained fluorescent nuts, but these fluorescent nuts often tested negative for aflatoxin. These would be false-positive samples, corresponding to 18 of 336 of total cashew images (about 5 %) and to 32 of 368 (about 8 %) of total pistachio nut images (Table 1). A small amount of aflatoxin was also found in samples in the NFS group, even though the total aflatoxin concentration was in both cases (pistachio nuts and cashews) less than the permitted level. This is probably due to the fact that samples contaminated with aflatoxin sometimes do not exhibit BGYF (Wilson 1989).

On the basis of the aflatoxin concentration, it is possible to conclude that the vision system was able to remove samples containing about 92 % (14.5 of 15.7 μg/kg) and 82 % (8.2 of 10 μg/kg) of total aflatoxins, respectively, in the pistachio nut and cashew samples.

Statistic Analysis

A discriminant analysis was applied to both pistachios and cashews reflectance data and two levels in the categorical variable. Specifically, FS (fluorescent stains) and NFS (non-fluorescent stains) as well as six wavelengths as independent variables were used. To eliminate the variables that provided superfluous information at a 99 % level, we applied an F in = 6.967 in the forward stepwise procedure with a tolerance of 0.01. The stepwise method operated in an iterative manner, adding the variables whose F statistics were greater than the F in value. Due to the two levels of the categorical variables, one significant discriminant function (DF) of classification was obtained.

Pistachios

Iteratively, the algorithm took two steps to converge, producing a subset containing two principle wavelengths, i.e., 520 and 480 nm. As confirmed by Wilks' lambda value (Table 2), an index of the discriminating power ranging between 0 and 1 (the lower the value the higher its discriminating power), the discriminant function appeared to have a very good classification with 100 % of original cases correctly classified. In Fig. 4, which shows the plot of averages and confidence intervals (95 %) obtained at 520 and at 480 nm by performing a discriminant analysis to the gray level values of pistachio samples placed in the FS and in the NFS groups, it is possible to observe this result graphically, since in both the cases, significant differences between classes at p < 0.00 according to LSD test were observed (520 nm, F = 54.64; 480 nm, F = 48.54). In Table 2, the standardized canonical discriminant function coefficients, used to compare the relative importance of the independent variables, are also reported. The DF was mainly correlated to low reflectance values at 520 nm (−1.282) and high reflectance values at 480 nm (0.880). This means that cases with a positive score on DF tended to have lower reflectance values at the former and higher reflectance values at the later optical range.

Table 2 Standardized canonical discriminant function coefficients and Wilks' lambda value of the model
Fig. 4
figure 4

Plot of averages and confidence intervals (95 %) obtained at 520 nm (upper panel) and at 480 nm (lower panel) by performing a discriminant analysis to the gray level values of pistachios samples classified as fluorescent (FS) and in the non-fluorescent stains (NFS) groups (520 nm, F = 54.64, p = 0.00; 480 nm, F = 48.54; p = 0,00). The x-axis corresponds to the categorical variable (FS and NFS) and the y-axis to the gray level values (nanometer)

Cashews

Two principle wavelengths, i.e., 440 and 600 nm, were selected. Model parameter, in terms of Wilks' lambda, and the standardized coefficients for canonical variables are reported in Table 2. In this case, the DF was also good at discriminating between contaminated and uncontaminated samples, with 100 % of original cases correctly classified. In Fig. 5, which reports the plot of averages and confidence intervals (95 %) obtained at 440 and at 600 nm through performing the described discriminant analysis, it is possible to observe that in both cases, significant differences between classes at p < 0.00 according to LSD test were observed (440 nm, F = 78.38; 600 nm, F = 74.54). The DF was mainly correlated to low reflectance values at 440 nm (negative correlation) and high reflectance values at 600 nm (0.980): cases with a positive score on DF tended to have lower reflectance values at 440 nm and higher reflectance values at 600 nm.

Fig. 5
figure 5

Plot of averages and confidence intervals (95 %) obtained at 440 nm (upper panel) and at 600 nm (lower panel) by performing a discriminant analysis to the gray level values of cashew samples classified as fluorescent (FS) and in the non-fluorescent stains (NFS) groups (440 nm, F = 78.38, p = 0.00; 600 nm, F = 74.54; p = 0.00). The x-axis corresponds to the categorical variable (FS and NFS) and the y-axis to the gray level values (nanometer)

Conclusions

The proposed image vision system, utilizing a LW-UV light and endowed with 520 and 480 nm or 440 and 600 nm filters, can be used to identify BGYF pistachio nuts and cashews, respectively, reducing the amount of aflatoxin-contaminated nuts that could reach the consumer. This system employs algorithms able to generate binary images of the sample with enhanced fluorescent stains in such a way that they stand out and allow automatic defect identification in a machine vision system. Even though the method described in this work does not determine the aflatoxin content directly, the integration of the proposed system into a grading machine for on-line detection of contaminated nuts would permit quick and easy control of every sample in a lot, identifying samples that should be tested for aflatoxin by chemical means, such as HPLC or ELISA. Finally, although fluorescence of products is not a definitive indicator of aflatoxin contamination, it is an indication that the conditions are favorable for growth of toxicogenic moulds or that the samples have been already infected by A. flavus or A. parasiticus.