818
Markov Chain Based Edge Detection Algorithm for Evaluation
of Capillary Microscopic Images
G. Hamar1, G. Horvath1, Zs. Tarjan2 and T. Virag3
1
Budapest University of Technology and Economics/Department of Measurement and Information Systems, Budapest, Hungary
2
Policlinic of the Hospitaller Brothers of St. John of God in Budapest/Department of Rheumatology II., Budapest, Hungary
3
Kokabura Ltd., Budapest, Hungary
Abstract— Nailfold capillaroscopy is a non invasive, simple
examination, which provides exact information on the assessment of the microcirculation. The peripheral blood circulation
is very sensible for certain illnesses e.g.: autoimmune diseases,
diabetes. In many cases there exists a pattern specific for certain illnesses, therefore this test is capable of differentiate
between them. Our aim is to develop a computer aided evaluation system for capillary microscopic images. The fist step of
the evaluation is the detection of capillaries, which is done by
edge detection. Classical edge detectors resulted in unsatisfactory output, therefore we tried a different approach, which is
able to take into account not only the local properties of the
image, but also the relations of pixels. During the test of the
algorithm we obtained that with a suitable post processing
procedure the capillaries shown in the picture can be detected
robustfully, hence our procedure is applicable as the first step
of the evaluation of these images.
Keywords— Edge detection, medical image processing, diagnostics.
I. INTRODUCTION
Capillary microscopic examination means examining the
smallest vessels of the human organ, the capillaries. The
peripheral blood circulation is very sensible for certain
illnesses e.g.: autoimmune diseases, diabetes. In many cases
the deformations in the blood circulation can be observed
before other symptoms, therefore capillary microscopic
tests play an important role in the early identification of
these diseases [1].
Today the main problem is that there is not a cheap, easily accessible instrument, which is capable not only of the
image or video recording, but has a support for computer
aided evaluation. This is very important because the exact
and objective evaluation requires much more time than the
examination itself, and this is why quantitative measures are
rarely used.
The first problem of image evaluation is the detection of
capillaries, this is essential for any further image processing
steps. We have to achieve high hit rate with low number of
false positive hits, despite of the low image quality. In our
presentation we will introduce an edge-detection method
which can solve this problem with relatively high performance.
II. MATERIALS AND METHODS
A. Capillary microscopic images
The capillary microscopic pattern of a healthy patient is
examined by many researchers, hence it is precisely defined
by the medical literature. As one can see in Figure 1(a) the
vessels are arranged into rows, they are regular hairpin
shaped, with the same orientation. A capillary loop has two
parallel stems: a thinner called arterial section, and a wider
called venous section. They are connected with a winding
part called apical section.
The most important parameters that can be extracted
from the picture: the arrangement of the vessels, sizes of the
hairpin (length, distance of the two stems, diameters), shape
of capillaries, linear density, occurrence of micro hemorrhages and visibility of SVP (Subpapillary Venous Plexus).
In certain diseases the healthy pattern changes. In many
cases the regular arrangement breaks up. If the vessels become dilated, they are called giant- or mega-capillaries
according to their size. The hairpin shape can also be
changed: the medical literature classifies the modified
shapes into the following groups: meandering, bushy, ball,
tortuous and ramified. The linear density decreases in general, in certain cases micro hemorrhages can be observed,
and the visibility of the SVP increases.
B. The method of image recording
There is a generally accepted method for capillary microscopic examinations [2], [3], hence we have also followed
this method. Our present database was created with a stereo
microscope with 100x magnification. We used paraffin oil
for increasing the transparency of the skin, and a light
source (intralux 6000) with cold light. The direction of the
light was approximately 45º.
819
C. Edge detection
NEXT_POINT(f,x,y,v0)
As it can be seen in Figure 1(a) the capillaries do not
have sharp edges, the image is very blurred and noisy.
These properties are mainly come from the recording
method, because capillaries are observed through the skin.
Classical edge detectors such as Sobel, Laplace and Canny
operators have given bad result. It was very hard to separate
real edges from noise, and edge detectors found not only the
borders but the whole area of the capillaries because this
intensity changes continuously in perpendicular direction to
the capillary. Considering this properties we decided to
search not the border but the centre line. It can be detected
by calculating the second derivatives of the image. The
efficiency of these methods were higher, but it was not
enough for our problem. The centre line of capillaries can
be located more robustly if we use not only the local properties, but also the relations between pixel locations as described in later sections.
D. “Walking” algorithm
An exact definition can be given for the centre points of
capillaries with the second derivatives of the image. Let us
consider the images as a 3D surface, where the intensity is
the third dimension. Capillaries are valleys on this surface,
and a centre line is the bottom of a valley. Our task is to
give definition for these bottom points. A point is a bottom
point of a valley, if the curvature of the image is significantly different in two perpendicular directions, and the
point is a local minimum along a line which is perpendicular to the direction of the valley. The direction of the valley
can be calculated with the following method. Let f(x,y) be
the intensity of the image in the pixel at point (x,y), let Ax0,y0
be the matrix of the second derivatives at the (x0, y0) point:
A x0 , y 0
⎡ ∂2
⎢ ∂x 2 f x0 , y 0
=⎢ 2
⎢ ∂ f
⎢⎣ ∂x∂y x0 , y 0
⎤
∂2
f x0 , y 0 ⎥
∂x∂y
⎥
∂2
f x0 , y 0 ⎥
2
⎥⎦
∂y
(1)
The eigenvector of A, which belongs to the smaller eigenvalue, points to the direction of the valley. The knowledge of the direction of the vessels can be used to create an
iterative algorithm, which walks along the vessel from a
given point. During the walk the algorithm makes little
steps to the direction of the valley, which is calculated from
a little surrounding of the current point. The pseudo code of
NEXT_POINT(f,x,y,v0), which calculates a step of the walk, is
the following:
1. Calculating A in point (x,y)
2. v ← the normalized eigenvector of A belonging to the
smaller eigenvalue
3. if v0T·v < 0 then v ← -v
4. v0 ← v
5. p ← (x,y) T+ v·const
6. l ← section through p, which is perpendicular to v
7. q ← minimum point of f(x,y) from the points of l
8. return q
Lines 1 – 2 calculate the direction of the valley according
to the second derivatives, as described above. There are two
possible ways in a valley where we can move, therefore we
must choose from them (lines 3 – 4). For this decision we
need the direction of the previous step (v0). To avoid cycles,
the direction is chosen, so that the angle of two subsequent
steps is less than 90º. The performance of the algorithm can
be improved if we search the local minimum of the section
which is perpendicular to the estimated direction of the
valley, because this technique decreases the probability of
going out of the capillary (lines 6 – 7).
During a walk the algorithm performs steps one after the
other. The end point of a step is the start point of the next
one:
WALKING_ALGIRITHM(f)
1. s ← START_POINT()
2.
3.
4.
5.
6.
7.
8.
9.
10.
v0 ← 0
w ← (s)
repeat
s1 ← NEXT_POINT(f,s,v0)
v0 ← s1-s
s ← s0
w ← s appended to w
until STOP_CONDITION()
return w
Lines 1 – 2 perform the initialization. The v0 vector is the
direction of the previous step before the first step it is irrelevant, therefore it can be set to 0. In the repeat – until
iteration (lines 4 – 9) the NEXT_POINT procedure calculates
the following point of the walk, and in line 8 each calculated point is added to the walk.
The performance of this method highly depends on the
two procedures: START_POINT and STOP_CONDITION. The
implementation of these procedures can contain complex
conditions and must be based on the properties of the used
images. The main problem of this approach is that it is very
difficult to implement these procedures so that they give
good results on high variety of images.
820
E. Random walk
where so that
Both of the two procedures can be got around by using a
probabilistic approach. Instead of starting the walk form one
ore more specified positions, we can start it from a random
position. Instead of following each walk separately we can
calculate the probability of staying in a certain position after
the 1th, 2nd, …, Mth step. This is similar to the approach,
used by the early Google for web page ranking [4]. In the
initial state we assume that we can be in any pixel position
with the same probability. During an iteration of the algorithm we modify this probability distribution according to
the walk. If i1, i2, … are the pixels from where we can step
to j with the walking algorithm, than the probability of staying in pixel position j in the (k+1)th iteration is:
Pk +1[ j ] = Pk [i1 ] ⋅ pi1 , j + Pk [i2 ] ⋅ pi2 , j + … +
+ Pk [in ] ⋅ pin , j
(2)
where pi,j is the probability of stepping from i to j if we are
in pixel position i. Our assumption is that if we come into a
point of a valley during the walk, we stay in the valley with
high probability. If it is outside the valley the direction of
the step is nearly random, so the probability of staying in
these points is uniform, therefore relatively low. After some
iteration the probability of staying in a pixel, which belongs
to a valley, becomes significantly higher than in other
pixels.
This problem can be formalized as a finite state homogeneous Markov chain. Let us label the pixel positions with
positive integers form 1 to N. Let Xk be a random variable,
where Xk = i means that the walk is in the pixel position i ∈
{1, 2, …,N} after the kth step. Let X be the stochastic process: X = (X0,X1, …,XM), and let pi,j = P(Xk+1 = j|Xk = i), that is
the probability of moving to the pixel position j if we are in
pixel position i. If this probability is independent from k for
every i and j, then X is a homogeneous Markov chain. If Pk
= (P(Xk = 1), P(Xk = 2), …, P(Xk = N)), is the probability
distribution of Xk, and T = [pi,j] is the state transition matrix
of the Markov chain, then Pk+1 can be calculated with a
vector – matrix multiplication:
Pk +1 = Pk T
(3)
P0 is the uniform distribution, so that P0[i] = 1/N for
every i. The matrix T can be derived from the NEXT_POINT
procedure. From pixel position (x, y) we can move to the
little neighborhood of two possible destinations according
to the procedure. The probability of moving to the points of
this neighborhood is calculated according to a 2D Gaussian
distribution. Each probability is written to a position in the
matrix. From every pixel position we have to move some-
∑
j
pi , j = 1 for every i, that is the sum of
every row in T must be 1.
F. Complexity
The T matrix is very large, because number of elements
is N2, where N is the number of pixels. However T is sparse,
because it has 2L non-zero elements in every row, where L
is the number of pixels in the neighborhood of a pixel. The
complexity of the matrix – vector multiplication is proportional, with the number of non-zero element in T, so that the
runtime complexity of one iteration is O(NL), therefore the
complexity of the whole algorithm is O(NLM), where M is
the number of iterations.
In our experiment we implemented the algorithm in C++,
and we used a Pentium IV 3GHz computer, with 1GB
RAM. With 647x435 resolution images, L=5x5 neighborhoods and M=100iterations the procedure terminated in 52s.
III. EXPERIMENTAL RESULTS
The resulting probability distribution can be viewed as a
grey-scale image, after scaling pixel values to the 0 – 255
interval. Figure 1 shows the result on a typical capillary
microscopic image. We have run the procedure for 10, 20
and 100 iterations. As it can be seen with increment of the
number of iterations the noise becomes less, but the vague
capillaries also begin to disappear. It is difficult to precisely
measure the efficiency of the algorithm, because there is no
exact reference with which it could be compared, we can
only use the opinion of a human observer. We have applied
this algorithm on 30 images, with variable quality. After a
post-processing step (edge detection, noise filtering and
edge connection) the results are compared with the human’s
opinion. The vessels detected by the algorithm were 91% of
the vessels which are seen in the image.
IV. CONCLUSION
We have introduced a novel method of edge detection,
which uses a different edge definition than traditional edge
detectors. A definition based not directly on local properties
of the image, but utilizes the relation between pixel positions, which is calculated using local properties. We have
tested our solution on a capillary microscopic image set, and
we found that we can achieve higher performance, than with
other edge-detectors.
In our research we examined special type of edges, but
our method can be easily modified to detect other types,
821
(a) Original image
(b) After 10 iterations
(c) After 20 iterations
(d) After 100 iterations
Fig. 1 Result of the edge detection
such as step edges. Generalizing the algorithm remains a
future research problem.
3.
4.
ACKNOWLEGEMENT
Zs. Tarjan, E. Koo, P. Toth, and I. Ujfalussy, “Capillary microscopic
examinations (kapillarmikroszkopos vizsgalatok)”, Magyar Reumatologia, 42:207 – 211, 2001, (In Hungarian).
L. Page, S. Brin, R. Motwani, and T. Winograd, “The pagerank
citation ranking: Bringing order to the web,” Tech. Rep., Stanford
University, 1999.
This research was supported by the EU, GVOP grant
3.3.3-05/2.-2006-01-0130/3.0.
REFERENCES
1.
2.
A. Bollinger and B. Fagrell, Eds., Clinical Capillaroscopy, Hogrefe &
Huber Publishers, 1990.
P. Dolezalova, S. P. Young, P. A. Bacon, T. R. Southwood, Nailfold
capillary microscopy in healthy children and in childhood rheumatic
diseases: a prospective single blind observational study, Annals
Rheumatology Disease, 2003, pp: 444-449.
Author:
Institute:
Street:
City:
Country:
Email:
Gabor Hamar
Budapest University of Technology and Economics
Magyar tudosok korutja 2.
Budapest
Hungary
[email protected]
© Copyright 2026 Paperzz