# Effective Wavelengths Selection of Hyperspectral Images of Plastic Films in Cotton

Hang Zhang, Xi Qiao, Zhenbo Li, Daoliang Li

► To cite this version:

Hang Zhang, Xi Qiao, Zhenbo Li, Daoliang Li. Effective Wavelengths Selection of Hyperspectral Images of Plastic Films in Cotton. 9th International Conference on Computer and Computing Technologies in Agriculture (CCTA), Sep 2015, Beijing, China. pp.519-527, 10.1007/978-3-319-48357-3_48 hal-01557847

HAL Id: hal-01557847

https://inria.hal.science/hal-01557847

Submitted on 6 Jul 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Effective wavelengths selection of hyperspectral images of plastic films in cotton

Hang Zhang<sup>1,2,3</sup>, Xi Qiao<sup>1,3</sup>, Zhenbo Li<sup>1,3</sup> and Daoliang Li<sup>1,3,*</sup>

<sup>1</sup>College of Information and Electrical Engineering, China Agricultural University, Beijing 100083, China;

<sup>2</sup>College of Computer and Information Engineering, Tianjin Agricultural University, Tianjin 300384, China;

<sup>3</sup>Key Laboratory of Agricultural Information Acquisition Technology, Ministry of Agriculture, Beijing 100083, China

**Abstract:** This research was conducted to investigate the application of detecting plastic films in cotton using visible and near-infrared hyperspectral imaging. A line-scan hyperspectral imaging system (326-1100 nm) was used to detect plastic films mixed with cotton which was an important quality issue. Hyperspectral reflectance images were acquired and difference spectra of cotton and plastic films were extracted and analyzed to determine the dominant wavelengths. Also, as one of the most commonly used methods for dimensionality reduction, principal component analysis (PCA) was chosen to process the hyperspectral images. Afterwards, effective wavelengths were selected by analyzing the first three principal components (PCs) and six single-band images at 473.24 nm, 497.29 nm, 530.6 nm, 670.81 nm, 674.71 nm, and 955.68 nm were extracted respectively. Finally, the selected wavelengths were validated to prove the effectiveness. The results indicated that the selected wavelengths could be able to detect plastic films in cotton instead of the whole wavelengths.

**Keywords:** Hyperspectral imaging, difference spectra, principal component analysis, wavelengths selection

## 1 Introduction

The quality of cotton products is easily and seriously affected by foreign matter mixed into cotton during spinning, weaving, and dyeing. As one kind of foreign matter, plastic films are widely used to preserve soil temperature and moisture in China when growing cotton and make it a problem that a great many plastic films might be mixed with cotton when harvesting. They are easily to be broken into lots of very small pieces during spinning<sup>[1]</sup>, which make removal of them difficult and make breakability of cotton yarn increase. Therefore, it is crucial for us to detect and remove plastic films in cotton rapidly and accurately.

For the past two decades, computer vision technique has been applied to identify bark in cotton and determine the gravimetric bark content in cotton<sup>[2]</sup>, conduct automated visual inspection of cotton quality<sup>[3]</sup>, measure interlace of intermingled and false-twist textured yarns<sup>[4]</sup>, detect structural defects in textiles<sup>[5]</sup>, inspect and classify different types of foreign fibers<sup>[6, 7]</sup>, etc. Furthermore, research has also been conducted on plastic films. Fang et al.<sup>[1]</sup> used an online visual detection machine to acquire images of plastic films and proposed a new method to identify plastic films. The result showed that the prosed method improved the detection rate of plastic films and reduced the negative identification accuracy. Nevertheless, the average identification accuracy was still not very high (43.33%). In order to detect white foreign fibers (such as white plastic bags, white cotton cloth, transparent plastic films,

<footnote>* Corresponding author.</footnote>
etc.), Hua et al.[8] constructed a linear laser imaging system and carried out a series of experiments. The results indicated that it's still difficult to detect transparent plastic films although the contrast between object and background was increased effectively. Liu et al.[9] used linear laser cross-sectional imaging to distinguish typical white contaminants from cotton. 12 types of white contaminants including semitransparent plastic mulch and white plastic film were used in their experiment. The result indicated the detection rate was 97% for white plastic films and 95% for semitransparent plastic mulch.

