Vous êtes sur la page 1sur 93

FIBER PROPERTY CHARACTERIZATION

BY IMAGE PROCESSING

by

Huapeng Wang, B.E.

A Thesis

In

ELECTRICAL ENGINEERING

Submitted to the Graduate Faculty


of Texas Tech University in
Partial Fulfillment of
the Requirements for
the Degree of

MASTER OF SCIENCE

IN

ELECTRICAL ENGINEERING

Approved

Hamed Sari-Sarraf
Chairperson of the Committee

Eric Hequet

John Borrelli
Dean of the Graduate School

May,2007
Copyright 2007, Huapeng Wang
Texas Tech University, Huapeng Wang, 05/2007

ACKNOWLEDGEMENTS

First, I want to express my deepest appreciation to my advisor and my friend, Dr.


Hamed Sari-Sarraf. His encouragement and guidance throughout my research is really
important for me. And I would like to thank Dr.Eric Hequet, associate director of
International Textile Center. Whenever I need some help, he is right there with
genuine advice.
Finally, I would like to thank my family for their support in my whole life.

ii
Texas Tech University, Huapeng Wang, 05/2007

CONTENTS

ACKNOWLEDGEMENTS ........................................................................................ ii
ABSTRACT............................................................................................................... iv
LIST OF TABLES ...................................................................................................... v
LIST OF FIGURES ................................................................................................... vi
1 INTRODUCTION .................................................................................................. 1
1.1 Motivation....................................................................................................... 1
1.2 Introduction..................................................................................................... 2
1.3 Thesis Organization ........................................................................................ 4
2 RESEARCH APPROACH FOR FIBER LENGTH MEASUREMENT................ 5
2.1 Previous Approaches....................................................................................... 5
2.2 Fiber Length Measurement Algorithm ........................................................... 7
3 RESEARCH APPROACH FOR FIBER MATURITY MEASUREMENT......... 47
3.1 Motivation..................................................................................................... 47
3.2 Research Approach for Fiber Maturity Estimation....................................... 47
4 GUI FOR FIBER LENGTH MEASUREMENT .................................................. 49
4.1 Single Fiber Mode......................................................................................... 49
4.2 Batch Mode ................................................................................................... 52
5 EXPERIMENTS, ANALYSIS AND RESULTS ................................................. 57
5.1 Experiments for Testing the Fiber Length Calculation Algorithm ............... 57
5.2 Experiments for Testing the Fiber Maturity Calculation Algorithm ............ 73
6 CONCLUSIONS AND FUTURE WORKS ......................................................... 80
REFERENCES.......................................................................................................... 81

iii
Texas Tech University, Huapeng Wang, 05/2007

ABSTRACT

In this thesis, we intended to design and realize an imaging system for the
accurate measurement of cotton fiber length. A secondary objective was to incorporate
fiber maturity estimation into the system. Commercial systems measure fiber length in
a reasonable time span, however, the accuracy is questionable. Image processing
might be seen as an alternative method to the conventional systems, but the processing
time is an issue. Our prototype system is composed of an off-the-shelf scanner that
generates a grayscale image of multiple fibers, followed by customized image
processing algorithms that compute the length of each fiber in the image. Although the
system requires some degree of separation between the individual fibers, it is shown to
produce highly accurate length measurements that are invariant to fiber orientation,
shape, inter-fiber intersections, and intra-fiber crimps and crossovers. Hence, in its
present state, the proposed system serves as an excellent reference method for
assessing the efficacy of commercially available length measurement systems.

iv
Texas Tech University, Huapeng Wang, 05/2007

LIST OF TABLES

5.1 Length of the 4-inch optical fiber with different shapes .................................... 59
5.2 Length statistics for cotton fibers used in AFIS and the proposed algorithm.... 66
5.3 Error rate of the proposed algorithm.................................................................. 72
5.4 Mean length (L(n)) comparison table ................................................................ 72

v
Texas Tech University, Huapeng Wang, 05/2007

LIST OF FIGURES

1.1 Scanned fiber images (a) single fiber (b) multiple fibers.................................... 1
2.1 DSSs for the digital region S............................................................................... 5
2.2 (a) Original cotton fiber image (b) MA by using distance transform ................. 6
2.3 Flowchart of fiber length measurement algorithm.............................................. 7
2.4 Four forbidden fiber arrangements...................................................................... 8
2.5 Average filter mask ............................................................................................. 9
2.6 Fiber smoothing (a) Fiber image before smoothing
(b) Fiber image after smoothing.......................................................................... 9
2.7 (a) Image with less noise in the background and more fibers
(b) Image with more noise in the background and less fibers........................... 10
2.8 Histograms of the images in Figure 2.7 ............................................................ 11
2.9 Scale-space representations of the histogram curves ........................................ 12
2.10 Binary images of the original images in Figure 2.7.......................................... 12
2.11 (a) Binary image before image closing (b) Binary image after image closing . 13
2.12 (a) Binary image before noise removal (b) Binary image after noise removal. 13
2.13 (a) Original image (b) Binary image after thresholding and background noise
removal.............................................................................................................. 14
2.14 Eight mask groups............................................................................................. 15
2.15 Four masks in mask group 1 ............................................................................. 15
2.16 Weight mask ..................................................................................................... 16
2.17 Boundary pixels removal by mask group 1 ...................................................... 16
2.18 An example of skeletonizing (a) Original Image (b)-(i) Images after being
consecutively skeletonized by eight mask groups (j) Medial axis.................... 17
2.19 Medial axis image of cotton fibers.................................................................... 18
2.20 (a) endpoint (b) medial point (c) junction point.............................................. 19
2.21 Junctions caused by four different conditions................................................... 19
2.22 Junction categories............................................................................................ 20
2.23 Three conditions that may cause junction a ................................................... 21
2.24 Flowchart of junction a identification ............................................................ 21
2.25 (a1) Before junction range removal (a2) After junction range removal ........... 21
2.26 Flowchart for the modification of junction a.................................................. 22
2.27 (a) Junction a before branch removal (b) Junction a after branch removal . 22
2.28 A special case for longer branch removal ......................................................... 23
2.29 (a) Medial axis with L corner (b) Two new endpoints
(c) L corner is replaced by a straight line ....................................................... 24
2.30 Flowchart of junction b identification ............................................................ 25
2.31 (b1) Before junction range removal (b2) After junction range removal........... 25
2.32 Flowchart for the modification of junction b ................................................. 25
2.33 (a) Junction b before branch removal (b) Junction b after branch removal (c)
Junction b after endpoint extension................................................................ 26
2.34 Medial axis image before and after modification ............................................. 26
2.35 X junction ....................................................................................................... 27
2.36 T junction ....................................................................................................... 27
2.37 Flowchart for the modification of junction c and junction d ....................... 27
vi
Texas Tech University, Huapeng Wang, 05/2007

2.38 Junction point group and junction bar............................................................... 28


2.39 Two forbidden fiber arrangement cases............................................................ 29
2.40 Image before and after junction range deletion................................................. 29
2.41 Medial axis image with all segments labeled.................................................... 30
2.42 Medial axis image with all X1 junction and X2 junction categorized......... 31
2.43 Reconstruction the X junctions in the circle .................................................. 32
2.44 Medial axis of self-crossing before and after junction a modification........... 33
2.45 Medial axis image with T1 junction categorized ........................................... 33
2.46 Reconstruction of the T1 junction in the circle .............................................. 34
2.47 One special case that needs to be avoided in image acquisition ....................... 34
2.48 Medial axis image with T2 junction categorized ........................................... 35
2.49 Direction vectors in the T2 junction range ..................................................... 35
2.50 Reconstruction of T2 junction ........................................................................ 36
2.51 (a) Vertical offsets (b) perpendicular offsets .................................................... 37
2.52 Flowchart of curve fitting with ACPS .............................................................. 40
2.53 Eight-neighbors of the center pixel ................................................................... 40
2.54 Flowchart for setting the critical points ............................................................ 41
2.55 An example of determining critical points (circled pixels)............................... 41
2.56 Modified medial axis with critical points indicated in gray.............................. 42
2.57 Medial axis with critical points in gray and endpoints in white ....................... 43
2.58 Medial axis with control points indicated in empty circle, critical points
in gray and endpoints in white .......................................................................... 43
2.59 Medial axis with control points indicated in empty circle, critical points
in gray and endpoints in white .......................................................................... 44
2.60 Medial axis with control points indicated in empty circle
and critical points in gray.................................................................................. 44
2.61 Result after piece-wise curve fitting with ACPS .............................................. 45
2.62 An example of checking accuracy .................................................................... 45
4.1 Interface of single fiber mode ........................................................................... 49
4.2 Display options in single fiber mode: Original (left) and Complement (right) 50
4.3 Pop-up dialog box for loading the image.......................................................... 50
4.4 Pop-up dialog box for saving the cropped image.............................................. 51
4.5 Waiting bar........................................................................................................ 51
4.6 Four intermediate figures (a) Binarized image (b) Medial axis image after axis
modifications (c) Individualized fiber (Here, only one fiber is shown) (d) Fitted
curve of each fiber............................................................................................. 52
4.7 Interface of batch mode..................................................................................... 53
4.8 Dialog box for changing the working directory................................................ 53
4.9 Length Distribution ........................................................................................... 54
4.10 (a) Dialog for saving the length distribution (b) Dialog for printing the length
distribution ........................................................................................................ 54
4.11 Generated excel data ......................................................................................... 55
4.12 Image with detected fibers indicated ................................................................ 55
4.13 Useful parameters ............................................................................................. 56
5.1 Micro ruler ........................................................................................................ 58
5.2 Eight-connected neighbors of the current pixel ................................................ 58
vii
Texas Tech University, Huapeng Wang, 05/2007

5.3 (a) MA before curve fitting (b) MA after curve fitting..................................... 60


