F 12014
Examensarbete 30 hp Juni 2012
Implementing the circularly
polarized light method for determining wall thickness of cellulosic fibres
Marcus Edvinsson
Teknisk- naturvetenskaplig fakultet UTH-enheten
Besöksadress:
Ångströmlaboratoriet Lägerhyddsvägen 1 Hus 4, Plan 0
Postadress:
Box 536 751 21 Uppsala
Telefon:
018 – 471 30 03
Telefax:
018 – 471 30 00
Hemsida:
http://www.teknat.uu.se/student
Abstract
Implementing the circularly polarized light method for determining wall thickness of cellulosic fibres
Marcus Edvinsson
The wall thickness of pulp fibers plays a major role in the paper industry, but it is currently not possible to measure this property without manual laboratory work. In 2007, researcher Ho Fan Jang patented a technique to automatically measure fiber wall thickness, combining the unique optical properties of pulp fibers with image analysis. In short, the method creates images through the use of an optical system resulting in color values which demonstrate the retardation of a particular wave length instead of the intensity. A device based on this patent has since been developed by Eurocon Analyzer. This thesis investigates the software aspects of this technique, using sample images generated by the Eurocon Analyzer prototype.
The software developed in this thesis has been subdivided into three groups for independent consideration. First being the problem of solving wall thickness for colors in the images. Secondly, the image analysis process of identifying fibers and good points for measuring them. Lastly, it is investigated how statistical analysis can be applied to improve results and derive other useful properties such as fiber coarseness.
With the use of this technique there are several problems which need to be overcome. One such problem is that it may be difficult to disambiguate the colors produced by fibers of different thickness. This complication may be reduced by using image analysis and statistical analysis. Another challenge can be that theoretical values often differ greatly from the observed values which makes the computational aspect of the method problematic. The results of this thesis show that the effects of these problems can be greatly reduced and that the method offers promising results.
The results clearly distinguish between and show the expected characteristics of different pulp samples, but more qualitative reference measurements are needed in order to draw conclusions on the correctness of the results.
Examinator: Tomas Nyberg
Ämnesgranskare: Cris Luengo
Handledare: Thomas Storsjö
Contents
1 Introduction 4
1.1 Background . . . . 4
1.2 Purpose . . . . 4
1.3 Outline . . . . 4
2 An Introduction to Pulp Fiber Morphology and Properties 6 2.1 Anatomy of Wood Fibers . . . . 6
2.2 Variations in Fiber Properties . . . . 6
2.3 How FWT and FA Correlate with Paper Quality . . . . 7
2.3.1 Surface Texture . . . . 7
2.3.2 Mechanical Properties . . . . 7
3 Theory 9 3.1 Optical Properties of Fibers . . . . 9
3.2 Experimental Setup . . . . 9
3.3 Derivation of Equations . . . . 11
4 Solving SLT and FA for RGB Values 13 4.1 Error Estimation . . . . 14
4.1.1 Error in RGB Domain . . . . 14
4.1.2 Error in the SLT/FA Domain . . . . 14
4.1.3 Likelihood Evaluation . . . . 15
4.2 Constraints . . . . 15
4.3 Methods . . . . 16
4.3.1 Levenberg-Marquardt Algorithm . . . . 17
4.3.2 Brute-Force Search Algorithm . . . . 17
4.4 Validation . . . . 18
4.4.1 Using Theoretical Color Chart . . . . 19
4.4.2 Using Theoretical Color Chart with Added Noise . . . . . 22
4.4.3 Summary . . . . 26
5 Image Analysis 27 5.1 Where to Measure . . . . 27
5.2 Motivation for Chosen Method . . . . 28
5.3 Algorithm . . . . 29
5.3.1 General Procedure . . . . 29
5.3.2 Binary Image . . . . 30
5.3.3 Identifying Bad Regions . . . . 31
5.4 Evaluation . . . . 34
5.5 Challenges and Improvements . . . . 37
6 Results, Evaluation and Data Fitting 39 6.1 Samples . . . . 39
6.2 Results . . . . 40
6.2.1 Measured . . . . 40
6.2.2 Fitting FWT Distributions . . . . 43
6.2.3 Derived Measurements . . . . 46
6.3 Discussion and Conclusion . . . . 48
6.3.1 Evaluation . . . . 48
6.3.2 Problems . . . . 49
6.3.3 Possible Improvements . . . . 49
6.3.4 Conclusion . . . . 50
1 Introduction
1.1 Background
The wall thickness of pulp fibers has long been of great interest to the paper in- dustry. Due to the strong correlation between wall thickness and paper quality, paper mills have long since attempted to regulate this property. The separation of thick and thin walled fibers can be achieved through the process of cyclonic separation. This is possible owning to the fact that thick walled fibers have a higher density than the thin walled ones. What has been lacking in the indus- tries is a fast method for measuring a certain pulp’s distribution of fiber wall thickness. There are several methods for measuring both fiber wall thickness as well as the related fiber coarseness, which can be defined as density per length, but all of these methods require laborious analysis of samples in a lab.
It is established knowledge that fiber walls act as optical retarders, a property which can be used to determine the thickness of the fiber wall. But only recently, with the development of faster computers and improved digital cameras, has this method been suggested as an in-production real-time measuring module.
In 2007, pulp and paper researcher Ho Fan Jang received a patent [12] for a device using this principle. His patent included a more complex and accurate mathematical model than previously proposed methods which exploit the optics of fibers. The patent also included instructions on how to practically implement his device. The rights to develop this device were then bought and developed by Eurocon Analyzer.
This thesis will investigate the software aspect of the Eurocon Analyzer device. The device described in Ho Fan Jang’s patent, is intended to create images of the pulp fibers through a polarized light system. The fiber wall thickness can then be calculated from the color variations within an image. To get a good measurement of fiber wall thickness, the mean and distributions of a multitude of images are needed. The over-arching solution can be seen to consist of three stages. The first stage is to establish the fiber wall’s correct thickness value by using a color value. The second is to use image analysis to decide which points of the image should be measured. Lastly, statistical analysis is employed to present and improve the results.
1.2 Purpose
This thesis was ordered by Eurocon Analyzer who sourced an external perspec- tive in order to identify possible alternative software solutions for their device.
They hoped too, that more extensive analysis, conducted externally, would be conducive in establishing the best method for implementation of the device. The qualitative potential of Ho Fan Jang’s method, including limitations, accuracy and potential improvements, is included as an important aspect of analysis.
1.3 Outline
This thesis will initially provide the reader with background information re-
garding the morphology of pulp fibers and how such properties effect paper
making. The theory behind the used optics will then be explained. Proceeding
this background, follow the three main sections of the thesis, commencing with
how to solve fiber wall thickness from colors in the images, and consecutively the paper’s Image analysis section and a chapter on statistics and evaluation.
The content of these three main sections will be individually evaluated, whilst
the final chapter will also contain an evaluation of the thesis in its entirety.
2 An Introduction to Pulp Fiber Morphology and Properties
2.1 Anatomy of Wood Fibers
A wood fiber is composed of several walls and layers surrounding the fiber’s cen- tral cavity, called the lumen. The main purpose of this structure is to transport water and minerals from the roots to higher parts of the tree. This is accom- plished mainly through pressure differences due to evaporation in needles and
Primary wall S1-layer
S2-layer S3-layer
Lumen
θ
Figure 1: Principal sketch of fiber walls and layers.
leaves.[28] The structure of a fiber also serves as mechanical support for the trunk of the tree.
Fibers are made up of a primary outer wall P and and a secondary wall S, which is compiled of three layers, S 1 , S 2 and S 3 , as displayed in Figure 1. The primary wall has a thickness of 0.1 µm - 0.2 µm and is made of microfibers without any particular orientation.[28] The S 1 layer has a thickness of 0.05 µm - 0.35 µm with fibers angled at 70 ◦ - 80 ◦ , in alternating helices. The S 3 is simi- lar in its properties with a thickness of 0.05 µm - 0.15 µm and with fibers oriented close to perpendicular to the fiber axis.[23]
The S 2 layer stands for almost all varia- tion in the secondary wall, while properties of layers S 1 and S 3 remain quite constant.[28]
The thickness of the S 2 layer, which we will refer to as SLT, varies from 1 µm to 8 µm.
The fibers are arranged in a helix with an an- gle θ, which typically has values between 5 ◦ and 30 ◦ .[15] Henceforth, this angle θ will be referred to as FA and the total wall thickness will be referred to as FWT.
2.2 Variations in Fiber Properties
As mentioned above, fibers have two principal purposes; they function as both a delivery system and as mechanical support for the tree. During different seasons and stages of the trees life, these two attributes are of varying importance.
During Spring when the leaves are formed it is vital for the tree to carry lots of water and nutrition from the roots to the branches. The fibers are therefore typically broader with a thinner wall, resulting in a large lumen.[28] These fibers are called earlywood fibers, whilst those fibers formed during summer are referred to as latewood.
During Summer, when the tree does not need as much nutrition these late-
wood fibers are thinner, have a thicker wall and a smaller lumen. These types
of fibers have a higher density and provide better structural support. The same
patters occur in fast growing versus slow growing wood. A tree which grows
fast requires a larger amount of nutrition and therefore produces fibers with a larger lumen for better transportation of water and minerals.[28]
The age of the tree also correlates with fiber properties. The fibers of young trees are shorter, thinner and have thinner walls than older trees. The inner core of a older tree has therefore similar properties to juvenile wood.[28] A general rule for variations in fibers is that fast grown wood has fibers with a greater radius and thinner walls. Thin fiber walls also correlate with the microfibers in the S 2 -layer having a high orientation angle.
Table 1: Chart showing general trends in fiber properties among different wood types.
n.c. stands for “no correlation”.
Wood type FWT FA Length Radius
Early Low High n.c. Large
Late High Low n.c. Small
Juvenile Low High Short Small
Mature High Low Long Large
Fast growing Low High n.c. Large
Slow growing High Low n.c. Small
2.3 How FWT and FA Correlate with Paper Quality
The FWT property has been proven to relate to many properties of paper quality and is widely used within the paper industry. FA does not have as many useful applications, but some correlations with paper quality have been proposed.
Coarseness rather than FWT is usually what is correlated with certain paper qualities, mainly because coarseness historically has been easier to measure.
Coarseness is defined as mass per length.
2.3.1 Surface Texture
To get good printing results a smooth surface is crucial. Coarse fibers will cause an uneven surface with peaks and pits. Due to pressure on paper during printing, peaks may cause ink to spread down into surrounding lower areas. Pits in the paper may also cause ink free spots since the printer may lose contact with the paper.[27]
Another problem with coarse fibers is that they may decollapse during moist- ening. This will lead to a roughening of the paper’s surface and bad printing conditions.[27]
2.3.2 Mechanical Properties
The most important property related to tear strength is fiber length, but it has also been shown that a decreasing FWT results in higher tear strength.
Tensile strength is governed by several factors including surface area available
for bonding, fiber flexibility and degree of collapse. The impact of all of these
factors increases with a decreased FWT.[27]
It has also been shown that fibers with higher FA, for constant FWT, have
a higher elasticy modulus. As mentioned earlier this leads to the correlation
between increasing FA and an increasing tensile strength.[2]
3 Theory
3.1 Optical Properties of Fibers
A microfiber structure such as that of the secondary fiber wall is called uni- axial anisotropic. Such a structure acts as an optical retarder, since the wave components propagate faster in the microfiber direction.[8] The direction of the microfibers is called the optical and/or the fast axis.
The curled nature of the optical axis results in a very complicated system.
Therefore only light that passes through the middle of the fiber will be consid- ered. This light will always be perpendicular to the optical axis and the system can thus be viewed as a series of retarders.[8]
When light passes through the middle of a fiber it will pass through the S 2 layer twice, the first time this occurs, the fast axis will have an angle of θ and the second time an angle of−θ, with respect to the fiber direction. Since θ is less than 45 ◦ the two walls combined act as one retarder with a fast axis along the fiber direction. The S 1 and S 3 layers are much thinner and with a microfibrillar angle of approximately 90 ◦ in respect to the fiber direction. They will not greatly effect the optical characteristics of the fiber.
In conclusion, one fiber can be considered as a retarder with the fast axis along the fiber direction when light passes through the middle of the fiber per- pendicular to the fiber direction.
3.2 Experimental Setup
This section will explain why circularly polarized light and multiple color chan- nels are necessary for measuring the optical properties of fibers.
Below is the Jones matrix representation of a general retarder, where θ is the orientation of the fast axis with respect to the x-axis and ∆ is the retardation.[25]
B(∆, θ) =
cos 2 θ + e i∆ sin 2 θ (1 − e i∆ ) cos θ sin θ (1 − e i∆ ) cos θ sin θ e i∆ cos 2 θ + sin 2 θ
(1) Hence the optical effects of the sample depend on its orientation, which complicates the measurement greatly, but with a special optical arrangement this problem can be avoided.
Consider the following Jones representations for polarizer P , analyzer A and output vector E.
P =
p 1 p 2
, A =
a 11 a 12 a 21 a 22
, E =
e 1 e 2
(2) Multiplying them together in the order of their arrangement gives the output vector:
E = ABP (3)
The elements of the output vector E then take the following form.
e i = a i1 p 1 (cos 2 θ + e i∆ sin 2 θ)
+(a i1 p 2 + a i2 p 1 )(1 − e i∆ ) cos θ sin θ + a i2 p 2 (e i∆ cos 2 θ + sin 2 θ) (4)
If there is a polarizer and an analyzer (P , A), this results in the output light E being non-dependent on θ and non-zero. The system can thus be made orientation independent.
From the inspection of Equation 4 it is apparent that if the diagonal elements of B have equal scalars the trigonometric functions will be canceled out through the Pythagorean identity. Furthermore, the non-diagonal elements are equal and will cancel if one scalar is the negative of the other. These conditions are presented in Equation 5.
( a i1 p 1 = a i2 p 2 a i1 p 2 = −a i2 p 1
(5) The definition of the Jones vectors states that p 1 ∈ R and p 2 ∈ C.[13] To use the system to calculate changes in intensity the vector P also needs to be normalized, i.e. kP k = 1.
Given the definition of the Jones vectors, the condition of normalization and Equation 5, the following solution makes the element e i of E, non zero and independent of θ. Note that it is not necessary for both elements of E to be non-zero.
a i1 a i2
= 1
√ 2
1
±i
, P = 1
√ 2
1
∓i
(6) These vectors represent left and right circular polarized light.[8] To create a circular polarized system a combination of linear polarizers and quarter retarders are used.[8]
A = A 0
◦Q −45
◦=
1 0 0 0
i + 1 2
1 −i
−i 1
= e
iπ4√ 2
1 −i
0 0
(7)
P = Q 45
◦P 90
◦= i + 1 2
1 i i 1
1 0
= e
iπ4√ 2
1 i
(8) Hence the system, as shown in Figure 2, will satisfy the condition of orien- tation independence.
45
S F F 45
S
Polarizer
Quarter-wave plate
Quarter-wave plate Sample
Analyzer Multi-wavelength
unpolarized light
To multi-channel detector
Figure 2: The optical setup. F and S represent the fast and slow axis of the retarders.
Since two unknown variables exists for each measurement, more than one frequency of light needs to be analyzed to calculate these unknowns. A light source of three distinct and non-overlapping channels is therefore chosen as well as a suitable camera as a detector.
3.3 Derivation of Equations
The Jones matrix for a fiber can be obtained by multiplying the Jones matrices for each layer of the fiber that light needs to pass through. The microfiber angle of layers S1 and S2 is approximated to π 4 . Below is the expression for an unrotated fiber sample.
S 0
◦= B(∆ S1 , π 4 )B(∆ S2 , θ)B(∆ S3 , π 4 )
B(∆ S3 , π 4 )B(∆ S2 , −θ)B(∆ S1 , π 4 ) (9) To incorporate rotation of the sample, the Jones matrix is multiplied with rotation matrices.
S = R(ϕ)S 0
◦R(−ϕ) (10)
Where the rotation matrix is defined as:
R(ϕ) =
cos ϕ − sin ϕ sin ϕ cos ϕ
(11) An expression for output light strength relative to input light strength and sample parameters, given the optical system described in the previous section, can be constructed as follows:
E = p
I in A 0
◦Q −45
◦SQ 45
◦P 90
◦(12) Where I in is the input intensity. The intensity of the output light E is given by the square of the Euclidean norm of the vector.
I out = kEk 2 (13)
Equation 14 describes the individual retardations resulting from the fiber walls, where λ is the wavelength of the light and δ n is the birefringence mag- nitude. The birefringence magnitude is a material constant and it has been determined by Page and El-Hosseiny[23] that 0.056 is a good value for pulp fibers.
∆ S1 = (∆ kS1 − ∆ ⊥S1 ) = 2πt S1 δ nS1
λ
∆ S2 = (∆ kS2 − ∆ ⊥S2 ) = 2πt S2 δ nS2
λ
∆ S3 = (∆ kS3 − ∆ ⊥S3 ) = 2πt S3 δ nS3 λ
(14)
An expression for I out (Equation 15) has been derived by Ho Fan Jang and
presented in his patent description.[12]
I out (t S2 , θ) = I in
sin(∆ S2 ) cos(2θ) cos(∆ S1 − ∆ S3 )
− sin 2 (2θ) + cos(∆ S2 ) cos 2 (2θ) sin(∆ S1 + ∆ S3 ) +2 sin 2 ∆ 2
S2sin 2 (2θ) cos(∆ S1 ) sin(∆ S3 )
(15)
To determine the input intensity I in the analyzer is turned 90 degrees and an image is taken without a sample. This image will serve as a reference when evaluating the color intensities.
As a final step Equation 15 is solved for three wavelengths and the two un- knowns t S2 and θ are determined through the resulting overdetermined system (Equation 16). The wavelengths are chosen to match digital image and camera standards, i.e. red, green and blue.
I r 0 I g 0 I b 0
=
I r (t S2 , θ) I g (t S2 , θ) I b (t S2 , θ)
(16)
In Equation 16 I 0 are the measured intensities.
4 Solving SLT and FA for RGB Values
This section will deal with solving the overdetermined system that arises from Equation 15. More specifically it will examine methods for finding corresponding SLT and FA values for each RGB value and the creation of a look up table.
To save time and space the table will have the dimensions of 85x85x85 instead of the standard color size 256x256x256. The values of SLT and FA will be constrained to what are reasonable physical properties among fibers.
The problem can be formulated as a task of finding the SLT and FA values (t S2 , θ) that minimizes the error of a particular RGB value.
min ε rgb (t S2 , θ) (17)
SLT [µm]
FA [degrees]
1 2 3 4 5 6 7 8
5 10 15 20 25 30 35 40 45
Figure 3: Theoretical color chart. Each pixel represents the expected color for a (t
S2, θ) value
Looking at the Figure 3 it can be seen that color correlates with SLT and
intensity with FA. The almost black colors span over a large region and vary
greatly in SLT/FA values, but just slightly in their RGB value. Hence it will be
difficult to get valid solutions for very dark colors.
It is also apparent that this color chart (Figure 3) only contains a small fraction of all possible colors. Since Equation 17 is to be solved for all colors, how we define the error function, ε rgb (t S2 , θ) will greatly affect the solution.
4.1 Error Estimation
4.1.1 Error in RGB Domain
There exists a potential optimal solution (t 0 S1 , θ 0 ) for a given I 0 = (I r0 , I g0 , I b0 ), which in this application will be a table value. We can calculate the correct intensities for that particular SLT/FA value by evaluating it using Equation 15. Then the error in the RGB space would be the difference between I 0 and I(t 0 S1 , θ 0 ). Since the RGB channels are orthogonal to each other, the error can be summed as an Euclidean distance.
ε rgb (t S2 , θ) = q
(I r0 − I r (t 0 S2 , θ 0 )) 2 + (I g0 − I g (t 0 S2 , θ 0 )) 2 + (I b0 − I b (t 0 S2 , θ 0 )) 2 (18) The advantage of calculating the error in this fashion is that there are many available optimization algorithms which minimizes this error. It is also notable that when the error in the RGB space approaches zero, the error in the SLT/FA space also approaches zero.
4.1.2 Error in the SLT/FA Domain
Since the aim is to find mappings from RGB values to SLT/FA values, it would be most desirable to express the error in terms of SLT and FA. An error in this space would be easier to handle through the exclusion of high error solutions.
The derivatives of each color intensity point (I r , I g , I b ), are known.
5I(t S1 , θ) =
∂I
r∂t
S2∂I
g∂t
S2∂I
b∂t
S2∂I
r∂θ
∂I
g∂θ
∂I
b∂θ
!
(19) The error in each RGB channel is found by comparing the function value of the potential optimal solution I(t 0 S1 , θ 0 ) with the value it is trying to optimize for I 0 .
ε r (t 0 S2 , θ 0 , I r0 ) = |I r0 − I r (t 0 S2 , θ 0 )|
ε g (t 0 S2 , θ 0 , I g0 ) = |I g0 − I g (t 0 S2 , θ 0 )|
ε b (t 0 S2 , θ 0 , I b0 ) = |I b0 − I b (t 0 S2 , θ 0 )|
(20) Dividing the error with the corresponding derivatives and summing them up approximates the error in SLT or FA.
ε f wt (t 0 S2 , θ 0 , I 0 ) ≈
I r0 − I r (t 0 S2 , θ 0 )
∂I
r∂t
S2+
I g0 − I g (t 0 S2 , θ 0 )
∂I
g∂t
S2+
I b0 − I b (t 0 S2 , θ 0 )
∂I
b∂t
S2(21)
ε f a (t 0 S2 , θ 0 , I 0 ) ≈
I r0 − I r (t 0 S2 , θ 0 )
∂I
r∂θ
+
I g0 − I g (t 0 S2 , θ 0 )
∂I
g∂θ
+
I b0 − I b (t 0 S2 , θ 0 )
∂I
b∂θ
(22)
It would also be possible to construct the error functions without taking the absolute value of the change in each channel. This would cause certain color changes to cancel out certain changes in SLT or FA, which would give good results as long as I 0 and I 0 are in a region where the derivatives remain close to constant. But in cases where I 0 and I are far from each other the error could be calculated as low when it is actually high.
The total error in the SLT/FA space can be found by adding the errors of SLT and FA.
ε f wt,f a (t 0 S2 , θ 0 , I 0 ) = q
ε f wt (t 0 S2 , θ 0 , I 0 ) 2 + ε f a (t 0 S2 , θ 0 , I 0 ) 2 (23) 4.1.3 Likelihood Evaluation
Another way to evaluate solutions is to assume that only the colors of the theo- retical color chart (Figure 3) should exist and other colors deviate due to statis- tical noise. This noise could come from damages in fibers, the approximations made in Equation 15, bad photos or rounding.
Assumed that a point on a fiber has an actual physical value (t S2 , θ) then the resulting intensities of the respective color channels could be described as stochastic variables with a mean of I(t S2 , θ). The correct distribution for these variables is not trivial, but for simplicity the normal distribution is chosen.
X r ∼ N (I r (t S2 , θ), σ r 2 ) X g ∼ N (I g (t S2 , θ), σ g 2 ) X b ∼ N (I b (t S2 , θ), σ b 2 )
(24)
If I 0 = (I r0 , I g0 , I b0 ) are the color intensities with (t S2 , θ) value considered as their solution, then the likelihood of that solution could be described as follows:
L(t S2 , θ|I 0 , σ 2 ) = P (I r0 = X r ) · P (I g0 = X g ) · P (I b0 = X b ) (25) Give σ 2 a value is not so straight forward. Observation shows that fibers with higher SLT thickness are generally brighter and therefore hold a higher standard deviation. The standard deviation for a color channel on the middle of a fiber appears to vary between 1 and 20 depending on the brightness of that channel.
Equation 25 can also be extended to include how likely the (t S2 , θ) value is.
If f (t S2 , θ) is an approximated general distribution.
L ext (t S2 , θ|I 0 , σ 2 ) = f (t S2 , θ) · P (I r0 = X r ) · P (I g0 = X g ) · P (I b0 = X b ) (26) A good model for f (t S2 , θ) would be a combination of two bivariate normal distributions, were one represents spring and the other summer fibers. The advantage of evaluating the solution as in Equation 26 is that constraints would not be necessary.
4.2 Constraints
As stated before, SLT values typically range from 1µm to 8µm and FA values
from 5 ◦ to 30 ◦ . Hence values outside this region should be disregarded. The
tolerance of the FA values should be partly extended since focal problems tend to make fibers look darker.
Since SLT and FA are negatively correlated, linear constraints could be de- fined to exclude regions. Especially the region of low FA and SLT values, since fibers in this regions are rendered very dark and their values hard to determine.
Also the region of high FA and high SLT should not be included for the same reason.
Figure 4: Constrains following the ideas of this section plotted on the theoretical color chart.
The constraints that have been chosen for the applications presented in this paper are plotted over the theoretical color chart in Figure 4 and expressed as linear inequalities in Equation 27.
20t S2 + 3.5θ ≥ 70
−t S2 − 0.75θ ≥ −26.75 0.5 ≤ t S2 ≤ 8
0 ≤ θ ≤ 35
(27)
4.3 Methods
All methods presented in this section will describe algorithms for the construc-
tion of a 85x85x85 lookup table, where each value corresponds to an RGB value
and contains the associated SLT/FA value. The table is reduced to contain only
every third RGB value and other values are approximated to this value. This practice is used to save space and computation time.
4.3.1 Levenberg-Marquardt Algorithm
The available method to solve a problem like (17) is to use an iterative opti- mization solver and,more particularly, to use the error as defined in Equation 18.
The specific algorithm chosen is the Levenberg-Marquardt Algorithm provided in the levmar C library [19], which is a least-square minimizer, and is hence only useful for errors defined as such. This paper will not look into minimizing the other types of error it proposes with iterative optimization solvers.
The code for implementing look-up table generation with this algorithm is quite straight forward. All colors of the look-up table are looped through and then solved for a set of predefined starting points. The solution that produces the smallest error for each color is put in the look-up table.
Algorithm 1 Pseudo code for the generating table with iterative optimization algorithms
1: set slt table[0. . . 85][0. . . 85][0. . . 85] to 0
2: set fa table[0. . . 85][0. . . 85][0. . . 85] to 0
3: set error table[0. . . 85][0. . . 85][0. . . 85] to 10000
4: for r = 0 → 84 do
5: for g = 0 → 84 do
6: for b = 0 → 84 do
7: for all start values (slt0,fa0) do
8: slt, f a, error ← solve(r, g, b, slt0, f a0)
9: if error < error table[85][85][85] then
10: slt table[r][g][b] ← slt
11: f a table[r][g][b] ← f a
12: error table[r][g][b] ← error
4.3.2 Brute-Force Search Algorithm
This Brute-force search algorithm takes advantage of the fact that the look-up table does not need solutions for all colors. Only the colors from the color chart (Figure 3) and colors very similar to them would be needed.
The algorithm loops through a large set of feasible SLT and FA values, and calculates the corresponding color channel intensities. It then tests how well this SLT/FA value fits with the RGB value closest to the calculated color intensities, and also how well it fits with the surrounding RGB values. The best fit for each found RGB value will be saved. Determining the best fit can be done in the different ways described in section 4.1.
This method will leave a lot of holes in the look-up table, but this can be
used as an advantage since those colors should not occur and are probably the
effect of broken or overlapping fibers.
Algorithm 2 Pseudo code for the Brute-force search algorithm
1: set slt table[0. . . 85][0. . . 85][0. . . 85] to 0
2: set fa table[0. . . 85][0. . . 85][0. . . 85] to 0
3: set error table[0. . . 85][0. . . 85][0. . . 85] to 10000
4: scope ← 5
5: for all plausible slt values do
6: for all plausible fa values do
7: r, g, b ← get intensiteis(slt, f a)
8: for i = r − scope → r + scope do
9: for j = g − scope → g + scope do
10: for k = b − scope → b + scope do
11: error ← get error(i, j, k, slt, f a)
12: if error < error table[i][j][k] then
13: slt table[i][j][k] ← slt
14: f a table[i][j][k] ← f a
15: error table[i][j][k] ← error
What in Algorithm 2 is a plausible value is defined as in section 4.2.
4.4 Validation
The solution can not be validated in entirely the same way as a typical opti- mization problem, by simply looking at the magnitude of the error. This is due to larger errors being expected for some colors. Neither is it certain that the smallest error in the traditional sense would provide the correct solution.
Excluding only solutions with high errors would not be a good way of proceed- ing either since a very substantial amount of the optimal solutions for colors occurring in the pictures have high errors.
In this section six different look-up tables will be compared. The tables are listed bellow along with the specifications of the methods used to generate them.
RGB error Using Algorithm 2 with error calculated as in Equation 18 and linear constraints as defined in section 4.2.
SLT error Using Algorithm 2 with error calculated as in Equation 21 and linear constraints as defined in section 4.2.
SLT/FA error Using Algorithm 2 with error calculated as in Equation 23 and linear constraints as defined in section 4.2.
Maximum Likelihood ] Using Algorithm 2 with error calculated as in Equa- tion 25 and linear constraints as defined in section 4.2.
Ext. Maximum Likelihood Using Algorithm 2 with error calculated as in Equation 26 and box constraints with SLT [0.5,8] and FA [0,35].
Levenberg-Marquardt Using Algorithm 1 with error calculated as in Equa-
tion 18 and box constraints with SLT [0.5,8] and FA [0,35].
4.4.1 Using Theoretical Color Chart
An easy validation check is to transform the theoretical color chart(Figure 3) to SLT and FA grayscale images. What occurs is that each pixel of the color chart image is transformed to its corresponding SLT and FA value.
Figure 5: Color chart used when creating SLT and FA images in this section.
Below is a series of images where SLT and FA are calculated for each pixel of the color chart (Figure 5) and then the deviation from the actual value is plotted. To the left is SLT and to the right is FA, where yellow symbolizes positive and blue negative deviation.
SLT error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−0.5
−0.4
−0.3
−0.2
−0.1 0 0.1 0.2 0.3 0.4 0.5
FA error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−5
−4
−3
−2
−1 0 1 2 3 4 5
Figure 6: SLT and FA calculated using the RGB error method.
The method using the RGB error seems to produce a very good solution for
most plausible values. The big problem area is obviously the region with low
SLT (0.5µm-1µm) and high FA (20 ◦ -30 ◦ ). This is clearly seen in Figure 6.
SLT error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−0.5
−0.4
−0.3
−0.2
−0.1 0 0.1 0.2 0.3 0.4 0.5
FA error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−5
−4
−3
−2
−1 0 1 2 3 4 5
Figure 7: SLT and FA calculated using the SLT error method.
Compared with the RGB error method, the SLT error method appears to handle low SLT values better. As expected, FA is poorly solved in more regions than with the previous method. The solution shows some problems around 4µm-6µm associated with the local minima of the color channels.
SLT error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−0.5
−0.4
−0.3
−0.2
−0.1 0 0.1 0.2 0.3 0.4 0.5
FA error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−5
−4
−3
−2
−1 0 1 2 3 4 5
Figure 8: SLT and FA calculated using the SLT/FA error method.
From Figure 8 it can be seen that the SLT/FA error method gives quite a
similar result to the SLT error method. As expected, it provides better solutions
for FA in many regions, but surprisingly not around the minimum values of the
color channels, i.e. SLT values 4µm-6µm. Another difference from the SLT
error method is that the SLT/FA error method does not give the same good
results for low SLT values.
SLT error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−0.5
−0.4
−0.3
−0.2
−0.1 0 0.1 0.2 0.3 0.4 0.5
FA error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−5
−4
−3
−2
−1 0 1 2 3 4 5
Figure 9: SLT and FA calculated using the Maximum Likelihood method.
The SLT and FA plots of the error of Maximum Likelihood method (Figure 9) are very similar to the plots of the error of the RGB error method (Figure 6). This is to be expected since both of the methods measure the error in the RGB domain.
SLT error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−0.5
−0.4
−0.3
−0.2
−0.1 0 0.1 0.2 0.3 0.4 0.5
FA error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−5
−4
−3
−2
−1 0 1 2 3 4 5
Figure 10: SLT and FA calculated using the Extended Maximum Likelihood method.
The Extended Maximum Likelihood method seemingly produces very good
solutions for both SLT and FA.
SLT error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−0.5
−0.4
−0.3
−0.2
−0.1 0 0.1 0.2 0.3 0.4 0.5
FA error
SLT [µm]
FA [degrees]
0 2 4 6 8
0 5 10 15 20 25 30 35 40 45
−5
−4
−3
−2
−1 0 1 2 3 4 5
Figure 11: SLT and FA calculated using the Levenberg-Marquardt algorithm.
As can be seen in Figure 11 there are numerous problems with the solution produce by my attempt at this method. Surely it is possible to improve solutions using the same method, but there will always be a few of obstacles. It will, for example, be difficult to know how the algorithm will act for all colors and even if a lot of starting points are used this is no guarantee that the correct local minimum will be found.
4.4.2 Using Theoretical Color Chart with Added Noise
Basically all of the proposed methods give good results for the convenient color values, i.e. no values present in the theoretical color chart are too dark. The real challenge is to produce sound real solutions for values deviating from the theoretical ones. In the real system there is a considerable amount of noise from the photo itself and from the unevenness of the biological material. To emulate this and test how well the different methods handle this problem the following is proposed:
1. Generate a color chart
2. Add Gaussian noise to all channels of the color chart. (Figure 12) 3. Calculate the SLT and FA images from the distorted color chart.
4. Take the difference between the calculated values and the original values used to calculate the color chart in step 1.
5. Calculate the average of this difference in the plausible region, as defined in Section 4.2.
Typical standard deviation on the middle of the fibers in the photos used
in this report are between 1 and 20. In this section the effects of noise with
variance 5, 10 and 15 will be examined. The same procedure with no added
noise will also be included for reference.
Figure 12: Theoretical color chart with added gaussian noise with σ = 10.
Table 2: Table of the mean error in SLT [µm] after noise is added to the color chart.
σ of noise
Method 0 5 10 15
RGB error 0.029 0.116 0.284 0.612
SLT error 0.043 0.155 0.303 0.623
SLT/FA error 0.041 0.149 0.299 0.609
Maximum Likelihood 0.030 0.120 0.305 0.630
Ext. Maximum Likelihood 0.036 0.139 0.430 0.816
Levenberg-Marquardt 0.437 0.619 0.826 0.995
From Table 2 we can see that the RGB error method produces the smallest SLT mean error for all tested noise levels. The SLT and SLT/FA error methods improve a lot with respect to the RGB error method when the noise is increased.
The Maximum-Likelihood based methods act very similar to the RGB error, but
produce slightly worse results. The SLT/FA error method acts similarly to the
SLT error method, but with slightly better results.
Table 3: Table of the percentual mean error in SLT after noise is added to the color chart.
σ of noise
Method 0 5 10 15
RGB error 2.2% 7.5% 16.7% 30.2%
SLT error 2.5% 7.2% 14.1% 26.9%
SLT/FA error 3.1% 9.2% 16.8% 29.2%
Maximum Likelihood 2.2% 7.8% 18.5% 31.9%
Ext. Maximum Likelihood 2.4% 9.2% 26.6% 43.6%
Levenberg-Marquardt 15.3% 31.5% 45.6% 55.4%
When looking at percentile errors displayed in Table 3, the SLT error method gives better results at noise levels 5, 10 and 15, than the RGB error. This, combined with the results in Table 2, lead us to the conclusion that, the SLT error method provides better results for low SLT values and that the RGB error method gives better values for high SLT values.
It is also notable that the Extended Maximum Likelihood method gives a very good solution when no noise is applied, but the solution rapidly deteriorates with increased noise levels. The SLT and SLT/FA error methods seem to be most robust in the face of noise.
Table 4: Table of the mean error in FA [degrees] after noise is added to the color chart.
σ of noise
Method 0 5 10 15
RGB error 0.665 1.929 3.087 4.586
SLT error 0.958 2.614 3.740 5.066
SLT/FA error 0.979 2.174 3.179 4.521
Maximum Likelihood 0.685 1.965 3.126 4.561
Ext. Maximum Likelihood 0.683 1.824 3.224 4.620 Levenberg-Marquardt 13.838 13.662 13.351 13.278
From Table 4 it can be seen that that the RGB error, SLT/FA error, Maxi- mum likelihood and the Extended Maximum Likelihood methods give similarly good results. As expected, the SLT error method does not work as well for FA as it does for SLT.
To further illustrate how the different methods handle noise, the same test
as applied above can be done several times to get an average error for each
value for a particular noise level. The image below is the mean error taken on
20 images with added Gaussian noise with a standard deviation of 15.
SLT error
SLT [µm]
FA [degrees]
0 1 2 3 4 5 6 7 8
0 5 10 15 20 25 30 35 40 45
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Figure 13: Mean error of SLT thickness when Gaussian noise with a standard deviation of 15 is added. For this plot the RGB error method is used.
SLT error
SLT [µm]
FA [degrees]
0 1 2 3 4 5 6 7 8
0 5 10 15 20 25 30 35 40 45
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Figure 14: Mean error of SLT thickness when gaussian noise with a standard deviation of 15 is added. For this plot the SLT error method is used.
As can be seen from Figures 13 and 14 the big difference between the RGB
error method and SLT error method is that the SLT method works much better
for low SLT values. Otherwise the plots look very similar.
SLT error
SLT [µm]
FA [degrees]
0 1 2 3 4 5 6 7 8
0 5 10 15 20 25 30 35 40 45
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2