As a promising technique, hyperspectral imaging has been used for detection of bruises on apples[10, 11], canker lesions on citruses[12], sprout damage and Fusarium head blight in wheat[13, 14], common defects on oranges[15], etc. However, very few researches have been reported for the application of this technique to evaluate cotton quality. To our knowledge, Guo et al.[16] firstly developed a hyperspectral imaging system in reflectance mode (422 nm-982 nm) to detect different trash on the surface of cotton including fine, colorless, light color, and white foreign matter. Nevertheless, the transparent polyethylene mulching films' recognition rates of training sets and test sets were only 41.7% and 53.8% respectively.

Furthermore, there are still some disadvantages for hyperspectral imaging technique to consider, such as higher cost and lower speed compared to conventional machine vision systems. Therefore, it is still important to investigate hyperspectral imaging for detecting plastic films in cotton and determine the effective wavelengths that can best characterize the features of plastic films.

# 2 Materials and methods

## 2.1 Samples

Cotton samples and plastic films with different sizes and shapes were collected from a local cotton processing plant. The cotton samples were made to flat layers and the length and width of the cotton layer were 255 mm and 175 mm, respectively. Some plastic films were put on the surface of the cotton layer randomly and the others were put into the cotton layer at the depth of 1-6 mm. The image of the plastic films was shown in Figure 1.
<figure><img src="image_2.png" /><figcaption>Fig. 1. Image of the plastic films.</figcaption></figure>

## 2.2 System setup

The assembled hyperspectral imaging system (Figure 2) consisted of a prism-grating-prism imaging spectrograph (ImSpector V10E), a standard 23 mm C-mount zoom lens, an EMCCD camera, two 150-watt halogen lamps, an electric displacement platform, an image capture software, and a computer with a frame grabber. The scanning speed was adjusted at 0.8 mm/s. The object distance was set to 45 cm throughout the test. The exposure time was 20 ms with a frame rate of 16.47 fps to build hyperspectral images (also called hypercube). The hyperspectral images were acquired at 1000 wavelength channels in the wavelengths from 326.7 nm to 1098 nm with an increment of 0.78 nm line by line. The image acquisition parameters were set by the Spectral Image and raw hyperspectral images with 1004×1420 pixels were obtained.

<figure><img src="image_3.png" /><figcaption>Fig. 2. Schematic of the hyperspectral imaging system.</figcaption></figure>

## 2.3 Image correction

In order to correct the raw images, a dark image and a white reference image were acquired separately. The equation below was used to correct the raw image:
$$I_C = I_R - I_D / I_W - I_D \quad (1)$$

In the equation, $I_R$ is the raw image, $I_W$ is the white reference image, $I_D$ is the dark image and $I_C$ is the corrected image. After image correction, the images at the first 170 wavelengths and last 80 wavelengths were cropped for their high level of noise and the size of hyperspectral images was then reduced to 600×400 pixels at 750 wavelength channels. A sample data cube of the corrected hyperspectral images was shown in Figure 3.

<figure><img src="image_4.png" /><figcaption>Fig. 3. Data cube of a hyperspectral image of plastic films in cotton.</figcaption></figure>

## 2.4 Wavelength selection

The regions of interest (ROIs) of hyperspectral images were used to extract spectra of cotton and plastic films and mean spectra that used for following processing were computed from the selected ROIs[17]. Then, difference spectra were calculated by subtracting the cotton spectra from plastic films spectra. The difference between the spectra of cotton and plastic films was compared and the wavelengths with local maxima were selected. Multivariate analysis methods were also usually used for the reduction of redundant information of hyperspectral data. As one of the mostly used statistical tools, principal component analysis (PCA) was adopted for dimensionality reduction by transforming original data (usually high correlated) into a new set of uncorrelated images that were called principal components (PCs) images. PCA loadings or eigenvectors were different among PCs images and the local maxima and/or local minimum corresponding wavelengths could be chosen as the determinative wavelengths. Most of the information could be carried by the images with selected effective wavelengths and might be more efficient for the following data processing[18].

# 3 Results and discussion

## 3.1 Difference spectra between cotton and plastic films