5.4 1.5-inch nylon fiber (a) shape 1 (b) shape 2 (c) shape 3 ................................... 60
5.5 Measured fiber length of the vertical shape ...................................................... 61
5.6 Measured fiber length of the C-shape ............................................................... 61
5.7 Measured fiber length of the S-shape ............................................................... 61
5.8 Length distribution of 3/16 inch bundle at three different resolutions.............. 62
5.9 Length distribution of 5/16 inch bundle at three different resolutions.............. 62
5.10 Length distribution of 7/16 inch bundle at three different resolutions.............. 63
5.11 Length distribution of 9/16 inch bundle at three different resolutions.............. 63
5.12 Length distribution of 11/16 inch bundle at three different resolutions............ 63
5.13 Length distribution of 13/16 inch bundle at three different resolutions............ 64
5.14 Length distribution of 15/16 inch bundle at three different resolutions............ 64
5.15 Length distribution of 17/16 inch bundle at three different resolutions............ 64
5.16 Length distribution of 19/16 inch bundle at three different resolutions............ 65
5.17 Length distribution of 21/16 inch bundle at three different resolutions............ 65
5.18 Length distribution of 23/16 inch bundle at three different resolutions............ 65
5.19 Length distribution by AFIS and by proposed image analysis system ............. 66
5.20 (a) Original fiber image (b) Saved image with detected fibers indicated ......... 68
5.21 Sample P271 (a) Histogram from the accurate data set
(b) Histogram from the whole data set.............................................................. 68
5.22 Sample P297 (a) Histogram from the accurate data set
(b) Histogram from the whole data set ............................................................. 69
5.23 Sample P472 (a) Histogram from the accurate data set
(b) Histogram from the whole data set............................................................ 69
5.24 Sample P028 (a) Histogram from the accurate data set
(b) Histogram from the whole data set.............................................................. 69
5.25 Sample P401 (a) Histogram from the accurate data set
(b) Histogram from the whole data set.............................................................. 70
5.26 Sample P341 (a) Histogram from the accurate data set
(b) Histogram from the whole data set.............................................................. 70
5.27 Sample P435 (a) Histogram from the accurate data set
(b) Histogram from the whole data set.............................................................. 70
5.28 Sample P476 (a) Histogram from the accurate data set
(b) Histogram from the whole data set.............................................................. 71
5.29 Sample P243 (a) Histogram from the accurate data set
(b) Histogram from the whole data set.............................................................. 71
5.30 Sample P238 (a) Histogram from the accurate data set
(b) Histogram from the whole data set.............................................................. 71
5.31 Mean comparison in grayscale channel _ experiment 1 ................................... 73
5.32 Variance comparison in grayscale channel _ experiment 1 .............................. 74
5.33 Mean comparison in grayscale channel _ experiment 2 ................................... 74
5.34 Mean comparison in red channel _experiment 274
5.35 Mean comparison in green channel _experiment 2 .......................................... 75
5.36 Mean comparison in blue channel _experiment 2 ............................................ 75
5.37 Mean comparison in hue channel _experiment 2.............................................. 75
5.38 Mean comparison in saturation channel _experiment 2.................................... 76
viii
Texas Tech University, Huapeng Wang, 05/2007

5.39 Mean comparison in value channel _experiment 2........................................... 76


5.40 Variance comparison in grayscale channel _experiment 2 ............................... 76
5.41 Variance comparison in red channel _experiment 2 ......................................... 77
5.42 Variance comparison in green channel _experiment 2 ..................................... 77
5.43 Variance comparison in blue channel _experiment 2 ....................................... 77
5.44 Variance comparison in hue channel _experiment 2 ........................................ 78
5.45 Variance comparison in saturation channel _experiment 2 .............................. 78
5.46 Variance comparison in value channel _experiment 2 ..................................... 78

ix
Texas Tech University, Huapeng Wang, 05/2007

CHAPTER 1

INTRODUCTION

1.1 Motivation

Length is one of the most important properties of cotton fibers. Length is highly
related to other cotton fiber characteristics such as strength, fineness and maturity.
Because longer fibers are generally stronger, finer and more uniform than shorter
fibers, they have a much higher price in the market. Furthermore, fiber length
distribuction also affects the yarn quality such as strength, hairiness and evenness.
Therefore, it is important to determine the accurate length distribution of cotton fibers.
This thesis explores a new algorithm to measure fiber length by using the scanned
images of cotton fibers (Figure 1.1). The new algorithm gives an accurate
measurement of fiber length, which could be used as reference data for other indirect
measurements of cotton fiber length. The algorithm analyzes and modifies the medial
axis representation, producing accurate length measurements, while providing the
ability to process multiple fibers (Figure 1.1 (b)) in the same image. The digitization
errors are curtailed using a piecewise polynomial curve fitting with adaptive control
point selection (ACPS). We have designed a Matlab Graphical User Interface (GUI) to
test the algorithm and our to-date experiments clearly indicate that the proposed
method can provide accurate fiber length measurements (i.e., relative errors of 1% or
less) with invariance to inter- and intra-fiber crossovers.

Figure 1.1: Scanned fiber images (a) single fiber (b) multiple fibers
1
Texas Tech University, Huapeng Wang, 05/2007

1.2 Introduction

Oiled-Plate method and Array method are two of the research approaches for fiber
length measurement. They are both time-consuming and need a skilled operator in
order to get accurate results. The current commercial systems that are used for fiber
length measurement include High Volume Instrumentation (HVI) and the Advanced
Fiber Information System (AFIS) [1-3]. The HVI system scans fiber beard and based
on the amount of light that passes the beard, this method can indirectly calculate the
number of fibers to different extension. The HVI system is not efficient for measuring
Short Fiber Content (SFC) since many of the short fibers are hidden from the clamp
while scanning and they are ignored by the system. The Advanced Fiber Information
System (AFIS) is the most preferred for fiber length measurement. This system uses
mechanical means to individualize the fibers of a lint sample and then proceeds to
measure their various physical characteristics, including fiber length. Simply put,
AFIS accomplishes this by transporting the individualized fibers aerodynamically to
thread an assembly of a photodetector and an illumination source. The change in the
detector signal is then recorded as the fiber passes through the beam of light.
Ultimately, the fiber length is calculated by multiplying the speed of the fiber with the
time duration of the recorded signal. As AFIS uses a single detector, it is oblivious to
the orientation and curvature of the fibers in the air stream. This causes, among other
problems, an underestimation of fiber length or, equivalently, an overestimation of the
short fiber content (SFC) of the sample [4].
Much research has demonstrated that important cotton properties are measurable
by image processing. In previous research, Ikiz et al. [5-6] showed that an imaging
system could provide more accurate and precise measurements of fiber length. His
work shows great improvement over the current industry systems in terms of accuracy.
This research was the impetus for the work by Stroupe [7], who proposed a method of
cotton fiber delivery from a lint sample to an imaging system. Ikiz uses a CCD camera
with 256 gray levels to acquire the fiber images. Then he arranges the fibers in such a
way that there is either an individual fiber or only two fibers crossing over in each
image. A global thresholding is implemented to distinguish between the background
and the fibers. The centerpiece of the method proposed by Ikiz [6] is the computation
2
Texas Tech University, Huapeng Wang, 05/2007

of the medial axis from the captured images, which is used together with an ad hoc
adjustment formula, to estimate the fiber length. This method, while taking a major
step in the right direction, suffers from two main shortcomings. First, it attempts to
account for the digitization errors, which are introduced by representing the
curvilinear fiber with its medial axis, by introducing an adjustment formula. Secondly,
it cannot handle an image that contains multiple fibers. U.Heitmann [8] compares the
image-analysis measurement method with other test methods. This approach can
handle multiple-fiber image of certain fiber arrangements, but the accuracy is
questionable since in this work, the image analysis Mean Length by number is 2mm
shorter than AFIS Mean Length and we know that AFIS underestimates fiber length.
Cross-Sectional [9] and longitudinal [10] methods are two approaches to measure
the fiber maturity by image processing. They are both based on the microscopy system
and the fibers must be carefully cropped before acquiring the images.
In this thesis, for fiber length measurement, we have developed a new algorithm
that can process multiple-fiber images with both inter-fiber and intra-fiber crossings.
All the images are acquired under controlled conditions with an off-the-shelf scanner.
After getting the medial axis (MA) by morphology-based operations, we modify the
MAs to ensure that they have one pixel width without disconnectivity, which is useful
for fiber individualization. Then, a piece-wise polynomial curve fitting with adaptive
control point selection (ACPS) is designed for each individualized fiber to compensate
for the digitization error. We also intend to incorporate the fiber maturity estimation
with the fiber length measurement.
The long-term objectives of this work are as follows,
Capture a high-resolution image of multiple cotton fibers in real time while the
fibers are airborne.
From the captured image and using image processing techniques, extract defining
characteristics of the cotton fibers. These will certainly include the true fiber
length, but other features such as fiber maturity, fiber crimp and twist may also be
ascertained.

3
Texas Tech University, Huapeng Wang, 05/2007

In this thesis, we only focus on investigating the feasibility to calculate the true
fiber length and estimate the fiber maturity by image processing. The next step is to
set up a real-time system.

1.3 Thesis organization

The thesis is organized as follows: Chapter 2 proposes and explains the length
measurement algorithm in detail and chapter 3 bring forward a way to estimate fiber
maturity. In chapter 4, we explain the designed Matlab Graphical User Interface (GUI)
for testing the algorithm. Then all the experimental results for the new algorithm are
shown and analyzed in chapter 5. Finally, chapter 6 points out our future work.

4
Texas Tech University, Huapeng Wang, 05/2007

CHAPTER 2

RESEARCH APPROACH FOR FIBER LENGTH

MEASUREMENT

2.1 Previous Approaches

2.1.1 Digital Straight Segment (DSS)


A typical fiber is around 26 millimeters in length but only about 20 microns in
width. Hence, half of the fiber perimeter may provide a reasonable estimate of the
fiber length So our first approach is to try to find the perimeter of cotton fiber by using
DSS and then the fiber length is estimated as half of the perimeter.
Like the boundary of digital region S in Figure 2.1, the fiber boundary in the
binary image is an alternating sequence of vertices and edges. A digital straight
segment (DSS) [11] is a finite, alternating sequence of vertices and edges whose union
is a connected subset of the frontier of the object S. The DSS algorithm detects for
each maximum length DSS the coordinates of its end points and calculates the length
of each DSS as the Euclidean distance between these two points. The sum of the
lengths of these DSSs is finally used as the estimate of the perimeter.
Shortcomings of the DSS algorithm:
It has a large relative error.
Since the DSS algorithm is highly dependent on an accurate digital
boundary of the cotton fiber, this will cause problems when the
background is noisy or the preprocessing step cannot remove all the noise
attached to the fiber.

Figure 2.1: DSSs for the digital region S


5
Texas Tech University, Huapeng Wang, 05/2007

2.1.2 Distance transform


Our second approach is based on calculating the medial axis (MA) of the cotton
fiber. Generally speaking, MA consists of the set of points that are equally distant
from two closest points of an object boundary and MA is an excellent shape indicator
of cotton fiber. In this thesis, two methods are implemented in order to obtain the MA:
distance transform [12] and morphology-based transform [13-16]. In this section, we
explain the distance transform method and later in section 2.2, the algorithm based on
the second approach is presented.
In the distance transform [12], each pixel of the object has a label with the distance
of the shortest path to the background and the MA is defined as the local maximum of
the distance transform labels. The algorithm is simply implemented by eight scan
operations.

Figure 2.2: (a) Original cotton fiber image (b) MA by using distance transform

The MA calculated by distance transform is disconnected and sometimes has more


than 1 pixel in width, so we choose morphology-based transform in order to obtain the
MA.
In section 2.2, the entire algorithm is explained step by step. The new algorithm
aims to calculate fiber length in images with multiple fibers. After using the
morphology-based transform, we introduce our modified method to ensure that MAs
have one pixel width without disconnectivity, which is essential for fiber
individualization. Then, a piece-wise polynomial curve fitting with adaptive control
point selection (ACPS) is designed for each individualized fiber.
6
Texas Tech University, Huapeng Wang, 05/2007

2.2 Fiber Length Measurement Algorithm

In the thesis, a new algorithm is presented to make an accurate calculation of fiber


length. The algorithm involves a sequence of steps specially designed for handling the
problems present in the scanned fiber images.
The fiber length measurement algorithm can be summarized as follows:

Prepare cotton fiber samples


Step1: and acquire the images

Preprocess the scanned image


Step2: to obtain a binary image

Bridging broken fiber segments


Step3: and removing noise from the
background

