# A Fast Processing Method of Foreign Fiber Images Based on HSV Color Space

Qinxiang Wang, Zhenbo Li, Jinxing Wang, Shuangxi Liu, Daoliang Li

► To cite this version:

Qinxiang Wang, Zhenbo Li, Jinxing Wang, Shuangxi Liu, Daoliang Li. A Fast Processing Method of Foreign Fiber Images Based on HSV Color Space. 6th Computer and Computing Technologies in Agriculture (CCTA), Oct 2012, Zhangjiajie, China. pp.390-397, 10.1007/978-3-642-36124-1_47. hal-01348123

HAL Id: hal-01348123

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

Submitted on 22 Jul 2016

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
A fast processing method of foreign fiber images based
on HSV color space

Qinxiang Wang¹, Zhenbo Li³⁴⁵, Jinxing Wang², Shuangxi Liu², Daoliang Li³⁴⁵*,

¹ Shandong Provincial Key Laboratory of Horticultural Machineries and Equipments,
Shandong Agricultural University, Taian 271018, China

² College of Mechanical and Electronic Engineering, Shandong Agricultural University, Taian 271018, China

³ China-EU Center for Information and Communication Technologies in Agriculture
of China Agriculture University, Beijing 100083, PR China

⁴ Beijing Engineering & Technology Research Center for Internet of Things in Agriculture, Beijing 100083, PR China

⁵ Key Laboratory of Agricultural Information Acquisition Technology, Ministry of Agriculture, Beijing 100083, PR China

**Abstract.** Traditionally, it was hard for image segmentation to suit the cotton image segmentation of foreign fibers. To solve this problem, this paper proposed an image segmentation method of foreign fibers based on HSV color space. The value of foreign fibers images' S channel was enhanced in this method to improve the contrast of foreign fiber and its background which help the subsequent image segmentation. The result of experiment shows that the method could highlight the images of foreign fibers, speed up subsequent image segmentation and realize fast image segmentation.

**Keywords:** Cotton, Foreign fibers, S channel, Image segmentation

* Corresponding author. Tel.: +86-10-62736764 Fax: +86-10-62737741

E-mail address: dliangl@cau.edu.cn

Postal address: P. O. Box 121, China Agricultural University, 17 Tsinghua East Road, Beijing
100083, PRC
# 1 Introduction

Foreign fibers in cotton refer to the fibers mix in the raw cotton production, process and transportation. These fibers are non-cotton fibers and colored fibers which terribly affected the cotton and its production (Li et al., 2006). Most of the cotton enterprises pick out foreign fibers artificially, which waste both time and energy (Li, 2006). Nowadays, Machine vision technology is the main method to process online automatic detection of foreign fibers.

The aim of image segmentation is to partition the image into meaningful connected components to extract the features of the objects (Zhang et al., 2011). The segmentation results are the foundation of all subsequent image analysis and understanding, such as object representation and description, feature measurement, object classification, and scene interpretation, etc. Thus, throughout the image processing, image segmentation is an extremely important aspect. Various image segmentation methods are reported in the literature (Bakker et al., 2008; Kim et al., 2003; Pichel et al., 2006). In recent years, researchers have developed more efficient but also more complicated methods for segmentation. The methods mentioned above may work well in their specific context, but they are not capable of segmenting images of cotton foreign fibers because of the low contrast (Zhang et al., 2011).

As a result, a non-linear enhancement method based on S channel of cotton images is proposed in this paper. First, the RGB color space of the original images is transformed into HSV, and the values of S channel are extracted. Second, the non-linear enhancement model is constructed via saturation histogram analysis. Finally, the best thresholding is got through the iterative method.

# 2 Samples and Methods

## 2.1 Sample Preparation

The foreign fibers used in this research, including feather, hair, hemp rope, plastic film, polypropylene twine, colored thread, pieces of cloth, etc., as shown in Fig. 1, were collected from cotton mills. Adequate pure lint without foreign fibers was also prepared for making the lint layer.
<figure><img src="image_2.png" /><figcaption>Fig. 1 Foreign fiber samples.</figcaption></figure>

## 2.2 Image acquisition