8 ROIs chosen from different locations on cotton and plastic films of every hyperspectral images in the 450-1035 nm region were selected to extract the spectral characteristics. The elliptic ROI areas with different sizes (about 80 to 200 pixels) were selected as representative areas of spectral reflectance. The extracted spectra of cotton and plastic films were averaged respectively and the average reflectance intensities from images in cotton were higher than those in plastic films. Then, the
mean spectra of cotton were subtracted from the mean spectra of plastic films to obtain the difference spectra. As shown in Figure 4, there were two local maxima at 497.29 nm and 670.81 nm indicating that the reflectance difference values of cotton and plastic films in these two wavelengths had large intensities and the two wavelengths could be selected as the dominant wavelengths. Thus, the images obtained from the two wavelengths could be used for further analysis.

<figure><img src="image_5.png" /><figcaption>Fig. 4. Difference spectra of cotton and plastic films and hyperspectral reflectance images at 497.29 nm and 670.81 nm.</figcaption></figure>

## 3.2 PCA on the whole wavelengths

The hyperspectral images after correction were subjected to PCA using the wavelengths in the spectral ranges (450-1035 nm). The representative PC1 to PC3 obtained from PCA accounted for over 96 percent of the total variance of all bands for the images of plastic films, thus the first three PC images could be an alternative to substitute the raw images for image processing and data analysis. Also, PCA could be used to conduct dimensionality reduction of hyperspectral images.

As shown in Figure 5, the resultant PC images indicated that the major features of plastic films became more evident, especially PC1 images. PC1 images represented the gray value information of the sample and provided more features of plastic films to make them be clearly identified. The plastic films in the PC2 images were brighter than those in the PC1 images. PC3 images were much noisy than the PC1 and PC2 images. PC2 images and PC3 images gave some other useful features for detection as well. The rest PCs depicted other features. However, starting from PC4 image, the transformed images did not give more meaningful information to detect plastic films.

<figure><img src="image_6.png" /></figure>
<caption>Fig. 5. The first three PC images obtained using the whole wavelengths</caption>

3.3 Selection of effective wavelengths

Based on the analysis results of PCA, several wavelengths of the hyperspectral
images could be selected as the effective wavelength and the corresponding images
could be used to represent the whole hyperspectral images.

The average weighing coefficients (eigenvectors) for the first three PCs of the
samples were obtained and plotted in Figure 6. A total of five effective wavelengths
that depicted as local minimum and maximum were selected, which were centered at
473.24 nm, 530.6 nm, 670.81 nm, 674.71 nm, and 955.68 nm, respectively.

<figure><img src="image_7.png" /><figcaption>Fig. 6. Weighing coefficients (eigenvectors) of first three PCs
obtained from principal component analysis.</figcaption></figure>

As aforementioned, 497.29 nm and 670.81 nm were the other two effective wavelengths that were selected in the difference spectra analysis. It could be found that the wavelength of 670.81nm was selected in the two different methods. Therefore, six wavelengths were chosen for analysis. It's quite obvious that five of the six selected wavelengths were in the visible spectral region suggesting that the visible region of spectrum (mainly the wavelengths in red and green regions) was critical for the identification. On the other hand, one near-infrared wavelength (955.68 nm) was also selected as the effective wavelength indicating that the near-infrared spectral region might have the possibility to detect plastic films in cotton. Further research could be conducted in the whole near-infrared spectral region to verify the feasibility.

3.4 Validation of selected wavelengths

PCA was then conducted on the six effective wavelengths (473.24 nm, 497.29 nm, 530.6 nm, 670.81 nm, 674.71 nm, and 955.68 nm). Figure 7 showed the first three PC images. As illustrated in Figure 7, PC1 and PC2 images were similar to those PC images previously obtained based on analysis of the full wavelength range although PC3 image was not quite the same to the corresponding one shown in Figure 5. Also, the first two PCs explained almost 98% (PC1: 92.09% and PC2: 5.92%) of the variance indicating that the selected wavelengths could be efficiently used for plastic
films detection in cotton. And the selected wavelengths could also be used to
construct a multispectral imaging system to detect plastic films in cotton in real time.

<figure><img src="image_8.png" /><figcaption>Fig. 7. The first three PC images obtained using the six effective wavelengths</figcaption></figure>

4 Conclusion

Hyperspectral reflectance images was acquired for the detection of plastic films in
cotton and a new wavelength selection method was proposed by combining difference
spectra analysis with principal component analysis.