Step4: Obtain the medial axis of the


fiber in the binary image

Step5: Modify the medial axis and


individualize the fibers by
analyzing junctions

Curve fitting with adaptive


Step6: control point selection

Step7: Fiber length calculation

Figure 2.3: Flowchart of fiber length measurement algorithm

2.2.1 Prepare cotton fiber samples and acquire the images (step1)
This step involves the acquisition of images of cotton fibers using a commercial
scanner. In order to make the background as clean as possible, we first spread some
ethanol on the screen of the scanner. Then we use a piece of cloth to clean it until there
is no visible mark on the screen. By using the tweezers, we carefully pick up
7
Texas Tech University, Huapeng Wang, 05/2007

individual fibers from sample bags and put them on the screen. We can allow some
crossings as well as loops for multiple fibers, but some degree of manual separation is
needed to make sure none of the following fiber arrangements appears:
More than two fibers cross at the same point (Figure 2.4 (a)).
Overlap of two fibers is six times longer than the fiber width (Figure 2.4 (b)).
A. The distance of the crossing point from any endpoint is less than two times the
fiber width (Figure 2.4 (c)).
Two fibers cross in more than one point and these points are less than six times
the fiber width apart (Figure 2.4 (d)).

Figure 2.4 Four forbidden fiber arrangements

We will explain the reasons for these forbidden cases later in section 2.2.5.
After setting down the fibers on the scanner bed, we put clean glass slides on top
of the fibers. In order to eliminate the noise in the background, we open the scanner
cover while scanning so that most of the noise in the background is out of focus. The
resolution of the scanned images is a big concern in this method, since high resolution
images will require long processing times and low resolution images will not contain
adequate information for length measurement. The scanner resolution is set at 1000
dpi to ensure that cotton fibers, whose ribbon widths range from 20 to 30 m, are
represented with at least one pixel. Note that undersampling in this way is not
8
Texas Tech University, Huapeng Wang, 05/2007

expected to cause any problems because, clearly, length measurements do not require
us to resolve the width of the fibers. In fact, fewer pixels in the radial direction will
render the ensuing medial axis computation more efficient. In the scanned images, the
area covered by fibers has significantly higher gray values than the background, and
pixels near the fiber edges have intermediate gray values, forming a transition band
between the fiber and the background.

2.2.2 Preprocess the scanned image to obtain a binary image (step2)


2.2.2.1 Preprocess the grayscale images
The purpose of preprocessing is to reduce the noise in the background. Since the
fiber segments at endpoints are usually thinner than the part in the middle, after
scanning, some portions inside the fiber may contain pixels that have much lower gray
values (Figure 2.6 (a)).
In this algorithm, we need to bring some uniformity to the gray values of the fibers
and also reduce the noise in the background. So an averaging filter is used to smooth
the fiber images [17] before image binarization. The neighborhood averaging is
accomplished by convolving the original fiber images with the mask shown in Figure
2.5. The fiber image after smoothing is shown in Figure 2.6 (b).
1/9 1/9 1/9
1/9 1/9 1/9
1/9 1/9 1/9
Figure 2.5: Average filter mask

Figure 2.6 Fiber smoothing (a) Fiber image before smoothing (b) Fiber image after smoothing
2.2.2.2 Threshold the grayscale images
9
Texas Tech University, Huapeng Wang, 05/2007

In this algorithm, we can simply use a global threshold value to binarize the
scanned images since the images are acquired under controlled conditions and the
background is kept out of focus. We use two methods to pick up the gray value for
thresholding.
a. Based on our experiments with hundreds of fiber images, a fixed gray value of 15
can be applied to the whole image. When the intensity value of a pixel is higher
than 15, it will be set to white in the binary image, and otherwise set to black.
b. By analyzing the histogram of the scanned fiber images, we can pick up an
adaptive gray value for global thresholding. This method can dynamically adjust
the threshold value to compensate for changes in the size of the images and the
number of fibers in each image.
A histogram is a distribution of the pixels against the gray scale, revealing
allocations of pixels belonging to the fibers and background. The histograms of the
two images in Figure 2.7 are presented in Figure 2.8. Based on our experiments,
since the gray values in the range of 0 to 10 always represent the background, we
simply make the histogram value in that range to be 0. As shown in Figure 2.8,
both histograms have two distinct modes and the pixel counts decrease gradually
toward the valley between the two peaks. The mode towards the high gray values
corresponds to the fibers in the scanned image. The other mode corresponds to the
background noise. The valley between the two peaks indicates both the fiber and
the background noise.

Figure 2.7 (a) Image with less noise in the background and more fibers (b) Image with more
noise in the background and less fibers

10
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.8: Histograms of the images in Figure 2.7

At this point, the valley value (Gv) between the two peaks seems to be a
reasonable threshold value that separates the fiber from the background. The
approximate value of Gv is obtained from a scale-space representation and then
refined using equation (2.1).
Threshold = Gv c * ( Sb / S f ) (2.1)

where c is a coefficient that can be experimentally determined. Sb indicates the


size of the mode for background noise. It is the sum of pixel counts before Gv. Sf
indicates the size of the mode for fibers. It is the sum of pixel counts after Gv. In
this study, we have found that a value of 12 is effective for the coefficient.
In the scale space, we increase the scale value until only one valley is left in
the smoothed histogram curve, as shown in Figure 2.9. Here, the intention is to
choose the threshold low enough to make sure that the fiber is not left broken,
which may cause the risk of leaving some background noise.

11
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.9: Scale-space representations of the histogram curves

Figure 2.10 shows the binary images obtained from the original images in Figure 2.7.

Figure 2.10: Binary images of the original images in Figure 2.7.

2.2.3 Bridging broken fiber segments and removing noise from the background
After global thresholding, image closing [17] and noise removal are necessary
steps to bridge the gaps of cotton fibers and to remove the noise from the background.
2.2.3.1 Bridging broken fiber segments by image closing
Closing is one of the fundamental operations in morphological image processing
[17]. It generally fuses narrow breaks, eliminates small holes, and fills gaps in the
contours.
In this algorithm, we use a disk structuring element with a radius of 3. The reason
for picking such a structuring element is that in most experiments, the gap size was
found to be less than 5 pixels in length. Figure 2.11 shows the result before and after
image closing.
12
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.11 (a) Binary image before image closing (b) Binary image after image closing

2.2.3.2 Background noise removal


In the binary images, after image closing, there is usually some noise in the
background. Connected component analysis [17] is used here to eliminate the
background noise using a size filter.
After labeling [18] the 8-connected components in the binary image, we count the
number of pixels in each object. Any object that is less than 50 pixels in size is treated
as noise and deleted from the binary image. The size of 50 pixels is chosen for the
following reason.
Any fiber that is shorter than 0.01inch is not of practical interest in length
measurement, which means at 1000 dpi, any object that is shorter than 10
pixels can be deleted. The typical fiber width in this resolution is constantly
about 5 pixels, so the lower boundary of the cotton fiber size is 50 pixels.
The binary images before and after noise removal are shown in Figure 2.12.

Figure 2.12: (a) Binary image before noise removal (b) Binary image after noise removal

In what follows, we use a typical image with multiple cotton fibers to explain the
remaining steps of the proposed algorithm. Figure 2.13 (a) is the original grayscale
image and Figure 2.13 (b) is the binary cotton fiber image after thresholding and
13
Texas Tech University, Huapeng Wang, 05/2007

removing background noise. As shown in Figure 2.13 (a), five fibers are arranged in
this image. Two of them are relatively short (2, 4) and two of them have loops (3, 5).

Figure 2.13 (a) Original image (b) Binary image after thresholding and background noise
removal

2.2.4 Obtain the medial axis of the fiber image (step4)


2.2.4.1 Medial axis definition
Generally speaking, the MA consists of the set of points that are equally distant
from two closest points of an object boundary and the MA is an excellent shape
indicator of cotton fiber.
2.2.4.2 Obtain the medial axis
In our algorithm, the medial axis is found by the Matlab function bwmorph [13-
16], which is based on morphology operations. The way to find the medial axis
involves progressive removal of the current boundary pixels from the objects, which is
based on the hit or miss transformation.
The concept of hit or miss transformation is simple. A binary mask of odd size is
specified and then scanned over the image. If the pixel values under the mask match
the pixel values of the mask (hit), the center pixel of the overlapped region in the
image is set to white, otherwise (miss), it is set to black.
In one iteration, 48 masks are used to remove the boundary pixels of the object
without allowing the object to break apart. All the 48 masks are grouped into 8 mask
groups, as shown in Figure 2.14. Mask groups 1, 3, 5 and 7 contain 4 masks, while
mask groups 2, 4, 6 and 8 contain 8 masks. As an example, Figure 2.15 shows the 4
masks in mask group 1.
14
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.14 Eight mask groups

Figure 2.15: Four masks in mask group 1


15
Texas Tech University, Huapeng Wang, 05/2007

Suppose we represent the original binarized image as the shape indicated by A in


Figure 2.17. Each removing step by one mask group includes the following sub-steps:
a. Get the hit or miss transform image B by the mask group 1.
First, we define a 3 by 3 weight mask, as shown in Figure 2.16. Then all the 48
masks are overlapped with the weight mask one by one and the sum of
multiplication (SOM) between each two overlapped cells is the valid code
specifically created for each mask.
20 21 22

23 24 25

26 27 28

Figure 2.16: Weight mask

Take mask 1 in Figure 2.15 as an example. The valid code for this mask is
calculated by equation 2.2.

Valid Code = 120+121+122+023+124+025+026+027+028 = 23 (2.2)

After creating the valid codes (23, 55, 31 and 63) for mask group 1, we scan
the weight mask over the entire image A, calculate a code for each overlapped
region using SOM and compare this code with the valid codes for mask group 1. If
there is a match, which means the pattern of this region in image A is the same as
one of the masks in mask group 1 (hit), the center pixel of this region is set to
white, otherwise (miss), it is set to black.
b. In the binary image B, we set the white pixel to black and black pixel to
white, so we build the inverse image ~B.
c. The boundary pixels are removed by the operation A and (~B).

Figure 2.17: Boundary pixels removal by mask group 1


16
Texas Tech University, Huapeng Wang, 05/2007

The sub-steps described above are executed consecutively 8 times by using 8


different mask groups in one iteration. We show an example of skeletonization in one
iteration, as well as the final medial axis for shape A in Figure 2.18.

Figure 2.18 An example of skeletonizing (a) Original Image (b)-(i) Images after being
consecutively skeletonized by eight mask groups (j) Medial axis

From this example, we can see that each mask group is responsible for removing
the boundary pixels in one specific direction. The iteration continues until no further
pixels are removed from the boundary of the object.
2.2.4.3 Medial axis image of multiple cotton fibers
The medial axis image for multiple cotton fibers is shown Figure 2.19. From this
point on, when we use the term delete or remove, it means setting the white pixel,
which correspond to the medial axis, values to black.

17
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.19 Medial axis image of cotton fibers