Put the prepared foreign fibers into sufficient lint without any of them before and opened the lint completely with opening machine. In the meantime, negative pressure was produced in the pipe through the fan, which leads the lint moving in it. Finally, an online scan industrial camera was used to scan these layer samples and acquire 24 bit true color images.

## 2.3 Choose of color space

Color spaces consist of many types such as RGB, HSV, YCbCr, CMY, etc. Acquired foreign fiber images are based on the RGB color space, a common color presentation method which is not suitable for human visual system. While HSV, describes the color with hue, saturation and value from the aspect of human visual system, is advantageous to the process and recognition of images. Hue refers to different colors,
saturation refers to the various shades and value refers to the degree of lightness and
darkness.

The conversion from RGB to HSV can be completed with the following formula

$$
\left\{
\begin{array}{ll}
H = \begin{cases} \theta & ; G \ge B \\ 2\pi - \theta & ; G \le B \end{cases} \\
S = 1 - \frac{3}{(R+G+B)} \left[ \min(R+G+B) \right] \\
V = \max(R, G, B)
\end{array}
\right.
\qquad (1)
$$

In (1), $\theta=\arccos\left\{\frac{[(R-G)+(R+B)]\times0.5}{\left[\left(R-G\right)^2+(R-B)(G-B)\right]^2}\right\}$, R, G, B respectively respond to different color component in collected images of foreign fibers in cotton; H, S, V, respectively response to saturation and brightness component of images after converted (Wei et al.,2008).

2.4 Saturation component enhancing method

The three typical types of the foreign fiber images and their saturation images are
shown as Fig. 2.
<figure><img src="image_3.png" /><figcaption>Fig. 2 (a) Three typical types of the foreign fiber images, (b) Foreign fiber saturation images.</figcaption></figure>

Image enhancement can be divided to two kinds, space domain enhancement and transform domain enhancement. Machine vision system always chooses space domain enhancement due to the requirement of speed.

Denote the saturation value of original image in the position of (x, y) to be S(x, y), the enhanced saturation value to be I(x, y)

$$I(x,y)=2\sqrt{|S(x,y)-\bar{S}|^3} \qquad (2)$$

In the formula, $\bar{S}=\frac{1}{ab}\sum_{x,y\in(a,b)}S(x,y)$, parameter S(x, y) is known, a, b successively

represent the length and width of image, as the size of collected images is 4096×128, so the formula of enhanced model can be defined as

$$I(x,y)=2\sqrt{|S(x,y)-\frac{1}{ab}\sum_{x,y\in(a,b)}S(x,y)|^3} \qquad (3)$$
## 2.5 Method of image segmentation

The identification of cotton foreign fibers is carried out through real-time monitoring. However, image segmentation threshold value will change when image collection environment changes. Therefore, this paper chooses iteration method to calculate threshold value of foreign fibers automatically on the premise of accuracy and speed.

Image segmentation procedures of iteration method are described as follows (Deng et al., 2010).

(1) To calculate the maximum saturation value Zmax and minimum saturation value Zmin of the saturation image, we define the original thresholding $T_0$={Tk|k=0} to be

$$T_0 = \frac{Z_{max} + Z_{min}}{2} \qquad (4)$$

(2) Segment the image into target and background according to thresholding Tk, and calculate their average saturation value (Zo and ZB).

$$Z_o = \frac{\sum_{Z(i,j)<T_i} Z(i,j) \times N(i,j)}{\sum_{Z(i,j)<T_i} N(i,j)} \qquad (5)$$

$$Z_B = \frac{\sum_{Z(i,j)>T_i} Z(i,j) \times N(i,j)}{\sum_{Z(i,j)>T_i} N(i,j)}$$

Z(i, j) is the image saturation value of the position (i, j), N(i, j) is the weight coefficient of position (i, j), generally take N(i, j)=1.0.

(3) New thresholding Tk+1 is Calculated.

$$T_{k+1} = \frac{Z_O + Z_B}{2} \qquad (5)$$

(4) Repeat steps (2) and (3), until the difference between Tk and Tk+1 is smaller than defined parameter or reach certain iteration times.

(5) Compare the thresholding Tk+1 with the saturation value of each pixel, if the
saturation value is bigger than Tk+1, the pixels will be set as target, otherwise, the pixels can be considered as the background. The formula is as following

$$g(i, j) = \begin{cases} 0, & f(i, j) < T_{k+1} \\ 1, & f(i, j) \ge T_{k+1} \end{cases} \tag{6}$$

# 3 Results and analysis

## 3.1 Analysis of enhanced result of foreign fiber in cotton

The images of foreign fiber shown in Fig. 2 are chosen as the input images. Fig. 3(a) is the enhanced images by histogram equalization, and Fig. 3(b) is the enhanced images based on the method of this paper.

<figure><img src="image_4.png" /><figcaption>Fig. 3 (a) Enhanced images by histogram equalization,</figcaption></figure>

<caption>(b) Enhanced images based on the method of this paper.</caption>

The results show that histogram equalization method can enhance not only the
foreign fiber targets but also the background. Therefore, it cannot increase the contrast between targets and background. The difficulty of segmentation hasn't been reduced. On the contrast, conclusion can be drawn that the segmentation method which is proposed in this paper can remain targets' details, in the meantime, inhibit the background effectively.

## 3.2 Analysis of image segmentation results

The contrastive result of 1000 images between direct iteration method and iteration based on enhancing method is shown in Fig. 4. The direct iteration method can be successful in handling the sliced foreign fibers such as paper and plastic pieces but not to the linear such as polypropylene yarn. The main reason is that the size of linear fibers in images is so small that the background is missed to recognize it as an object easily. Consequently, the approach proposed in this paper is more effective for segmentation of foreign fiber.

<figure><img src="image_5.png" /><figcaption>Fig. 4 Processed images using the iteration method:</figcaption></figure>

<caption>(a) segmentation results of the original saturation images,</caption>

<caption>(b) segmentation results of the enhanced saturation images.</caption>
4 Conclusions

(1) To speed up enhancement, according to the features of foreign fiber images, we adopt air space method to enhance foreign fiber images.

(2) This research adopts iteration method to segment images and obtains accuracy segment results which avoid the inaccuracy results created by direct iteration method.

References

1. Bindan Li, Tianhuai Ding, Dongyao Jia: Design of a sophisticated foreign fiber separator. J. Agricultural Machinery Journal. 37(1), 107–110 (2006).

2. Miaofu Li: Features and application of online foreign fiber detecting and clearing device. J. In: Shanghai Textile Science & Technology. 34(1), 15–18 (2006).

3. Xin Zhang, Daoliang Li, Wenzhu Yang, Jinxing Wang, Shuangxi Liu: A fast segmentation method for high-resolution color images of foreign fibers in cotton. J. Computers and Electronics in Agriculture. 78, 71–79. (2011)

4. Bakker, T., Wouters, H., Asselt van, K., Bontsema, J., Tang, L., Muller, J., Straten van, G: A vision based row detection system for sugar beet. J. Comput. Electron. Agric. 60 (1), 87—95 (2008).

5. Kim, B.G., Shim, J.I., Park, D.J: Fast image segmentation based on multiresolution analysis and wavelets. J. Pattern Recognit. Lett. 24 (6), 2995–3006 (2003).

6. Jieding Wei, Shumin Fei, Mulan Wang, Jianning Yuan: Research on the Segmentation Strategy of the Cotton Images on the Natural Condition Based upon the HSV Color-Space Model. J. Cotton Science. 20(1), 34—38 (2008).

7. Pichel, J.C., Singh, D.E., Rivera, F.F: Image segmentation based on merging of sub-optimal segmentations. J. Pattern Recognit. Lett. 27 (10), 1105–1116 (2006).

8. Linhua Deng, Jun Xu, Xiangming Cheng: Application Research on Segmentation Algorithm for Sun-image Based on Iteration Threshold. J. Computer and Modernization. 10, 72–74 (2010).
## Acknowledgement

This research was supported by Student's Science & Technology Innovation Fund of Huazhong Agricultural University “Research on the prediction of the acoustic performance for vehicle-use sound packages based on FE-SEA hybrid model” under grant Nos. 11028

## Biography

Qinxiang Wang is from Weifang city, Shandong province. He is dedicating the master degree in Shandong Agricultural University and majoring in image processing and pattern recognition.