Hyperspectral images were firstly acquired and corrected. The ROIs were then
selected and subjected to difference spectra analysis and two local maxima at 497.29
nm and 670.81 nm were chosen because the reflectance difference values of cotton
and plastic films in these two wavelengths had large intensities. Then, the
hyperspectral images were subjected to PCA and the effective wavelengths were
obtained by analyzing the first three PCs. Afterwards, six single-band images at
473.24 nm, 497.29 nm, 530.6 nm, 670.81 nm, 674.71 nm, and 955.68 nm were
extracted respectively. Finally, the selected wavelengths were validated by using PCA
and the effectiveness was proved. Furthermore, multispectral imaging systems could
be developed using the selected wavelengths to lower the cost and enhance the speed.

Acknowledgments

This work was supported by the National Natural Science Foundation of China
(31228016).

References

[1] Fang J, Jiang Y, Yue J, et al. A hybrid approach for efficient detection of plastic mulching films in cotton. Mathematical & Computer Modelling, 2013,58(3 - 4):834-841.

[2] Lieberman M, Bragg C K, Brennan S N. Determining gravimetric bark content in cotton with machine vision. Textile Research Journal, 1998,68(68):94-104.

[3] Tantaswadi P, Vilainatre J, Tamaree N, et al. Machine vision for automated visual inspection of cotton quality in textile industries using color isodiscrimination contour. Computers & Industrial Engineering, 1999,37(1-2):347-350.

[4] Millman M P, Acar M, Jackson M R. Computer vision for textured yarn interlace (nip) measurements at high speeds. Mechatronics, 2001,11(8):1025-1038.

[5] Abouelela A, Abbas H M, Eldeeb H, et al. Automated vision system for localizing structural defects in textile fabrics. Pattern Recognition Letters, 2005,26(10):1435-1443.

[6] Yang W, Li D, Zhu L, et al. A new approach for image processing in foreign fiber detection. Computers & Electronics in Agriculture, 2009,68(1):68-77.
[7] Li D, Yang W, Wang S. Classification of foreign fibers in cotton lint using machine vision and multi-class support vector machine. Computers & Electronics in Agriculture, 2010,74(2):274-279.

[8] Hua C, Su. White Foreign Fibers Detection in Cotton Using Line Laser. Nongye Jixie Xuebao/transactions of the Chinese Society of Agricultural Machinery, 2012,43(2):181-185.

[9] Liu F, Su Z, He X, et al. A laser imaging method for machine vision detection of white contaminants in cotton. Textile Research Journal, 2014,84(18):1987-1994.

[10] Lu R. DETECTION OF BRUISES ON APPLES USING NEAR - INFRARED HYPERSPECTRAL IMAGING. Transactions of the Asae, 2003,46(2):523-530.

[11] Xing J, Bravo C, Jancsók P T, et al. Detecting Bruises on 'Golden Delicious' Apples using Hyperspectral Imaging with Multiple Wavebands. Biosystems Engineering, 2005,90(1):27-36.

[12] Qin J, Burks T F, Kim M S, et al. Citrus canker detection using hyperspectral reflectance imaging and PCA-based image classification method. Sensing & Instrumentation for Food Quality & Safety, 2008,2(3):168-177.

[13] Xing J, Symons S, Shahin M, et al. Detection of sprout damage in Canada Western Red Spring wheat with multiple wavebands using visible/near-infrared hyperspectral imaging. Biosystems Engineering, 2010,106(2):188-194.

[14] Barbedo J G A, Tibola C S, Fernandes J M C. Detecting Fusarium head blight in wheat kernels using hyperspectral imaging. Biosystems Engineering, 2015,131:65-76.

[15] Li J, Rao X, Ying Y. Detection of common defects on oranges using hyperspectral reflectance imaging. Computers & Electronics in Agriculture, 2011,78(1):38-48.

[16] Guo J, Ying Y, Cheng F, et al. Detection of foreign materials on the surface of ginned cotton by hyper-spectral imaging. Nongye Gongcheng Xuebao/transactions of the Chinese Society of Agricultural Engineering, 2012,28(21):126-134.

[17] Qin J, Burks T F, Zhao X, et al. Multispectral Detection of Citrus Canker Using Hyperspectral Band Selection. Transactions of the Asabe, 2011,54(6):2331-2341.

[18] Wold J P, Jakobsen T, Krane L. Atlantic Salmon Average Fat Content Estimated by Near-Infrared Transmittance Spectroscopy. Journal of Food Science, 1996,61(61):74-77.