2.2.5 Modify the medial axis and individualize the fibers by analyzing junctions
(Step5)
In this step, we basically try to modify four types of junctions (a, b, c, d). Junction
a and junction b are modified separately while we treat junction c and junction d
together.
2.2.5.1 Medial axis pixel definition
We introduce some definitions of the medial axis pixels in advance. Since the
medial axis is continuous and has one pixel in width, we divide the medial axis pixels
into 3 categories based on how many white neighbors a medial axis pixel has (Figure
2.20):
The medial axis pixels that have one white neighbor are defined as endpoints
(Figure 2.20 (a)).
The medial axis pixels that have two white neighbors are defined as medial
points (Figure 2.20 (b)).
The medial axis pixels that have 3 or more white neighbors are defined as
junction points (Figure 2.20 (c)).

18
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.20 (a) endpoint (b)medial point (c) junction point

2.2.5.2 Four conditions that can cause junction points


As shown in Figure 2.21, four conditions can cause junction points in the medial
axis image:
a A bump on one side of the fiber
b The tips of the fiber almost always introduce junction points.
c A self-crossing (loop)
d A crossing by two different fibers

Figure 2.21: Junctions caused by four different conditions


19
Texas Tech University, Huapeng Wang, 05/2007

In Figure 2.21, each junction point is indicated by a small black circle. We notice
that for junction a and junction b, there is always one group of junction points in
the junction range. For junction c and junction d, in most of the cases, two groups
of junction points are in the junction range while sometimes one group of junction
points is in the junction range.
We subdivide junction c into X1 junction and T1 junction. Also junction d can
be subdivided into X2 junction and T2 junction. All the sub-categories
for junction c and junction d will be explained later in this section.
The category map of all junctions is shown in Figure 2.22. Junction a, junction b
and junction c are generated by one fiber while junction d is generated by two
fibers. We cannot treat the condition that more than two fibers cross at the same point
(Figure 2.4 (a)).

Figure 2.22: Junction categories

2.2.5.3 Junction a modification


The occurrence of junction a
Generally speaking, three conditions can cause junction a.
An impulse noise that attaches itself to the fiber may cause junction a
(Figure 2.23 (a)).
A rapid direction change along the fiber may cause junction a (Figure 2.23
(b)).
Unparallel fiber boundary may cause junction a (Figure 2.23 (c)).

20
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.23: Three conditions that may cause junction a

Identification of junction a
The following flowchart shows the process by which to identify junction a:

Junction point Junction range Junction a


group detection removal identification

Figure 2.24: Flowchart of junction a identification

Junction point group detection: By analyzing the 8-neighbors of each white


pixel in the medial axis image (Figure 2.21), we can easily find the coordinates of
all the junction points which have 3 or more white neighbors. Then the 8-
connected component analysis is used to group junction points, so after this step,
all junction point groups in Figure 2.21 are detected.
Junction range removal: We pick one group of junction points each time, set the
junction points in the group to black as shown in Figure 2.25.

Figure 2.25: (a1) Before junction range removal (a2) After junction range removal

Junction a identification: We can categorize the type of the junction by doing


the 8-connected component analysis. After the junction range removal, in junction
a, we can detect three objects and one of them is relatively short. We consider the
21
Texas Tech University, Huapeng Wang, 05/2007

short object as a branch. In the condition of junction c and junction d, no small


object is detected after junction range removal.
Medial axis modification of junction a
The modification process of junction a is shown in the following flowchart:

Shorter branch
removal
Branch Replace the L corner
categorization by a straight line
Longer branch
removal
Figure 2.26: Flowchart for the modification of junction a

Branch categorization: If the small branch is shorter than twice the fiber width,
we come to the shorter branch removal block. On the other hand, if the branch is
in the range from twice the fiber width to six times the fiber width, we come to the
longer branch removal block. In our algorithm, we simply divide the number of
white pixels in the binary image (Figure 2.13 (b)) by the number of white
pixels in the medial axis image (Figure 2.19) to get an approximate fiber width.
Shorter branch removal: The small branch is removed from the fiber medial axis
as shown in Figure 2.27 (b). Notice that there is still a point of branch remaining in
Figure 2.27 (b). But after doing the L corner replacement, which is explained
later, this point will be deleted.

Figure 2.27 (a) Junction a before branch removal (b) Junction a after branch removal

Longer branch removal:


a The occurrence of longer branch:

22
Texas Tech University, Huapeng Wang, 05/2007

If the noise in the background happens to contact the fiber (Figure 2.23 (a)),
a longer branch may appear. Based on our experiments, this kind of branch is
always in the range from twice the fiber width to six times the fiber width.
b Introduce direction information in longer branch removal:
In this case, we need to make sure whether the segment to be removed is a
branch or a part of the medial axis. As shown in Figure 2.28 (a), a branch is
near the tip of the fiber. After deleting the junction range, if object 2 in Figure
2.28 (b) is less than twice the fiber width, we delete it since it will not affect
the fiber length significantly. But if object 2 is in the range defined for longer
branch, we can not delete it, so the trend of object 2 must be introduced in
order to keep it.

Figure 2.28 A special case for longer branch removal

c Longer branch removal :


The following steps are used to remove longer branches:
As with object 1 in Figure 2.28 (b), if the segment detected after
junction range removal is in the range for shorter branch, we delete it from the
medial axis image.
As with object 2 in Figure 3.28 (b), if the segment is in the range for
longer branch, we trace 8 consecutive points of object 2 starting from the
endpoint near the junction. Then we make two groups (group 1 and group 2 in
Figure 2.28 (c)) out of the 8 points and calculate the position of the group
center by averaging pixel coordinates in each group.
Then we define the group center which is nearer the corresponding
junction point as the start center. So the other one is the end center.
23
Texas Tech University, Huapeng Wang, 05/2007

We calculate the vector from the start center to the end center (vector 1
in Figure 2.28 (c)). This vector indicates the junction trend of object 2. We also
use the same approach to calculate the direction vector of the main object
(vector 2 in Figure 2.28 (c)).
We find the angle ( ) between the two vectors as:

vector1 vector 2
= cos( ) (2.3)
vector1 vector 2

If the two vectors have almost opposite directions, segment 2 is


considered as a part of the medial axis and it is kept, otherwise, it is deleted
from the medial axis image.
Replace the L corner by a straight line: In junction a, after deleting the
branches, there is always an L corner left (Figure 2.29 (a)). Generally speaking,
the L corner is not a very good approximation for calculating the fiber length. So
in this algorithm, we replace the L corner by a straight line. This process is
explained next.
a The pixels in a 5 by 5 range centered by the junction point group are set to
black in the medial axis image.
b Two new endpoints introduced by step 1 are found (Figure 2.29 (b)).
c A line that connects the new endpoints is added back to the medial axis
image. This line is created with only one pixel in width. The result is shown in
Figure 2.29 (c).

Figure 2.29 (a) Medial axis with L corner (b) Two new endpoints (c) L corner is replaced
by a straight line

24
Texas Tech University, Huapeng Wang, 05/2007

2.2.5.4 Junction b modification


The occurrence of junction b
The medial axis consists of the set of points that are equally distant from two
closest points of an object boundary. So if the fiber tip has a square shape, the
medial axis will always break up toward the two corners (Figure 2.21 (b)). We
define this kind of junction as junction b.
Identification of junction b
The following flowchart shows the process by which to identify junction b:

Junction point Junction range Junction b


group detection removal identification

Figure 2.30: Flowchart of junction b identification

Junction point group detection and junction range removal: These two steps
are the same as the steps in junction a identification.
Junction b identification: After the removing step, in junction b, we can
detect three objects and two of them are relatively short. We consider them as
branches. Based on our experiments, these branches are usually shorter than twice
the fiber width.

Figure 2.31: (b1) Before junction range removal (b2) After junction range removal

Medial axis modification of junction b


The modification process of junction b is shown in the following flowchart:

Branch Extend endpoints of the medial


removal axis to the fiber boundary

Figure 2.32: Flowchart for the modification of junction b


25
Texas Tech University, Huapeng Wang, 05/2007

Branch removal: The small branches as well as the junction point group are
removed from the fiber medial axis as shown in Figure 2.33 (b).
Extend endpoints of the medial axis to the fiber boundary: After deleting the
branches, we need to extend the medial axis to the fiber boundary. We use the
same method explained before to get a normalized vector indicating the direction
of the medial axis tips. We extend the medial axis in the direction of this vector
until the new extended endpoint of the medial axis is outside the fiber. Outside
means the current pixel to be extended is black in the binary fiber image (Figure
2.13 (b)). The result after extension is shown in Figure 2.33 (c).

Figure 2.33 (a) Junction b before branch removal (b) Junction b after branch removal (c)
Junction b after endpoint extension

All junction a and junction b are modified before the next step and the result is
shown in Figure 2.34 (b).

Figure 2.34 Medial axis image before and after modification

26
Texas Tech University, Huapeng Wang, 05/2007

2.2.5.5 Junction c and Junction d modification


After the junction a and junction b modification in the previous steps, four
kinds of junctions are left: X1, X2, T1 and T2. X1 junction and T1 junction are
self-crossings of the same fiber while X2 junction and T2 junction are crossings
created by two different fibers.
In this step, the junctions are categorized by their properties. As shown in Figure
2.35, X junction is defined as the junction that has four new endpoints after
removing the junction range. Similarly, as shown in Figure 2.36, T junction is the
kind of junction that has three new endpoints after removing the junction range.

Figure 2.35: X junction

Figure 2.36: T junction

The modification process of junction c and junction d is shown in the following


flowchart:

Group junction Delete pixels in junction range and group


points the new endpoints for each junction

Sub-categorize the type of junctions, reconstruct 8-connected


the junction range and re-assign the labels component analysis

Figure 2.37 Flowchart for the modification of junction c and junction d

27
Texas Tech University, Huapeng Wang, 05/2007

a. Group junction points:


Find all the juncture points in the modified medial axis image (Figure 2.34 (b))
that are defined as pixels having more than three white neighbors. Generally
speaking, a typical X junction is made of two junction point groups and a small
bar in between (Figure 2.38 (X)). A typical T junction is made of one junction
point group (Figure 2.38 (T)).

Figure 2.38 Junction point group and junction bar

At first, we need to group the junction points that belong to the same X
junction. We do the grouping based on the fact that the junction bar is normally
less than six times the fiber width. If the two junction point groups as shown in
Figure 2.38 (X) are connected by a small bar which is less than six times the fiber
width, we group them together.
To make this grouping step work properly, we need to set some restrictions on
the image acquisition step.
As shown in Figure 2.39 (a), if the overlap part of two fibers is six times
longer than the fiber width, which may create a junction bar longer than six
times the fiber width, the algorithm can not group the junction points for the
same X junction.
As shown in Figure 2.39 (b), if two fibers cross in more than one point and
these points are less than six times the fiber width apart, the algorithm may
group together the junction points that belong to different X junction.

28
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.39: Two forbidden fiber arrangement cases

b. Delete pixels in junction range and group the new endpoints for each junction
Pick up one group of junction points each time, then delete the small
rectangular range around this junction. Note that for X junction, there is always a
small junction bar inside (Figure 2.38 (X)), so make sure that the small bar is
within the deletion range. We can categorize all the junctions in Figure 2.40 (a)
into X junction and T junction by counting the number of new endpoints after
each deletion.

Figure 2.40: Image before and after junction range deletion

c. 8-connected component analysis


In this step, we use 8-connected component analysis to label the new medial
axis image after all junction ranges have been deleted.

29
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.41: Medial axis image with all segments labeled

d. Sub-categorize the type of junctions, reconstruct the junction range and re-
assign the labels
In this step of the algorithm, X1 junction and X2 junction are treated in the
same way while T1 junction and T2 junction are treated differently.
a) X junction
The occurrence of X1 junction and X2 junction
Self-crossing causes X1 junction while the crossing by two fibers causes
X2 junction.
Identification of X1 junction and X2 junction
As shown in Figure 2.42, if the four new endpoints introduced by junction
deletion have three different labels, the junction is defined as an X1 junction.
Similarly, if the four new endpoints introduced by junction deletion have four
different labels, the junction is defined as an X2 junction.

30
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.42: Medial axis image with all X1 junction and X2 junction categorized

Modify the medial axis in X junction range and re-assign the labels
Each time one X1 junction or one X2 junction is picked, we reconstruct
the junction in the following way:
1) Connect the four new endpoints by two straight lines in such a way that
these two lines make a crossing inside the deletion range.
2) For the components connected by the same line, compare the label of
the two components and then assign the smaller label to both. Also assign
the smaller label to the straight line that connects these two components.
We show the reconstruction results of X junction as follows:

Figure 2.43: Reconstruction the X junctions in the circle

31
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.43: Reconstruction the X junctions in the circle (Continued)

b) T1 junction
The occurrence of T1 junction
For a self-crossing, if the distance of the crossing point (point 1 in Figure
2.44 (a)) from the endpoint (point 2 in Figure 2.44 (a)) is less than two times
32
Texas Tech University, Huapeng Wang, 05/2007

the fiber width. The segment between point 1 and point 2 in Figure 2.44 (a)
will be deleted after junction a modification. This will create a T1 junction
instead of an X1 junction.

Figure 2.44: Medial axis of self-crossing before and after junction a modification

Identification of T1 junction
If the three new endpoints introduced by junction deletion have two
different labels, the junction is defined as a T1 junction.

Figure 2.45: Medial axis image with T1 junction categorized

Modify the medial axis in T1 junction and re-assign the labels


The T1 junction is reconstructed in the following way:
1) Add back the white pixels that were deleted in the junction region.
2) Compare the two labels of the three endpoints, assign the smaller label
to the two components.
3) Assign the same label to the recovered pixels in step 1).
33
Texas Tech University, Huapeng Wang, 05/2007

We show the reconstruction result of T1 junction as follows:

Figure 2.46: Reconstruction of the T1 junction in the circle

c) T2 junction
The occurrence of T2 junction
T2 junction is originally an X2 junction as shown in Figure 2.47 (a), but
after junction a modification, it becomes a T2 junction as shown in Figure
2.47 (b) since the small branch is deleted. We try to avoid this condition when
acquiring the images because it will shorten the fiber in length.

Figure 2.47: One special case that needs to be avoided in image acquisition

Identification of T2 junction
If the three new endpoints introduced by junction deletion have three
different labels, the junction is defined as a T2 junction.

34
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.48: Medial axis image with T2 junction categorized

Modify the medial axis in T2 junction and re-assign the labels


The T2 junction is reconstructed in the following way:
1) In the range of T2 junction, calculate the direction vector of the three
components starting from the three endpoints (Figure 2.49).
2) Using equation 2.3, we calculate the angle between each two vectors.
For the two vectors that have the largest angle, in this case vector 1 and
vector 2, the corresponding two components have an opposite direction. So
they belong to one fiber.
3) Connect the two components belonging to one fiber by a straight line.
4) Compare the labels of the two components that are connected by the
straight line and assign the smaller label to both.
5) Assign the same label to the straight line.
6) Keep the label of the third component unchanged.

Figure 2.49 Direction vectors in the T2 junction range

35
Texas Tech University, Huapeng Wang, 05/2007

We show the construction result of T2 junction as follows:

Figure 2.50 Reconstruction of T2 junction

2.2.7 Least Square Polynomial Curve fitting with ACPS (Adaptive Control Point
Selection)
Curve fitting method is used here because the digitized error is produced while
acquiring the image. In this chapter, the principle of least squares polynomial curve
fitting will be discussed first. Then a novel curve fitting method, least square
polynomial curve fitting with adaptive control point selection (ACPS), is proposed.
This method is specifically designed for curvy objects, like fibers.
2.2.7.1 Least squares polynomial curve fitting [19-20]
Least squares method is a mathematical procedure for finding the best fitting curve
to a given set of points by minimizing the sum of the squares of the offsets (the
residuals) of the points from the curve. The sum of the squares of the offsets is used
instead of the offset absolute values because this allows the residuals to be treated as a
continuous differentiable quantity.

36
Texas Tech University, Huapeng Wang, 05/2007

(a) (b)
Figure 2.51: (a) Vertical offsets (b) perpendicular offsets

In practice, the vertical offsets (Figure 2.51 (a)) from a line (polynomial, surface,
hyperplane, etc.) are almost always minimized instead of the perpendicular offsets
(Figure 2.51 (b)). This allows uncertainties of the data points along the x- and y-axes
to be incorporated simply, and also provides a much simpler analytic form for the
fitting parameters than would be obtained using a fit based on perpendicular offsets. In
addition, the fitting technique can be easily generalized from a best-fit line to a best fit
polynomial when sums of vertical distances are used. In any case, for a reasonable
number of noisy data points, the difference between vertical and perpendicular fits is
quite small.
Since least squares polynomial fitting is used in the algorithm, only principle of
polynomial fitting is discussed below. The kth degree polynomial can be written as:

y = a0 + a1 x + + ak x k , (2.4)
The residual, therefore, is given by:

n
R = [ yi (a0 + a1 xi + + ak xik )]2 ,
2
(2.5)
i =1

2 2
In order to make R minimum, the partial derivative of R with respect to the
polynomial coefficients should be zeros,
( R 2 ) n
= 2 [ yi (a0 + a1 xi + ak xik )] = 0, (2.6)
a0 i =1

37
Texas Tech University, Huapeng Wang, 05/2007

( R 2 ) n
= 2 [ yi (a0 + a1 xi + ak xik )]xi = 0, (2.7)
a1 i =1

( R2 ) n
= 2 [ yi (a0 + a1 xi + ak xik )]xik = 0, (2.8)
ak i =1

We can rewrite the equations from 2.6 to 2.8 in the matrix form as follows,

n n yi
n n k
x x
i =1 i i =1 i
a0 i =1
n x k +1 xy
i =1 i 1 = i =1 i i ,
n 2 n n
x
i =1 i
x
i =1 i
a

(2.9)

n k
i =1 xi k +1
i=1 i i =1 i i
ak n x k y
n n
x
i =1 i
x 2k

This is a Vandermonde matrix which can be decomposed into two matrices
multiplied together,
n
n n k


x
i =1 i
x
i =1 i
1 1 1 1 x1 x1k
n x
x k +1 x1 x2
i =1 i
n n
2
x x2k 1 x2 x2k
i =1 i i =1 i =
, (2.10)
n k xk xk
xnk 1 xn xnk
i =1 xi k +1
i=1 xi 1 2
n n 2k
x
i =1 i

Also the right part of equation (2.9) can be decomposed as follows,

n yi
i =1 1 1 1 y1
n x y x1 x2
x2k y2
i =1 i i = ,
(2.11)
n k xk xk
i =1 xi yi 1 2 xnk yn

Therefore, given n points ( xi , yi ) , the fitting polynomial coefficients a 0 , a1 an


can be calculated from the following equation,

38
Texas Tech University, Huapeng Wang, 05/2007

y1 1 x1 x1k a0
y
2 = 1 x2 x2k a1
, (2.12)

yn 1 xn xn ak
k

In matrix notation, the equation for a polynomial fit is given by,

y = Xa, (2.13)

This can be solved by pre-multiplying by the matrix transpose X T ,

X T y = X T Xa (2.14)

This matrix equation can be solved numerically, or can be inverted directly if it is


well formed, to yield the solution vector

a = ( X T X ) 1 X T y. (2.15)

2.2.7.2 Least Square Polynomial Curve Fitting with Adaptive Control Point Selection
(ACPS)
For very curvy objects like fibers, only one polynomial is not enough to fit the data
so as to describe the shape of the fiber properly. Normally, piece-wise curve fitting
methods are used. The common piece-wise curve fitting methods use certain number
of control points to divide the whole fiber medial axis into segments and then fit each
segment to a polynomial curve of certain order. This will sometimes create improper
fitting since the changes of shape from one segment to another can be large. For curve
fitting with adaptive control point selection, the segment is divided in a way to make
sure that there is at most one critical point within each segment. For each segment, a
5th order polynomial is used to fit the data.
We show the flowchart of curve fitting with ACPS as follows:

39
Texas Tech University, Huapeng Wang, 05/2007

Critical Point Selection

Adaptive Control Point Selection

Determine the Independent Variable for


Curve Fitting of Each Segment

Check Accuracy

Figure 2.52 Flowchart of curve fitting with ACPS

a. Critical Point Selection


In our algorithm, critical points are defined as the points at which the fiber
trend changes. If we divide the fiber medial axis into segments in such a way that
the segment is either straight (without critical point) or has only one critical point
inside, the shape of each segment will be relatively simple. In this way, a least
square polynomial fitted curve should preserve the fiber shape accurately. And if
the critical point is in the middle of the segment to be fitted, continuity will be
easily preserved between each segment. The characterizing feature of the critical
points is that they are the points at which the fiber makes a change of direction.
Four directions are defined in our algorithm: northeast (NE), southeast (SE),
northwest (NW) and southwest (SW). For each pixel, we indicate its 8-neighbors
as shown in Figure 2.53.

1 2 3
8 4
7 6 5

Figure 2.53 8-neighbors of the center pixel

40
Texas Tech University, Huapeng Wang, 05/2007

Since the modified medial axis of a fiber has one pixel in width, we can trace
the data points sequentially from one end to the other. We show the algorithm
flowchart for setting the critical points as follows,

Figure 2.54: Flowchart for setting the critical points

Here is an example to explain the above flowchart:

41
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.55: An example of determining critical points (circled pixels)

As shown in Figure 2.55, we follow the flowchart in Figure 2.54 from endpoint
1 to endpoint2. Finally, grid 11 and 16 are the critical points we found.
Figure 2.56 shows the critical points in the medial axis of a cotton fiber.

Figure 2.56 Modified medial axis with critical points indicated in gray.

b. Adaptive Control Point Selection


a) Criteria for setting the control points
Based on the critical points, we define the control points in this step. Then the
segment between two consecutive control points is used for curve fitting.
To reduce fitting errors, each segment is selected to meet the following
requirements:
Each segment contains at most one critical point.
No segment contains more than 40 pixels.
b) Selection of control points
We describe the selection of the control points as follows,

42
Texas Tech University, Huapeng Wang, 05/2007

If there are no critical points in the medial axis, we simply trace the medial
axis from one endpoint to the other and then set a control point after 40
consecutive pixels.
If there is at least one critical point in the medial axis, the following steps
are used for setting the control points.
Break the medial axis at the critical points as shown in Figure 2.57.
By counting the number of pixels in each segment, we define three
categories of segments.

Figure 2.57: Medial axis with critical points in gray and endpoints in white

For setting control points, a different method is used for each category.
If the segment has less than 5 pixels, no control point is set in this
segment. (Segment 1 in Figure 2.58)
If the segment has less than 40 pixels but more than 5 pixels, a control
point is set in the middle of the segment. (Segment 4 and 5 in Figure 2.58)

Figure 2.58: Medial axis with control points indicated in empty circle, critical points in
gray and endpoints in white

43
Texas Tech University, Huapeng Wang, 05/2007

If the segment has more than 40 pixels (Segment 2, 3 and 6 in Figure


2.58), (segment 2, for example) we first set two control points (control point1
and control point2 in Figure 2.59) that are 20 pixels away from the boundary
points of the segment. Then we trace the points between control point1 and
control point2 and set new control points after each 40 consecutive pixels.

Figure 2.59: Medial axis with control points indicated in empty circle, critical points in
gray and endpoints in white

After setting all the control points, the segment between two consecutive
control points contains either a maximum, a minimum, or a short segment without
a change in direction. Each segment is then used for curve fitting.

Figure 2.60 Medial axis with control points indicated in empty circle and critical points in
gray

c. Determine the Independent Variable for Curve Fitting of Each Segment


For each segment, we compare the extent of the coordinate values of x and y.
Then we pick the larger extent to be the independent variable for equation 2.15 and
a 5th order polynomial is fitted to each segment. The result is shown in Figure 2.61.
44
Texas Tech University, Huapeng Wang, 05/2007

Figure 2.61 Result after piece-wise curve fitting with ACPS

d. Check Accuracy
After the piece-wise curve fitting, we compare all the fitted data points with
the original data points accordingly. If the distance between these two is larger
than 3 pixels, which means the fitted curve at this position is far away from the
original medial axis, the coordinates of the original data point are used to calculate
the fiber length instead of the fitted data point.

Figure 2.62: An example of checking accuracy


In Figure 2.62 (a), when comparing each fitted data point with the
corresponding original data point, three (1, 2, 3) of them have a relatively large

45
Texas Tech University, Huapeng Wang, 05/2007

distance. So as shown in Figure 2.62 (b), we keep all the other fitted data points as
well as the marked three original data points when calculating the length.
2.2.8 Fiber length calculation
We calculate the Euclidean distance between two consecutive data points and add
all the distances to get the fiber length. For pixels p and q with coordinates (x, y) and
(s, t), the Euclidean distance between p and q is defined as:
1
De ( p, q) = ( x s)2 + ( y t )2 2 (2.16)

46
Texas Tech University, Huapeng Wang, 05/2007

CHAPTER 3

RESEARCH APPROACH FOR FIBER MATURITY

MEASUREMENT

The current image analysis based methods can provide direct measurements on
fiber fineness and maturity [9-10], which is used as reference data to calibrate high
speed instruments. The fiber maturity can be assessed from fiber cross sections [9].
This measurement is highly dependent on two main steps: cross sectioning and image
segmentation. Fiber cross sections are prepared and transported to the microscopy
system for image acquisition. Image segmentation separates fiber cross sections from
the background and from each other. Fiber maturity can be directly validated from
parameters calculated from each fiber cross section: perimeter of a cross section,
average thickness of the wall. For fiber maturity estimation from the longitudinal
view [10], the fibers are cropped into segments, spread on a glass slide and then
imaged by a video camera. For each segment, the maximum, minimum, mean and
standard deviation of fiber width is derived by this longitudinal method and the data
are repeatable and highly related to the data obtained from other test methods. In this
thesis, we intend to develop a combined method that can calculate the fiber length and
estimate the fiber maturity for the scanned image of whole fibers.

3.1 Motivation

Compared with the immature fibers, mature fibers have thicker walls. When we
acquire the images of whole cotton fibers with a scanner, the pixel gray values along
the fiber medial axis are expected to exhibit differences between mature and immature
fibers. Also, the immature fibers are flatter than the mature fibers since the lumens of
the immature fibers collapse, which means the mature fibers are more likely to twist.
So for immature fibers, the pixel values along the medial axis should have less
variation than mature fibers.

47
Texas Tech University, Huapeng Wang, 05/2007

3.2 Research approach for fiber maturity estimation

3.2.1 Image acquisition


Again, we use a commercial scanner to acquire the images. But for fiber maturity
measurement, the fibers are scanned at 8000 dpi and we only create images of single
fibers.
3.2.2 Binarize the grayscale images and remove the noise in the background
Based on the experiments, a pixel value of 15 is used here for the global
thresholding. Then after the 8-connected component analysis in the binary image, any
object that is less than 400 pixels in size is treated as noise and deleted from the binary
image.
3.2.3 Obtain and modify the medial axis of cotton fibers in the binary image
This step is the same as the step in fiber length measurement except that there is no
junction d to modify since there is only one fiber in each image.
3.2.4 Calculate the mean and variance of the pixel values along the medial axis
In the original scanned image, instead of picking the pixel value in the position of
the MA, we first average the pixel values of a 3 by 3 mask centered by each MA point.
Then we calculate the mean and variance of these averaged values.
All the experimental results for fiber maturity estimation are shown in Chapter 5.

48
Texas Tech University, Huapeng Wang, 05/2007

CHAPTER 4

GUI FOR FIBER LENGTH MEASUREMENT

In order to make the fiber length calculation algorithm more convenient and
friendly to users, a Matlab based GUI program has been developed. In this GUI, there
are two processing modes: single fiber mode and batch mode. The single fiber mode is
used for testing, while the batch mode is used for processing a number of images and
calculating the length distribution as well as other useful parameters. In this chapter,
we describe the functions of these two modes in detail.

4.1. Single fiber mode (Figure 4.1)

Single fiber mode can process only one image at a time. In this mode, every
intermediate result is shown in a pop-up Matlab figure. This mode is used for the user
to validate the algorithm and make sure every step is working properly.

Figure 4.1 Interface of single fiber mode

The functions of this mode are explained as follows,


Text box 1 (select mode)
We can switch from one working mode to the other by clicking on the
corresponding radio button. The default mode is batch mode.

49
Texas Tech University, Huapeng Wang, 05/2007

We create a list of two options on top right corner of the GUI to display images.
The options include original and complement. Switching the option will
change the way the image is displayed, as shown in Figure 4.2.

Figure 4.2 Display options in single fiber mode: Original (left) and Complement (right)

Text box 2 (cutting images)


Resolution - The default resolution is 1000 dpi, but we need to change it in the
box if the loaded image is scanned at a different resolution. After the new
resolution is filled, we need to click the enter button in the keyboard.
Load images - Image loading process can be triggered by clicking on the load
button. Whenever users click on the load button, a dialog box (Figure 4.3) will
pop-up and the user can choose the image from the folder in the directory.

Figure 4.3 Pop-up dialog box for loading the image

50
Texas Tech University, Huapeng Wang, 05/2007

Crop images - By clicking on the crop button, the users can select their range of
interest (ROI) on the image displayed in the right window. And this cropped
image will be shown on the left window in text box 3.
Save cropped images - After clicking on the save button, a pop-up dialog box
(Figure 4.4) appears and the users can save the cropped image in the directory
they want. This option is used to prepare images for batch mode processing.

Figure 4.4 Pop-up dialog box for saving the cropped image

Process image - The cropped image will be processed after clicking on the
process button. While processing, a waiting bar (Figure 4.5) shows up is
displayed.

Figure 4.5 Waiting bar

In single fiber mode, four kinds of Matlab figures are displayed during the
processing (Figure 4.6): (a) Binarized image after preprocessing; (b) Medial axis
after modifications; (c) Separate detected fibers; (d) Fitted curves for detected
fibers. The users can validate the whole process from these figures. If the fiber is
touching the boundary of the cropped image, the program will not detect this
fiber.

51
Texas Tech University, Huapeng Wang, 05/2007

Figure 4.6 Four intermediate figures (a) Binarized image (b) Medial axis image after
axis modifications (c) Individualized fiber (Here, only one fiber is shown) (d) Fitted
curve of each fiber

Text box 3 (processing part)


This window shows the cropped fiber image to be processed.
Text box 4 (results)
The list displays the calculated fiber length in inches.
Text box 5
On the interface of single fiber mode, the biggest display window on the right
side shows the image the user loads. Users can change the magnification of the
displayed image by changing the percentage shown in the magnification box.
There are also horizontal and vertical scroll bars for the convenience of users.

4.2 Batch mode (Figure 4.7)

When the user switches the radio button to batch mode, the interface will change
correspondingly. Batch mode is the actual working mode. It can process all the images

52
Texas Tech University, Huapeng Wang, 05/2007

with multiple fibers in the current working directory and produce the length
distribution as well as several useful parameters.

Figure 4.7 Interface of batch mode

Processing setup - Before processing, the user needs to select the folder that contains
the images to be processed. It can be done by changing the working directory (Figure
4.8). Whenever the working path changes, the list box below will show all the files
inside the current directory. If necessary, we may also need to change the resolution of
the images to be processed.

Figure 4.8 Dialog box for changing the working directory

Batch mode process and saved results


Once clicking on the process button, the batch mode processing begins.
53
Texas Tech University, Huapeng Wang, 05/2007

After processing, a length distribution will be displayed as a Matlab figure


(Figure 4.9). The spacing of each bar along the X axis is 0.05 inch. The blue
bars indicate the percentage of fibers within that length range and the red line
indicates the cumulative distribution. The left y axis corresponds to the
percentage counts while the right y axis corresponds to the accumulative
distribution.
Length Distribution
50 100

45 90

40 80

35 70

Cumulative Percent
Number Percent

30 60

25 50

20 40

15 30

10 20

5 10

0 0
0 0.5 1 1.5 2 2.5
Length (inch)

Figure 4.9 Length Distribution

The users can also save or print the length distribution by clicking the save or
print buttons on the batch mode interface. Two pop-up windows (Figure 4.10)
will show up after clicking.

(a) (b)
Figure 4.10 (a) Dialog for saving the length distribution (b) Dialog for printing the length
distribution

54
Texas Tech University, Huapeng Wang, 05/2007

In addition, an excel file will be automatically generated and saved in the


current working directory. This file stores all the calculated lengths categorized
by image names (Figure 4.11).

Figure 4.11 Generated excel data

The user can also mark the detected fibers. This option is in text box 4 of batch
mode. In this case, for each image in the current working directory, a new
image (Figure 4.12), which indicates all the detected fibers, will be created and
saved.

Figure 4.12 Image with detected fibers indicated

Useful parameters - After batch mode processing, some very useful parameters
are also calculated and displayed on the GUI interface (Figure 4.13).

55
Texas Tech University, Huapeng Wang, 05/2007

Figure 4.13 Useful parameters

L(n) is the average length of all the calculated fibers.


L(n) CV Coefficient of Variation is the standard deviation of all the length
data divided by L(n).
Fibers give the total number of processed fibers.
5.0%(n) is the length at which only 5% of the fiber are that long or longer.
2.5%(n) is the length at which only 2.5% of the fiber are that long or longer.
SFC(n) is the percentage of fibers shorter than 0.5 inch.

56
Texas Tech University, Huapeng Wang, 05/2007

CHAPTER 5

EXPERIMENTS, ANALYSIS AND RESULTS

5.1 Experiments for Testing the Fiber Length Calculation Algorithm

In this section, we describe the results of five experiments with the proposed
system for fiber length measurement. The first of these is set up to verify the impact of
the two main components of our algorithm; namely, medial axis modification and
curve fitting with ACPS. The second experiment aims to show the improvement in
accuracy by curve fitting with ACPS. Also, we can clearly see the consistency of the
algorithm with respect to different resolutions and shapes. The third and fourth
experiments are performed using cotton fibers from samples that have been processed
with AFIS. In experiment 5, we create and process images with multiple fibers,
compare the parameters calculated from our algorithm with the ones form AFIS, and
calculate the error rate of the proposed algorithm.

5.1.1 Ground truth


In order to validate the algorithm, we need to know the exact length of fibers as the
ground truth. In experiment 1, we used a 4-inch optical fiber and a micro ruler as
shown in Figure 5.1. In experiment 2, the same micro ruler is used again with a 1.5-
inch nylon fiber. The smallest grid of this micro ruler is 1 millimeter. We describe the
steps to create a 4-inch optical fiber as follows,
1. Crop a long optical fiber into a small segment that is slightly longer than 4 inch.
2. Attach both tips of the fiber segment to the micro ruler using transparent tapes and
make the whole segment parallel to the longer edge of the ruler.
3. Using a knife, we can crop the fiber segment until it is exactly 4-inch in length.
We detach the optical fiber and use it as the ground truth to test our algorithm. In
experiment 2, a 1.5-inch nylon fiber is created in the same way.

57
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.1: Micro ruler

5.1.2 Experiment 1
In the first experiment, the 4-inch optical fiber is scanned at a resolution of 1000
pixels/inch in five different orientations and shapes (Horizontal, Vertical, Inclined,
Curved, and Curved with a loop). The measured lengths obtained before medial axis
modification (BMAM), after medial axis modification (AMAM), and after curve
fitting with ACPS (ACF) were then compared (Table 5.1). For BMAM and AMAM,
the following equation is used to calculate the length of the MA:

Num1 + ( 2 1) Num 2 / 2
Fiber Length (inch) = (5.1)
resoltion ( pixels / inch)

where Num1 is the number of pixels in MA. We visit the MA pixels one by one, and
each time, we count the number of MA pixels that are in grid 1, 3, 5 or 7 of the
visiting pixel. In the end, we add up all these numbers to get Num2.

1 2 3
8 4
7 6 5

Figure 5.2: 8-connected neighbors of the current pixel

58
Texas Tech University, Huapeng Wang, 05/2007

Experimental results

Table 5.1: Length of the 4-inch optical fiber with different shapes
Optical Fiber Place in the proposed Measured length
Relative error
Shape algorithm (inch)
BMAM 4.1535 3.89%
Horizontal AMAM 4.1457 3.61%
ACF 4.0118 0.3%
BMAM 4.1575 3.94%
Vertical AMAM 4.1496 3.74%
ACF 4.0197 0.49%
BMAM 4.1614 3.99%
Inclined AMAM 4.1496 3.75%
ACF 4.0157 0.39%
BMAM 4.1811 4.53%
Curved AMAM 4.1693 4.24%
ACF 4.0315 0.79%
BMAM 4.1890 4.70%
Curved with a
AMAM 4.1772 4.41%
loop
ACF 4.0276 0.69%

Analysis
A number of important conclusions may be reached by observing this data. First,
without curve fitting, as noticed by Yuksel Ikiz [7-8], the measured length is always
longer than the true length by about 3.5% to 4.5% and this error increases with the
complexity of the shape. Second, as expected, the orientation and shape of the fiber
impact the accuracy with which its length is estimated. Third, following digitization,
all measurement schemes tend to overestimate the fiber length. Fourth, on average, the
medial axis modification step of the proposed algorithm reduced measurement errors
by 0.2%. This reduction is expected to be far greater for cotton fibers that may exhibit
inter-fiber crossovers and whose structures can differ drastically from the perfect
cylindrical shape of an optical fiber. Finally, it is observed that the curve fitting with
ACPS component of the algorithm consistently reduces the measurement error to
under the desired target of 1%.

59
Texas Tech University, Huapeng Wang, 05/2007

5.1.3 Experiment 2
The polynomial curve fitting with ACPS is an essential step before calculating
the fiber length since the fiber shape is well preserved by this method and it can
decrease the digitized error as shown in Figure 5.3.

Figure 5.3: (a) MA before curve fitting (b) MA after curve fitting

Although we can visually see the improvement by polynomial curve fitting with
ACPS in Figure 5.3, it is still important to know how much it affects the measured
length with respect to different fiber shapes. In this experiment, a 1.5 inch nylon fiber
is scanned in three different shapes as shown in Figure 5.4(vertical, C-shape and S-
shape) with four different resolutions (100dpi, 200dpi, 300dpi and 600dpi). For each
shape, we compared the measured length under two conditions: no curve fitting and
polynomial curve fitting with ACPS.

Figure 5.4: 1.5-inch nylon fiber (a) shape 1 (b) shape 2 (c) shape 3

60
Texas Tech University, Huapeng Wang, 05/2007

Experimental results

Figure 5.5: Measured fiber length of the vertical shape

Figure 5.6: Measured fiber length of the C-shape

Figure 5.7: Measured fiber length of the S-shape

Analysis
As shown from Figure 5.5 to Figure 5.7, in general, the polynomial curve fitting
with ACPS method decreases the error for all the 3 shapes with 4 different resolutions.
The algorithm works better when the resolution is picked larger than 300dpi. At
600dpi resolution, although the measured length before curve fitting shows a large
61
Texas Tech University, Huapeng Wang, 05/2007

difference between different shapes of the same fiber, the curve fitting algorithm
consistently decreases the relative error to within 1% The curve fitting method with
ACPS needs longer processing time, so when time is the primary concern, the user can
consider using piece-wise curve fitting without ASCP.

5.1.4 Experiment 3
Cotton fiber samples of known length are used here to validate the algorithm. We
randomly pick 20 fibers from each sample bundle with known length (3/16 inch, 5/16
inch, 7/16 inch, 9/16 inch, 11/16 inch, 13/16 inch, 15/16 inch, 17/16 inch, 19/16 inch,
21/16 inch and 23/16 inch) and each fiber is scanned in three different resolutions:
1000 dpi, 1200 dpi and 1500 dpi.
Experimental results
We show the length distributions of each bundle with different resolutions as follows,

Figure 5.8: Length distribution of 3/16 (0.1875 inch) bundle at three different resolutions

Figure 5.9: Length distribution of 5/16 (0.3125 inch) bundle at three different resolutions

62
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.10: Length distribution of 7/16 (0.4375 inch) bundle at three different resolutions

Figure 5.11: Length distribution of 9/16 (0.5625 inch) bundle at three different resolutions

Figure 5.12: Length distribution of 11/16 (0.6875 inch) bundle at three different resolutions

63
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.13: Length distribution of 13/16 (0.8125 inch) bundle at three different resolutions

Figure 5.14: Length distribution of 15/16 (0.9375 inch) bundle at three different resolutions

Figure 5.15: Length distribution of 17/16 (1.0625 inch) bundle at three different resolutions

64
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.16: Length distribution of 19/16 (1.1875 inch) bundle at three different resolutions

Figure 5.17: Length distribution of 21/16 (1.3125 inch) bundle at three different resolutions

Figure 5.18: Length distribution of 23/16 (1.4375 inch) bundle at three different resolutions

65
Texas Tech University, Huapeng Wang, 05/2007

Analysis
The fiber length calculated by the proposed algorithm is close to the known length.
The algorithm can detect the length difference of cotton fibers in the same bundle,
which makes the length distributions spread out. 1000 dpi resolution is working
consistently for cotton fibers with different length.

5.1.5 Experiment 4
In this experiment, 458 cotton fibers are randomly selected from a sample of 3000
fibers that have been processed with AFIS. These fibers are scanned at a resolution of
1000dpi and processed in batch mode with results shown in Figure 5.19 and Table 5.2.
Experimental results

Figure 5.19: Length distribution by AFIS and by proposed image analysis system

Table 5.2: Length statistics for cotton fibers used in AFIS and the proposed algorithm

Proposed
Proposed Algorithm
Algorithm
AFIS (w/ adaptive
(w/ static
threshold)
threshold)
Number of
3,000 458 458
fibers
Mean length
0.65 0.74 0.73
(inch)
SFC
35.3 25.8 25.2
(%)

66
Texas Tech University, Huapeng Wang, 05/2007

Analysis
Although the sample size for the proposed system is only 15% of that used for AFIS,
the corresponding length distribution (Figure 5.19) still exhibits a clear local peak in
the range around 0.5 inch. A similar peak was noticed by Schneider [21], who
attributed it to fiber breakage during ginning. Length distribution calculated by our
algorithm is more compact than the one calculated by AFIS. Furthermore, it is
observed that while our system finds no fibers to be longer than 2 inch, AFIS indicates
the presence of some unusually long fibers. This known problem with AFIS occurs
when one or more short fibers delivered to its photodetector appear as one long fiber.
In Table 5.2, the mean length indicates the average length of all the fibers in the test
specimen. The short fiber content (SFC) is the percentage of fibers in the test
specimen that are shorter than 0.5 inch in length, as defined by ASTM Standards [22].
As expected, the mean length is significantly larger with image analysis, while the
short fiber content (SFC) is lower. The discrepancy in the mean length is due to the
fact that to AFIS, even a properly oriented long fiber with crimps will appear shorter
than it is, leading to a global underestimation of fiber length. The proposed system
also substantiates the well-known problem that AFIS tends to overestimate the SFC.
Finally, Table 5.2 shows the effectiveness of the adaptive thresholding method
introduced before. It is observed that the results obtained by this method are nearly
identical to those obtained by using a manually-selected static threshold value.

5.1.6 Experiment 5
In this experiment, the samples named P271, P297, P341, P401, P472, P028,
P435, P476, P243 and P238 are taken from five cotton bales. For each sample, a
database of about 100 multiple-fiber images is created in 1000 dpi. For each sample,
we process all the images in batch mode and save an image with every detected fiber
marked (Figure 5.20 (b)). During the processing, we visually compared each
individualized fiber with the corresponding one in the original image and counted the
number of erroneously detected fibers. For the original image in Figure 5.20 (a), fiber
3, 7 and 10 are erroneously detected fibers. The reason for the wrong detection of this
particular image is overlap of two fibers is six times longer than the fiber width.
67
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.20: (a) Original fiber image (b) Saved image with detected fibers indicated

Experimental results
Two histograms are created for each sample: one from the whole data and the
other from the data that corresponds to the properly detected fibers. We show the
experimental results as follows:

Figure 5.21: Sample P271 (a) Histogram from the accurate data set (b) Histogram from the
whole data set

68
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.22: Sample P297 (a) Histogram from the accurate data set (b) Histogram from the
whole data set

Figure 5.23: Sample P472 (a) Histogram from the accurate data set (b) Histogram from the
whole data set

Figure 5.24: Sample P028 (a) Histogram from the accurate data set (b) Histogram from the
whole data set
69
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.25: Sample P401 (a) Histogram from the accurate data set (b) Histogram from the
whole data set

Figure 5.26: Sample P341 (a) Histogram from the accurate data set (b) Histogram from the
whole data set

Figure 5.27: Sample P435 (a) Histogram from the accurate data set (b) Histogram from the
whole data set
70
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.28: Sample P476 (a) Histogram from the accurate data set (b) Histogram from the
whole data set

Figure 5.29: Sample P243 (a) Histogram from the accurate data set (b) Histogram from the
whole data set

Figure 5.30: Sample P238 (a) Histogram from the accurate data set (b) Histogram from the
whole data set

71
Texas Tech University, Huapeng Wang, 05/2007

Table 5.3: Error rate of the proposed algorithm


Number Number of Number Number of
of erroneously Error of erroneously Error
Sample Sample
detected detected percentage detected detected percentage
fibers fibers fibers fibers
P271 537 36 6.7% P341 527 18 3.4%
P297 577 95 16.5% P435 533 31 5.8%
P472 523 26 5.0% P476 527 12 2.3%
P028 539 19 3.5% P243 532 26 4.9%
P401 518 23 4.4% P238 538 22 4.1%

Table 5.4: Mean length (L(n)) comparison table


Image Analysis
Bale ID Type Sample AFIS ML (mm)
ML (mm)

3161 Card sliver P-271 0.760 0.888

3161 DII sliver P-297 0.770 0.785

3273 Card sliver P-472 0.740 0.837

3273 DII sliver P-028 0.770 0.821

3275 Card sliver P-401 0.670 0.813

3275 DII sliver P-341 0.700 0.808

3268 Card sliver P-435 0.710 0.986

3268 DII sliver P-476 0.740 0.932

3093 Card sliver P-243 0.620 1.077

3093 DII sliver P-238 0.630 0.865

Analysis
The main reason that causes the algorithm to produce erroneous length data is that
the scanned images have some forbidden arrangements as explained in Chapter 2. As
shown in Table 5.3, except for P297, compared with the 97% rejection rate of AFIS,
our image analysis method shows an error rate less than 7%. Table 5.4 compares the
AFIS mean length (ML) by number with the image analysis mean length by number.
72
Texas Tech University, Huapeng Wang, 05/2007

Although compared with AFIS, the size of each sample for this analysis is relatively
small, some of the image analysis length distributions still present a clear local peak in
the range around 0.5 inch. Again the mean length by number is significantly larger
with image analysis for all the 10 samples. For a given bale ID, the AFIS length is
larger for DII slivers than for card slivers. This is due to the crimp removal performed
with the drawing operation. It confirms that the measured AFIS length is influenced
by the amount of crimp. An inverse situation is observed for the image analysis results.
Indeed, the mean length by number is shorter for the DII slivers. This is a logical
result because drawing can and will break some fibers.

5.2 Experiments for Testing the Fiber Maturity Calculation Algorithm

One sample of extremely mature fibers and one sample of extremely immature
fibers are used here to test our algorithm. In experiment 1, we randomly pick 20 fibers
from each sample and get the grayscale image for each fiber with a resolution of 8000
dpi. Then the algorithm explained in Chapter 3 is used to get the mean and variance of
the pixel values along the medial axis of each fiber. Our hypothesis is that the means
and variations in gray level along a fiber should be linked to fiber maturity. We use the
same algorithm for experiment 2, in which we pick 30 fibers from each sample and
calculate the mean and variance in 7 different channels (red, green, blue, hue,
saturation, value, grayscale).
Results for experiment 1

Figure 5.31: Mean comparison in grayscale


73
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.32: Variance comparison in grayscale

Results for experiment 2

Figure 5.33: Mean comparison in grayscale

Figure 5.34: Mean comparison in red channel

74
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.35: Mean comparison in green channel

Figure 5.36: Mean comparison in blue channel

Figure 5.37: Mean comparison in hue channel

75
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.38: Mean comparison in saturation channel

Figure 5.39: Mean comparison in value channel

Figure 5.40: Variance comparison in grayscale

76
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.41: Variance comparison in red channel

Figure 5.42: Variance comparison in green channel

Figure 5.43: Variance comparison in blue channel

77
Texas Tech University, Huapeng Wang, 05/2007

Figure 5.44: Variance comparison in hue channel

Figure 5.45: Variance comparison in saturation channel

Figure 5.46: Variance comparison in value channel

Analysis
On average, there are obvious differences between the two samples for both mean
values and variance. The mean of pixel values along the fiber medial axis for the
78
Texas Tech University, Huapeng Wang, 05/2007

mature fiber is consistently higher than immature fibers in grayscale, red, green, blue
and value channels, but smaller in hue and saturation channels. The variance of pixel
values along the fiber medial axis for the mature fiber is consistently higher than
immature fibers in all the 7 channels. The red channel appears to have a better
discriminatory power than the other channels.

79
Texas Tech University, Huapeng Wang, 05/2007

CHAPTER 6

CONCLUSIONS AND FUTURE WORKS

Fiber length is, to the textile industry, one the most important properties in
marketing and processing. In general, longer fibers are stronger so they have a much
higher price. The length property is not only related to other cotton fiber properties
like strength and fineness, but it is the fundamental property that determines the yarn
quality, which finally contributes to fabric quality. Also, several mechanical
processing steps, such as spinning, knitting and weaving, are highly affected by the
fiber length and its distribution. So generally speaking, accurately measure the fiber
length and its distribution is crucial for the textile industry. The current commercial
systems for fiber length measurement all have their own problems. Oiled-Plate and
Array method both need manual operations while the HVI system measures fiber
length indirectly. The AFIS system processes cotton fibers in a reasonable time span,
but it overestimates both the SFC and longer fibers. Also the AFIS length distribution
is highly influenced by fiber crimp, so the mean length by AFIS is smaller than the
actual mean length.
In this thesis, we have presented an imaging system intended for use as a reference
method for the accurate measurement of cotton fiber length. In its present state, the
system is composed of a scanner and customized image processing algorithms that
compute the length of each fiber in the image with relative errors well within 1%.
Although the system requires some degree of separation between the individual fibers
at scan time, it is shown to produce highly accurate length measurements that are
invariant to fiber orientation, shape, inter-fiber intersections, and intra-fiber crimps
and crossovers. The presented system provides significant improvements in terms of
ease of use and accuracy over the existing imaging system, introduced by Ikiz [7-8]. It
should be noted, however, that in its present state, the proposed algorithm can not
handle several cases, but it obviously lowers the requirements for fiber
individualization, which will decrease the complexity for system implementation.
Currently, we are investigating the possibility of adapting the proposed method for
real-time operation.
80
Texas Tech University, Huapeng Wang, 05/2007

REFERENCES

1. Byrd, T. Analysis of An Image-based Fiber Length Measurement Device. Master


thesis, North Carolina State University, 2003.

2. ASTM, Standard D 1440-96, Standard Test Method for Length and Length
Distribution of Cotton Fibers (array Method), Annual Book of ASTM Standards.
Vol. 07.01, 334-339, 2006.

3. ASTM, Standard D 1447-00, Standard Test Method for Length and Length
Distribution of Cotton Fibers by Fibrograph Measurement, Annual Book of ASTM
Standards. Vol. 07.01, 357-361, 2006.

4. Bragg, C.K. and Shofner, F.M. A Rapid, Direct Measurement of Short Fiber
Content. Textile Research Journal 63 (1993): 171-176.

5. Ikiz, Y., Rust, J., Trussel, J., and Jasper, W. Fiber Length Measurement by Image
Processing, Textile Research Journal 71 (2001): 905-910.

6. Ikiz, Y. Fiber Length Measurement by Image Processing. Ph.D. diss., North


Carolina State University, 2000.

7. Stroupe, S.P. Method for Preparation and Delivery of Cotton Fibers for Digital
Imaging. Master thesis, North Carolina State University, 2002.

8. U. Heitmann, D. Burkhardt, C. Wasmer and H. Planck. Image Analytical Fiber


Length Measurement. In Faserinstitut Bremen e.V. und Bremer Baumwollbrse,
Bremen (Hrsg.): 28th International Cotton Conference, S.101-116, 2006.

9. B.Xu and Y.Huang. Image Analysis for Cotton Fibers, Part II: Cross_Sectional
Measurement. The University of Texas at Austin.

10. B.Xu and Y.Huang Image Analysis for Cotton Fibers, Part I: Longitudinal
Measurements. Textile Research. Journal 72(8) (2002): 713-720.

11. Coeurjolly, David and Klette, Reinhard A Comparative Evaluation of Length


Estimators of Digital Curves. IEEE PAMI 26 (2) (February 2004).

12. Ferreira, Afonso and Ubeda, Stephane Computing the Medial Axis Transform in
Parallel With Eight Scan Operations. IEEE PAMI 21 (3) (March 1999).

13. Blum, H. A Transformation for Extracting New Descriptors of Shape, In Models


for Perception of Speech and Visual Form, Cambridge, MA, 1967, edited by Weiant
Whaten-Dunn, MIT Press,

81
Texas Tech University, Huapeng Wang, 05/2007

14. Arcelli, C. and Sanniti Di Baja, G. On the Sequantial Approach to Medial Line
Thinning Transform. IEEE Trans. Systems, Man, and Cybernetics SMC-8, 2
(1978): 139-144.

15. Mott-Smith, J.C. Medial Axis Transforms. In Picture Processing and


Psychopictorics, New York, 1970, edited by B. S. Lipkin and A. Rosenfeld, Eds.,
Academic Press.

16. Pratt, William K, eds. Digital Image Processing. John Wiley & Sons, Inc.,1991.

17. Rafael C. Gonzalez and Richard E. Woods, eds. Digital Image Processing.

18. Haralick, Robert M., and Linda G.Shapiro, eds. Computer and Robot Vision,
Volume I. Addison-Wesley, 1992, pp 28-48.

19. http://mathworld.wolfram.com/LeastSquaresFittingPolynomial.html

20. Recktenwald, G.W, eds. Numerical Methods with MATLAB: Implementations


and Applications. Prentice Hall, 2000.

21. Schneider, T., Rettig, D. and Mussig, J. Single Fiber Based Determination of
Short Fiber Content, Proc. Beltwide Cotton Conferences Cotton Quality
Measurements, 1511-1513, San Diego, CA, 1994.

22. ASTM Definitions, A Compilation of ASTM Standard Definitions, 8th Edition.


Philadelphia: PA, 1994.

82
Texas Tech University, Huapeng Wang, 05/2007

PERMISSION TO COPY

In presenting this thesis in partial fulfillment of the requirements for a masters

degree at Texas Tech University or Texas Tech University Health Sciences Center, I

agree that the Library and my major department shall make it freely available for

research purposes. Permission to copy this thesis for scholarly purposes may be

granted by the Director of the Library or my major professor. It is understood that any

copying or publication of this thesis for financial gain shall not be allowed without my

further written permission and that any user may be liable for copyright infringement.

Agree (Permission is granted.)

________________________________________ _________________________
Student Signature Date

Disagree (Permission is not granted.)

Huapeng Wang 04/29/2007


________________________________________ _________________________
Student Signature Date