Professional Documents
Culture Documents
Master’s Thesis
Development of Efficient Algorithm for
Geometrical Representation based on Arclet
Decomposition
Piyanut Pongpiyapaiboon
Piyanut Pongpiyapaiboon
Preface
The work presented was carried out at GSF - National Research Center for En-
vironment and Health (Institute of Biomathematics and Biometry ,IBB). It was
developed in the project ” Geometric multiscale image approximation schemes”
in the group of Mathematical Modelling in Ecology and the Biosciences led by
Prof. Dr. Gerhard Winkler and under the supervision of PD. Dr.Hartmut Fuerh.
I gratefully acknowledge Dr. Hartmut Fuehr for his inspiring guidance, valu-
able suggestions and patience. I particular would like to thank Dr. Felix Friedrich
for helping me with valuable suggestions and many ideas to work with Oberon
programing and for motivating me to do this thesis. I am especially indepted to
Dr. Laurent Demaret for mathematical inspiration, encouragement and patience.
I thank the members of GSF for thier support.
Piyanut Pongpiyapaiboon
Contents
1 Introduction 5
1.1 Dyadic Partition of the Image Domain . . . . . . . . . . . . . . . 6
1.2 Wedgelets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3 Arclets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4 Why consider arclets? . . . . . . . . . . . . . . . . . . . . . . . . 12
1.5 2-dimensional Potts-Functional
and its minimization . . . . . . . . . . . . . . . . . . . . . . . . 17
4
Chapter 1
Introduction
This thesis is concerned with efficient algorithms for the segmentation of images,
using so-called ‘arclets’ for the modelling of geometrical fine structures in images.
We consider finite image domains S = {1, ..., 2n } × {1, ..., 2n }, and continu-
ous image domains S = [0, 1[2 . The precise choice will be made clear depending
on the context. An image is a map y : S 7−→ R. A segmentation consists of a
partition P of the image domain S into connected regions, and for each region
R ∈ P a function yR : R 7−→ R from a prescribed set of functions (local regres-
sion models). In this thesis, we choose the simplest local regression model, i.e.,
constant functions. So every segmentation consists of a partition P, and for each
p ∈ P, a constant function yp on p.
If we piece functions yp together then an approximation of function y is ob-
tained, denoted by yP . Hence, we are considering the problem of first partitioning
the image domain into connected regions and then approximating the image by a
constant on each single region. Criteria for a choice of segmentation are usually
given in the form of a variational problem, by minimization of a suitable func-
tional
H(y, (P, yP )) = U (P, yP ) + D(y, (P, yP ))
in (P, yP ), ranging over a certain prescribed set of segmentations. The D-term
measures the distance of segmentations (P, yP ) to image data y, and U is a regu-
larization term. In the suitable functional, U are contains information or assump-
tions about the original, and D contains assumptions about the noise.
One motivation for considering such a problem is denoising [2]: Here we as-
sume that the image y originated from an element of the segmentation by some
distortion or noise effect, and we want to recover the original image. Also, seg-
mentations can be used to directly extract information from the image, such as
edges.
There are two approaches for considering the minimization problems, stochas-
tic optimization methods ,see [8],[1], [18] and deterministic minimization in a
5
restricted search space. In this thesis we apply the deterministic approach, the
motivation behind this approach is to obtain efficient algorithms and exact min-
imizers. One example of such an approach are dyadic partitions, which have a
structure that allows fast minimization algorithms. Wedgelets were defined as a
refinement of dyadic partitions, and the arclets presented below will be a further
refinement.
(a3)All r ∈ P are connected (in the finite case, connected with respect
to four-neighborhoods.)
qsplit
6
Dyadic Partition A dyadic partition of the image domain S is given by any finite
partition Q of S into disjoint dyadic squares. Dyadic partitions are gener-
ated by recursively applying a quad split to the image domain. The tree
structure induced this way will be utilized in the development of a mini-
mization algorithm. We can establish the tree structure associated to this
decomposition. If Q = {p1 , ..., pn } is a quadtree partition then T be the set
of all dyadic squares containing at least one element of Q as a subset. Then
the inclusion of dyadic squares makes T a quadtree, and the leaves of T are
the elements in Q.
1.2 Wedgelets
Let S = [0, 1[2 be the continuous image domain. Consider a rectangle Q ⊂ S, for
each point x ∈ R2 and angle α ∈ [0, 2π[, the sets Ax,α (Q) and Bx,α (Q) be defined
7
by
The sets Ax,α (Q) and Bx,α (Q) are disjoint, connected, and their union is the rect-
angle Q for each x ∈ R2 and α ∈ [0, 2π[.
A wedgelet partition P is obtained from a quadtree partition Q by splitting
each element q ∈ Q into (at most) two wedge-shaped sets along the straight line
with angle α, q = w1 ∪ w2 .
r
Lx,α
x
Rx,α
8
Figure 1.4: Wedgelet segmentation
9
1.3 Arclets
Wedgelets were introduced by Donoho [4]. Algorithms for the efficient imple-
mentation of wedgelets were developed in [16], [6]. The motivation of wedgelets
was to include edges that are not horizontal or diagonal. In this thesis we want to
extend this to arclets, which allows to include curved edges.
The aim is similar to the wedgelets, replacing straight lines by circular arcs:
We consider a quadtree partition of the image domain, and allow to split each
element of the partition along a circular arc.
Consider the continuous domain S = [0, 1[2 , a rectangle Q ⊂ S, a center point
xc = (xc,1 , xc,2 ∈ R2 , and a circle Cr centered around xc with radius r ∈ R+ .
The set Axc ,r and Bxc ,r be defined by
the sets Axc ,r (Q) and Bxc ,r (Q) are disjoint, connected, and their union is the rect-
angle Q for each x ∈ R2 and r ∈ R.
An arclet partition P is obtained from a quadtree partition Q by splitting each
element q ∈ Q into (at most) two sets, along a suitable circular arc q = w1 ∪ w2
B(xc,r)
A(xc,r)
r
cr(xc,yc)
(xc,yc)
10
A arclet segmentation is a pair (g, A) consisting of an arclet partition A and a
function g that is constant on all a ∈ A.
11
1.4 Why consider arclets?
Geometrical representation based on arclet decomposition has been developed to
improve the performance of the wedge approach. In order to compare the different
approaches we use approximation rates for horizon images.
Horizon image Horizon images are a simple model for an image consisting of
homogeneous regions with smooth boundary. Let f : [0, 1[→ [0, 1[ be a
boundary function, and define y : [0, 1[2 7−→ {0, 1} where
½
1 if x2 ≤ f (x1 )
y(x1 , x2 ) =
0 otherwise
(x, f(x))
εN (y) = inf ky − yp k ,
P ∈C,|P |≤N
12
i.e., the best possible approximation of y by a partition P ∈ C with at most
N pieces. We look for approximation schemes which give a fast decay
εN −→ 0, with faster decay for smooth boundaries.
The aim of this section is to show that using more complicated schemes (wedgelets
instead of quadtree, arclets instead of wedgelets) results in better approximation
rates. The following arguments are not mathematically rigorous, and they are also
not complete, but they provide a certain motivation. First we need a statement
about how well a dyadic partition can adapt to a horizon image.
13
Dj (f ). The trees Tj (f ) are obtained recursively: If Tj (f ) is given, Tj+1 (f ) is
found by applying a quad-split to all elements in Dj (f ). Hence Tj+1 (f ) has
3|Dj (f )| more squares than Tj+1 (f ), which shows that |Tj (f )| ≤ 3d · 2j .
Each element q ∈ Tj (y) \ Dj (y) does not meet the boundary. On each such q
the image y is constant, and Gj takes the same value. For q ∈ Dj (f ), we let Gj
take the mean value of y. Then we obtain the squared approximation error
X
kY − Gj k22 = kY |q − Gj |q k22
q∈Tj
X
= kY |q − Gj |q k22
q∈Dj (y)
14
Z
ky|q − Gj |q k22 = | y(x1 , x2 ) − Gj (x1 , x2 )|2 dx1 dx2 ≤ 2−2j
q | {z }
≤1
at most 2−j ×2−j which yields an overall estimate d·2−j . Therefore, for N = d·2j
we have an estimate εN (y) ≤ C · 2−j = O(N −1 ).
It can be shown that in general, a better approximation can not be obtained,
even if the boundary function is very smooth.
f(x)
tangent
Z0
Figure 1.9:
Thus we define Gj on q as the function taking value ’one’ below the tangent
and ’zero’ above the tangent. We define Gj on Tj \ Dj (y) as we mention before.
15
We again obtain kY − Gj k22 as the sum of the square of approximation error con-
tributed by the elements of Dj (y). For each such q, the square of approximation
error is the area between the tangent and graph (y), which can be estimated by the
mean value theorem: For each x ∈ [0, 1[,
d· 2−j
|{z} × −αj
2|{z}
length of integration domain upperboundforintegrand
kY − Gj k ≤ d · 2j · 2−j · 2−αj
= d · 2−αj ,
16
1.5 2-dimensional Potts-Functional
and its minimization
For the estimates for the different schemes to be useful, we need some means
of computing the minimizers efficiently. This is made possible by the so-called
Potts-Functional. We introduce the 2-D Potts-Functional on segmentations for the
discrete 2-dimensional image domain
.
Given the image data y = (ys )s∈S , with (ys ) ∈ R, and the regularization
parameter γ ≥ 0, the Potts functional is defined
Since we use the l2 -norm, the optimal yP associated to a fixed partition P is ob-
tained by assigning each p ∈ P the mean value of y over p. Hence it is enough
to find the optimal P and compute yP from it. We write Hγ,y (P ) = Hγ,y (P, yP ),
where yP is understood to be the optimal piecewise constant function associated
to P .
A minimizer of Hγ,y will be denoted by Pγ , and the associated piecewise
constant image by yγ . The minimization of the Potts functional means to find
a γ-weighted balance between the number of the partitions P and the quality of
approximation error. The regularization parameter γ can be considered as a scale
parameter with the range [0, ∞). For γ = 0 the minimizer is in general the finest
possible segmentation and for γ → ∞ the segmentation consists of a single re-
gion.
Observe that the minimizer in equation (1.1) can be viewed as an optimal
approximation of y: Let ε = ky − yγ k2 then among all geometrical partitions
incurring an approximation error of at most ε, Pγ has the smallest number of ele-
ments. Therefore, by minimizing (1.1), we actually compute optimal approxima-
tion rates. In addition, the next remark shows that there exists a fast minimization
algorithm for (1.1). Combining these two observations, we see that the approxi-
mation rates derived above for the different schemes, are achievable by an efficient
algorithm.
17
Minimization algorithm
2. Global minimization
Given γ, compute the optimal geometrical decomposition P from the data
stored in the first step. The quad-tree structure allows to do this by a simple
recursive algorithm, based on the following observation: Given an image y
and every parameter γ, we need to compare two candidates for the optimal
geometrical partition:
(a) Pγ is obtained by a single geometrical split of the dyadic square S; or
(b) Let S = S1 ∪ S2 ∪ S3 ∪ S4 denote the decomposition of S obtained
from a quad-split applied to S. Let Pγi denote the optimal geometrical
S of Si , associated
partition
i
the restriction y|Si and the parameter γ. Then
Pγ = i=1,..,4 Pγ
We observe that the second step only uses the approximation errors provided
by the first step, and it does not need to know the precise geometric nature of the
possible splits used in step one. Therefore we only need to adapt the first step to
the arclet setting.
18
Chapter 2
• Best arc split: Given image data y, a center point c and a dyadic square q,
determine the best arc split q = w1 ∪ w2 obtained by splitting q along an arc
with center c. The best arc split is the one for which the error obtained by
approximating y on q by a function that is constant on w1 and w2 is minimal.
Given the best arc split, we also need to compute the associated approxima-
tion error.
19
• Painting an arc split: Given an arc split q = w1 ∪ w2 and greyvalues v1 , v2 ,
”paint” the function that takes vi on wi .
The first problem is the critical one from the point of view of computation
times: We must compute sums over image greyvalues for a large set of subsets of
the image domain. This gives big computation times, if it is not done properly.
Our solution to this problem depends on the so-called summation trick already
employed for wedgelets. It is a technique that allows to quickly compute sums
over various subsets of the image domain.
X 1
b = y 0 (x)x∈w2 = (y(x)) · (2.2)
x∈w2
|w2 |
+ |w1 | a2 + |w2 | b 2
(2.3)
P P
where |w1 | = x∈w1 1 and |w2 | = x∈w2 1. Hence we can compute the approx-
imation error from suitable sums over q and w1 ,w2 . The summation trick now
provides a way to do this in O(1) operations, using lookuptables which are com-
puted beforehand in linear time. This way, the computation of the approximation
error is independent of the size of the dyadic square.
20
2.2 Summation over Continuous Domains
To make things simple, we first describe the summation trick for the continuous
setting. Let us fix a circle C with given radius r and center (xc , yc ) and an inte-
grable function defined on R2 .
Suppose that z = (x, y) is a point on the circle C. Then z is either on the
lower or on the upper arc. Let yu , yl : [xc − r, xc + r] → R be the parametrizations
of the upper and lower arcs as functions of the x-coordinate. We then define the
auxiliary upper and lower functions by
Z x Z
Ku (z) = f (s, t)dtds (2.4)
x0 −r 0≤t≤yu (x)
Z x Z
Kl (z) = f (s, t)dtds (2.5)
x0 −r 0≤t≤yl (x)
By definition, Ku (z) equals the integral over the values of y, integrated over
the domain between the x-axis and the upper arc up to z. Similarly, Kl corre-
sponds to the integral over the lower arc. Finally, let K(z) denote the integral
over the rectangle with lower left corner given by (0, 0) and upper right corner x0 .
Hence, in the case shown in figure 2.2. If z lies on the upper arc, we have
Z
f (x, y)dxdy = Ku (b) − Ku (a) + K(c) − K(d)
A
a b
c d
xc,yc
x0 x1
21
2.3 Summation over discrete domains
Let us now treat the discrete case. In this section we are interested in discrete
domains which can be written as S = {1, ..., 2n } × {1, ..., 2n }. A dyadic square
in S is a subset {2j k + 1, . . . , 2j (k + 1)} × {2j m + 1, . . . , 2j (m + 1)} ⊂ S,
with 0 ≤ j ≤ n and 0 ≤ m, k ≤ 2n−j − 1. Our aim is the discretization of
the summation trick, and its application to arc splits of dyadic squares. The first
problem that arises is the definition is the proper definition of digital circles and
arcs.
• To run through a digital arc, given starting and ending point on a digital
circle. An effective solution for this is needed for the computation of the
lookuptables containing cumulative sums, but also for painting arclet ap-
proximations.
• Given a center point and a dyadic square q, finding maximum and minimum
radius of circles that intersect q.
• Determining the intersection points between arc and dyadic square. This is
needed in particular to determine which entries of the lookuptables must be
used for the computation of local approximation errors.
22
2.3.1 Algorithm to Traverse a Circle
Here we address the problem of drawing a digital circle on the integer x-y grid.
The algorithm has to traverse along a digital circle, between any two points lying
on the circle. Given a pixel on the circle, the next pixel (xnext , ynext ) is found by
solving the minimum residual problem [11], i.e., by finding the next lattice point
that minimizes | (x − x2c ) + (y − yc )2 − r2 |. There will be only two choices
close to the lattice point (x, y) that we have to investigate : 1) lattice point on x
axis which is close to point (x, y) and 2) a lattice point on y axis, upper or below
point (x, y). Since the drawing of a complete circle can be done by the symmetry
property of the circle let us first consider drawing a circle in the first octant, in the
counterclockwise direction. For convenience, we define a notation for the resid-
uals x2 + y 2 − r2 . To the right or left of point (x, y) can be denoted εx , a lattice
point is above or under a point (x, y) can be denoted εy
ε =x2 + y 2 − r2 ,
εx =(x − 1)2 + y 2 − r2 = ε − 2x + 1
εy =x2 + (y + 1)2 − r2 = ε + 2y + 1
εxy =(x − 1)2 + (y + 1)2 − r2 = ε − 2x + 2y + 2
From any given point on the arcs, (x, y) , our arc drawing algorithm should be able
to give the best next point on the digital circle. The next point will be referred to
the one that leads to a minimum residual. Note that drawing an arc in counter-
clockwise in the first octant, the possible choices to go for the next lattice would
possibly be north(N), which change the residual from ε to εy or northwest(NW),
which changes from ε to εxy
x,y ← r,0
while y < x do
plot(x,y)
if −εxy < εy then
x←x−1
else y ← y + 1
23
A B C D
єy
є x,y
єx є
Figure 2.2: Nomenclature for residuals for various steps in the first octant with
representative arcs. The point marked ² is the current point. Residuals with respect
to a given circle are negative at points inside,positive at points outside.
From figure 2.2, if εxy ≥ 0 (the northwest neighbor lies outside the arc as
with arc A), then εy > 0. Thus −εxy ≤ 0 < εy , so the NW step will be taken.
Similarly, if εxy < 0 and εy ≤ 0 (arc D), then −εxy > 0 ≥ εy . The N step will be
taken. Finally, if εxy < 0 and εy > 0 (arc B and C), then −εxy < εy .
The second octant differs from the first octant only in the step, in this case we
consider the west(W) and northwest(NW) lattice point. If we calculate ε incre-
mentally and substitute from (2.2) the notation can be generalized the definition
for the residuals
ε = x2 + y 2 − r 2 ,
εx =(x + ∆x)2 + y 2 − r2 = ε + 2x∆x + 1
εy =x2 + (y + ∆y)2 − r2 = ε + 2y∆y + 1
εxy =(x + ∆x)2 + (y + ∆y)2 − r2 = ε − 2x∆x + 2y∆x + 2
where the step ∆x, ∆y have values±1, chosen appropriately for each quadrant.
The pseudo in first and second quadrant is both equivalent with the sign of every
residual changed.
1.Quadrant 2.Quadrant
if −εxy < εy then if −εxy < εx then
x ← x + ∆x y ← y + ∆y
if εxy < −εx then if εxy < −εy then
y ← y + ∆y x ← x + ∆x
24
Changing the sign of ε , we must adjust all the differences and both ε which
are involved in computing. The detail to draw an approximate arc from (x, y) to
(x1 , y1 ) in the integer case with integer radius r appear in this algorithm
25
Procedure arc(x, y, x1 , y1 , rsq, dir) ∈ Z
begin
procedure Negate ;
begin
ε, ∆x ε, ∆y ε, ∆2 ε ← −ε, −∆x ε, −∆y ε, −∆2 ε;
end
procedure sgn2(a, b ∈ Z) : ;
begin
procedure sgn(a ∈ Z);
begin
if a < 0 then RETURN −1 else if x = 0 then
RETURN 0
else
RETURN 1
end
end
if a 6= 0 then
RETURN sgn(a)
else
RETURN sgn(b)
end
end
initialize ∆x, ∆y, ε, ∆x ε, ∆y ε, ∆2 ε
repeat
plot(x, y);
εx , εy , εxy ← ε + ∆x ε, ε + ∆y ε, ε + ∆x ε + ∆y ε;
if −εxy < εy then
x, ε, ∆x ε ← x + ∆x, ε + ∆x ε, ∆x ε + ∆2 ε;
end
if εxy < −εx then
y, ε, ∆y ε ← y + ∆y, ε + ∆y ε, ∆y ε + ∆2 ε;
end
if x = 0 then
∆y, ∆y ε ← −∆y, −∆y ε + ∆2 ε ;
Negate ;
end
if y = 0 then
∆x, ∆x ε ← −∆x, −∆x ε + ∆2 ε ;
Negate ;
end
until x = x1 and y = y1;
end
26
Notice: When (x1, y1) = (x, y), the algorithm will plot a complete approxi-
mate circle .
Many cases can occur when an arc intersects with a rectangle but at most the
number of intersection points are 8 points. A difficulty in computing the cumu-
lative sums along an arc-shaped is noticed when a pixel curve line intersects the
rectangle with its right or left arc of the circle. Hence, the summation along the arc
will be considered the computation trick into upper and lower half of the circle.
Given any circles with center point(xc , yc ) This reference line (y = yc ) seperates
the circle into upper and lower part. Both 2 points on the leftmost and rightmost
point of circle must belong to either upper part or lower part. We consider both
points into the set points of upper half circle.
27
Procedure CircleSums(: OBJECT)
store the summation of the vertical summation along curve by traversing pixel:
start at (x, y) in which information of the previous pixel on arc be stored
(prevx, prevy ), and sum up by using 2 sources colsum(MakeColSum:Object) and
original image array
local : circlesum : 2D − array ; prevx, prevy ∈ Z; val ∈ R; cx , cy ∈ Z
begin
procedure DotUpper:(x, y ∈ Z);
begin
if x > prevx then
val ← val + colsum[x, y]
else if y > prevy then
val ← original[x, y]
end
circlesum[x, y + 1] ← val;
prevx ← x ; prevy ← y;
end
procedure DotLower:(x, y ∈ Z);
begin
if x > prevx then
val ← val + original[x, y] + colsum[x, upper] − colsum[x, y]
(*sum up columns above point*)
else if y < prevy then
val ← original[x, y]
end
circlesum[y + 1, x] ← val;
prevx ← x ; prevy ← y;
end
end
28
r
a b
We compute the area sum following cumulative vertical array in the upper half
circle to clockwise direction ,on the other hand, compute the area sum following
the vertical sum to counterclockwise for lower half circle. Since the summation
of pixels on a vertical line is implicitly cut off into the consideration of upper
and lower half circle. Summation trick within an arc-shaped in this case must
be treated carefully otherwise it would return an incorrect sum value. Consider
figure ??
Figure 2.4: Show the direction of computation sum of upper half and lower half
Imagine the two pixels on the circumference which are on the same level of
a horizon diameter of Cr (xc , yc ). It is always problematic when such pixels are
in the set of the curve line between of an arc and a rectangle. Once we take
calculation on that point as it in the upper half circle, we would not reuse that
29
Figure 2.5: an example when the problem is at the right or left circle cut the edge.
point again for summation area within the lower part of circle. As our strategy, we
separate and store the data in upper and lower part of circle by shifting a position
in the circle line up one pixel and store information of circle when we work on the
upper part.
30
Procedure FindIntersectingCircle( xc , yc , x, y, w, h ∈ N ; VAR
rmin , rmax ∈ N )
passes minimum and maximum offset rmin ,rmax of circles Cri (xc , yc ) that
intersect rectangle where the left bottom corner is (x, y) and its size (w × h).
local : dist, distmin , distmax ∈ Z
begin lp m
dist ← (xc − x)2 + (yc − y)2 (* left bottom *)
distmax ← dist distmin ← dist
lp m
dist ← (xc − x − w + 1)2 + (yc − y)2 (* right bottom *)
if dist > distmax then distmax ← dist end ;
if dist <
lpdistmax then distmin ← dist end ; m
dist ← (xc − w + 1)2 + (yc − y − h + 1)2 (* left top *)
if dist > distmax then distmax ← dist end ;
if dist <
lpdistmax then distmin ← dist end ; m
dist ← (xc − x − w + 1)2 + (yc − y − h + 1)2 (* right top *)
if dist > distmax then distmax ← dist end ;
if dist < distmax then distmin ← dist end ;
rmax ← distmax ;
if (xc ≥ x) and (xc ≤ x + w) and (yc ≥ y) and (yc ≤ y + h − 1) then
rmin ← 1;
else if (xc ≥ x) and (xc < x + w) then
if yc ≤ y then
rmin ← y − yc
else if (yc ≥ y + h) then
rmin ← yc − y − h + 1
end
else if (yc ≥ y) and(yc < y + h) then
if xc ≤ x then
rmin ← xc − x
else if xc ≥ x + w then
rmin ← xc − x − w + 1
end
else
rmin ← distmin
end
end
end
31
2.3.4 Intersection of arcs with rectangle
In this section, we determine the intersection points of the boundary of a rectan-
gle with a digital circle, if they have any, by using a geometrical approach on x-y
grid. The rectangle is composed of two horizontal lines and two vertical lines.
Therefore the circle-rectangle intersection problem can be decomposed into four
subproblem by finding the intersection points of these lines. The idea is to deter-
mine the distance between the center of the circle and each line.
Consider a single line. Then, if the distance of this line and the center of the
circle is less than the radius, then there will be no intersection, otherwise, there
are at most two intersection points. The location of intersections can be found by
Pythagoras’ Theorem. In other word, let (xc , yc ) be the center point of a circle
Cr ; r be radius and a rectangle R with the size of (w × h) is located a right corner
at position (rx, ry)
The intersection points we obtain from previous paragraph may or may not be
intersecting the circle because so far we considered infinite horizontal and vertical
32
lines. Before further progress, we need to determine those intersection points that
are in the range of rectangle boundary. But this is decided by a simple comparison
of coordinates with the corners of the rectangle.
The next problem consists in deciding if the intersection points contain a cor-
ner point of the rectangle. Under some conditions we will not allow the corner
as an intersection point. We have to consider if the particular corner point is ac-
ceptable. A corner point is acceptable if one of its neighbours on the arc is in the
inside of the rectangle. There are 4 cases that can tell us to admit the point by
consideration of the center point (xc , yc ) position within these regions.
(xc,yc)
(xc,yc)
(a) (b)
Figure 2.6: From case (1) show 2 possible examples (cutting edge by arc ), (b)
we accept a corner point as the intersection, (a) this corner point will not be taken
into account.
1. If the point(x, y) is a bottom left corner, we will accept the point only if the
center point is not in these conditions
a1. (xc > x) and (yc > y) : Region 2 without boundary.
b1. (xc ≤ x) and (yc ≤ y) : Region 4 including boundary.
2. If the point is a bottom right corner, we will accept the point only if the
center point is not in these conditions
a2. (xc < x) and (yc > y) : Region 1 without boundary.
b2. (xc ≥ x) and (yc ≤ y) : Region 3 including boundary.
3. If the point is a upper left corner, we will accept the point only if the center
point is not in these conditions
33
1 2 1 2
4 3 4 3
1 2
1 2
4 3
4 3
Figure 2.7: a rectangle and show the 4 regions (1,2,3,4 for all respective corners.)
4. If the point is a upper right corner, we will accept the point only if the center
point is not in these conditions
34
Procedure RectCircleIntersect(rx , ry , rw , rh , cx , cy , cr ∈ Z;
VARq : pointQueue : RECORD)
Intersections are passed in (x1 , y1 ) and (x2 , y2 ). Then store the set of intersection
points in p:pointQueue:RECORD
local : x1 , y1 , x2 , y2 ∈ R
begin
P ointQueue 6= N IL
--- Left Edge ---
if (rx , cx , cy , cr , x1 , y1 , x2 , y2 ) then
if (ry ≤ y1 ≤ ry + rh − 1) and CheckCorner(x1 , y1 ) then
CompareAndInsert(q, cx , cy , x1 , y1 )
if (ry ≤ y2 ≤ ry + rh − 1) and CheckCorner(x2 , y2 ) then
CompareAndInsert(q, cx , cy , x2 , y2 )
--- Right Edge ---
if (rx + rw − 1, cx , cy , cr , x1 , y1 , x2 , y2 ) then
if (ry ≤ y1 ≤ ry + rh − 1) and CheckCorner(x1 , y1 ) then
CompareAndInsert(q, cx , cy , x1 , y1 )
if (ry ≤ y2 ≤ ry + rh − 1) and CheckCorner(x2 , y2 ) then
CompareAndInsert(q, cx , cy , x2 , y2 )
---Bottom Edge ---
if (ry , cx , cy , cr , x1 , y1 , x2 , y2 ) then
if (rx ≤ x1 ≤ rx + rw − 1) and CheckCorner(x1 , y1 ) then
CompareAndInsert(q, cx , cy , x1 , y1 )
if (rx ≤ x2 ≤ rx + rw − 1) and CheckCorner(x2 , y2 ) then
CompareAndInsert(q, cx , cy , x2 , y2 )
---Top Edge ---
if (ry + rh − 1, cx , cy , cr , x1 , y1 , x2 , y2 ) then
if (rx ≤ x1 ≤ rx + rw − 1) and CheckCorner(x1 , y1 ) then
CompareAndInsert(q, cx , cy , x1 , y1 )
if (rx ≤ x2 ≤ rx + rw − 1) and CheckCorner(x2 , y2 ) then
CompareAndInsert(q, cx , cy , x2 , y2 )
36
Procedure CompareAndInsert(q : RECORD; cx, cy ∈ Z;x, y ∈ R)
Get the points and call the Procedure(IsBeforeOnCircle) ⇐ BOOLEAN value will
be returned whether which point is the former and the latter.
begin
p ← q.head while p is not empty and
IsBeforeOnCircle(x1, y1, x2, y2) do get the next point
if (p is not empty)AND (p.xr = x)AND(p.yr = y) then return
new, p;
end
37
We have all the intersections of each dyadic then we can draw the rectangle
and the arc with corresponding to the intersection points
38
For each case of geometrical shape piece uses individual pseudo code e.g Pro-
cedure(RectContent), Procedure(UpperQContent), Procedure(LowerQContent) for
calculating the summation and number of pixels.
Above pseudo code collects and passes all information that we need for the
approximation step. We use the summation trick to calculate the squared error in
each pieces in dyadic square. The minimum sum square error is the key value to
get the best arc.
39
Procedure LowerArcContent(plef t , pright : P oint : Record ∈ Z2 ;
upy ∈ Z)
Returns sums of values within the arc content in lower part of circle in rectangle
defined by left and right points ,(pl.x, pl.y ) and(pr.x, pr.y
local : lef tx , lef ty , rightx , righty , lowy ∈ Z ;sum ∈ R
begin
lef tx ← pl.x ; lef ty ← pl.y ; rightx ← pr.y;
lowy ← (lef ty , righty ) − 1 ;
sum ← circlesum[righty , rightx ] − circlesum[lef ty, lef tx] +
colsum[upper, lef tx ] − colsum[lef ty , lef tx ] + original[lef ty , lef tx ];
return sum − (lef tx , upy + 1, rightx , upper)
end
40
Procedure UpperQContent(q : P ointQueue; rx , ry , rw , rh ∈ Z;
omitLowestLine : BOOLEAN )
Returns sums of values within the rectangle (rx , ry , rw , rh ) for upper content
local : p1 , p2 ∈ P oint : RECORD[x, y, nextx, nexty];
ml , mr ∈ Z;sum ∈ R
begin
ml ← rx ; mr ← rx + rw − 1; p1 ← q.head;
if p1 is NIL then return ;
p2 ← p1 .next
if (p2 .y = ry + rh − 1) and (p2 .x 6= rx + rw − 1) then
ml ← p2 .next;
sum ← UpperArcContent(p1 , p2 , ry , omitLowestLine);
p1 ← p2 .next (*further intersection*)
if p1 6= N IL then
p2 ← p1 .next; mr ← p1 .x − 1;
sum ← sum + UpperArcContent(p1 , p2 , ry , omitLowestLine)
end
if omitLowestLine then
sum ← sum + (ml, ry + 1, mr , ry + rh − 1)
else
sum ← sum + (ml , ry , mr , ry + rh − 1)
end
else if (p1 .yy + rh − 1) or (p1 .x = rx ) then
mr ← p1 .x − 1;
if omitLowestLine then
sum ← (ml , ry + 1, mr , ry + rh − 1);
else
sum ← (ml , ry , mr , ry + rh − 1)
end
sum ← sum + UpperArcContent(p1 , p2 , ry , omitLowestLine)
else
sum ← UpperArcContent(p1 , p2 , ry , omitLowestLine)
end
end return sum
end
41
Procedure LowerQContent(q : P ointQueue; rx , ry , rw , rh ∈ Z)
Returns sums of values within the rectangle (rx , ry , rw , rh ) for lower content
local : p1 , p2 ∈ P oint : RECORD[x, y, nextx, nexty]; ml , mr ∈ Z;
sum ∈ R
begin
ml ← rx ; mr ← rx + rw − 1; p1 ← q.head;
if p1 is NIL then return ;
p2 ← p1 .next
if (p2 .y = ry + rh − 1) and (p2 .x 6= rx + rw − 1) then
mr ← p2 .x − 1;
sum ← LowerArcContent(p2 , p1 , ry + rh − 1); p1 ← p2 .next
(*further intersection*)
if p1 6= N IL then
p2 ← p1 .next; ml ← p1 .x + 1;
sum ← sum + LowerArcContent(p2 , p1 , ry + rh − 1)
end
end ;
sum ← sum + (ml , ry , mr , ry + rh − 1) else if (p1 .y = ry + rh − 1) or
(p1 .x = rx +rw − 1)then
ml ← p1 .x + 1;
sum ←
LowerArcContent(p2 , p1 , ry + rh − 1 + (ml , ry , mr , ry + rh − 1)
else
sum ← LowerArcContent(p2 , p1 , ry + rh − 1)
end
end return sum
end
42
Procedure CircleRectValues(VAR rx , ry , rw , rh , cx , cy ∈ Z; VAR
Sm, s ∈ R; VAR p ∈ Z);
Passes mean sum and sum of squares s,p in arc partition on dyadic rx , ry , rw , rh .
global : Summation matrices RY (data), RS (squared data) and RP
(points)
local : yu p, hu p, ylow , hlow ∈ Z ; q : P ointQueue : RECORD ∈ Z;
low, up :BOOLEAN
begin
Split(ry , rh , cy , ylow , hlow , yu p, hu p);
if low then
RectCircleIntersect(rx , ylow , rw , hlow , cx , cy , i, q);
ReoderForLower(cx , cy , i, q);
Sm ← Sm + LowerQContent(q, rx , ylow , rw , hlow , RY );
s ← s + LowerQContent(q, rx , ylow , rw , hlow , RS );
p ← p + LowerQContent(q, rx , ylow , rw , hlow , RP );
else if RectInCircle(rx , ylow , rw , hlow , cx , cy , i) then
Sm ← Sm+RectContent(rx , ylow , rx +rw −1, ylow +hlow −1, RY );
s ← s + RectContent(rx , ylow , rx + rw − 1, ylow + hlow − 1, RS );
p ← p + RectContent(rx , ylow , rx + rw − 1, ylow + hlow − 1), RP ;
end
if up then
RectCircleIntersect(rx , yup , rw , hup , cx , cy , i, q);
Sm ← Sm + U pperQContent(q, rx , yup , rw , hup , low, RY );
s ← s + U pperQContent(q, rx , yup , rw , hup , low, RS );
p ← p + U pperQContent(q, rx , yup , rw , hup , low, RP );
else if RectInCircle(rx , yup , rw , hup , cx , cy , i) then
if low then
Sm ← Sm+RectContent(rx , yup +1, rx +rw −1, yup +hup −1, RY );
s ← s + RectContent(rx , yup + 1, rx + rw − 1, yup + hup − 1, RS );
p ← p + RectContent(rx , yup + 1, rx + rw − 1, yup + hup − 1, RP );
else
Sm ←
Sm + RectContent(rx , yup + 1, rx + rw − 1, yup + hup − 1, RY );
s ← s+RectContent(rx , yup +1, rx +rw −1, yup +hup −1), RS ;
p ← p+RectContent(rx , yup +1, rx +rw −1, yup +hup −1, RP );
end
end
end
43
Procedure FindBestRadius(rx , ry , rw , rh ∈ Z; VAR r ∈ Z; VAR
µ1 , µ2 , ssq ∈ R)
Passes radius parameter r, means µ1 and µ2 of arcs with radius(r) in rectangle
rx , ry , rw , rh with minimal sum of squares ssq
global : Summation matrices C Y , RY , W Y (data), C S , RS , W S (squared
data) and C P , RP , W P (points)
local : m1 , m2 , m3 , s1 , s2 , s3 , p1 , p2 , p3 , s ∈ R; i, rmin , rmax ∈ Z
begin
min ← ∞
FindIntersectingCircle(cx , cy , rx , ry , rw , rh , rmin , rmax );
m3 ← RectContent(rx , ry , rx + rw − 1, ry + rh − 1, RY );
s3 ← RectContent(rx , ry , rx + rw − 1, ry + rh − 1, RS );
p3 ← RectContent(rx , ry , rx + rw − 1, ry + rh − 1, RP );
for i ← rmin to rmax do
CircleRectValues(rx , ry , rw , rh , rmin , rmax );
s2 ← s3 − s1 ; m2 ← m3 − m1 ; p2 ← p3 − p1 ;
if p1 > 0 then s1 ← s1 − m21 /p1 end ;
if p2 > 0 then s2 ← s2 − m22 /p2 end ;
if s1 + s2 < s then
s ← s1 + s2 ; r ← i; µ1 ← m1 /p1 ; µ2 ← m2 /p2 ;
end
end
end
44
Chapter 3
In this Chapter we illustrate the methods and algortihms described in the previous
chapters with some simulation results. These results are performed with the code
which we have implemented in Oberon. This implementation relies on the algo-
rithm described in Section .
45
Figure 3.1: Arclet Segmentation with Oberon/Voyager/Ants on Windows
46
Panel
2. Noise : white gaussian noise can be added to the image. The user can set
the variance of this noise.
3. New Tree : create a new tree for the size of the image. This tree contains a
(still) empty quadtree structure and will be used in each further step,
47
4. Rect Model : Plug-in rectangle model. This model contains the best constant
approximation in each rectangle of the quadtree.
6. Arclet : Plug-in arc model in order to do arc segmentation and find the best
arc approximation. Input are the coordinate of center points of circles (a
start x,y cordinate and an end x,y with the step size control in both x and y
direction. This model contains the best constant approximation over an arc
split of a rectangle, for each rectangle.
7. Scroll bar ’Logγ’ : control a number of pieces and resolution of the image
or user can insert a value in the blank box then press enter to pass the pa-
rameter value. For each γ, the optimal solution is performed, by selecting
the leaves of the tree, according to the score comparison.
8. Show array/ tree/ both(array and tree) : graphic display of the reconstructed
image (and/or) according wedge/arc/quadtree.
In order to measure the quality of our approximation images we used the stan-
dard Peak to Signal Noise Ratio(PSNR), with the measured result in Decibel dB.
It is a logarithmic scaling of the normalized inverse of the mean square error. Let
us consider an original digital image y of size w × h, with quantized gray levels
in a range y ∈ [0, d − 1]. Typically we deal with grey value depth d = 256. We
want to measure the error between this image and any reconstructed image ŷ. In
this context, the PSNR is given by
d2
P SN R(y, ŷ) = 10 ∗ log10 ( )
M SE
where MSE denotes the Mean Square Error
ky − ŷk22 X 1
M SE = = |y(p) − ŷ(p)|2 ·
w∗h p∈Ω
w∗h
where Ω denotes the set of pixels and y(p) is the grey value at the pixel p.
Despite some disadvantages (PSNR does not exactly, it is sensible to noise),
the PSNR provides a straightforward and relatively robust measure for comparing
image reconstruction qualities. Furthermore it corresponds to an error measure
48
in the l2 setting, which seems convenient, since our functional minimization also
relies on l2 -error. Although it depends on the contents of the image (presence of
textures, noise, pure geometrical features), one can say that a high PSNR values
(typically higher than 35 dB) correspond to a very good reconstruction quality
for most natural images. In contrast, one can say that low PSNR values(typically
below 25 dB) correspond to very coarse representations, where only a few signif-
icant features are still recognisable. Increasing PSNR corresponds to increasing
quality.
On the following we present some comparison results of our approximation
schemes (wedgelets, arclets). In each plotted rate-distortion curve, we represented
the PSNR versus number of pieces required by the model. Thus the x-axis corre-
sponds the number of pieces and the the y-axis to the PSNR values.
Figure 3.3: Example the various psnr values on image ’bird’ (left) PSNR = 25 ,
(middle) PSNR=30, (right) PSNR=40
49
Image ’Bird’, 256 x 256. PSNR against number of segments.
27
26
25
PSNR
24 Dyadic+Wedgelet
Dyadic+Wedgelet+Arclet
23
22
21
20
0 50 100 150 200
Number of pieces
Figure 3.4: Plot for image ’bird’ : PSNR against number of segments for a wedge
model (red) and combination of wedge and arclet model(blue)
50
Image ’Circles’, 256 x 256. PSNR against number of segments.
140
120
Dyadic+Wedgelet
Dyadic+Wedgelet+Arclet
100
80
PSNR
60
40
20
0
0 100 200 300 400 500 600
Number of pieces
Figure 3.5: Plot for image ’circles’ : PSNR against number of segments for a
wedge model (red) and combination of wedge and arclet model(blue)
24.5 Dyadic+Wedgelet
Dyadic+Wedgelet+Arclet
24
23.5
23
PSNR
22.5
22
21.5
21
20.5
20
100 200 300 400 500 600 700 800
Number of pieces
Figure 3.6: Plot for image ’peppers’ : PSNR against number of segments for a
wedge model (red) and combination of wedge and arclet model(blue)
51
Image ’Splash’, 256 x 256. PSNR against numbet of segments.
27
26
25
Dyadic+Wedgelet
Dyadic+Wedgelet+Arclet
24
PSNR
23
22
21
20
0 100 200 300 400 500
Number of pieces
Figure 3.7: Plot for image ’splash’ : PSNR against number of segments for a
wedge model (red) and combination of wedge and arclet model(blue)
22.5
22
PSNR
21.5
Dyadic+Wedgelet
21 Dyadic+Wedgelet+Arclet
20.5
20
0 500 1000 1500
Number of pieces
Figure 3.8: Plot for image ’Obelix’ : PSNR against number of segments for a
wedge model (red) and combination of wedge and arclet model(blue)
52
Image ’Camera’, 256 x 256. PSNR against number of segments.
24
23.5
23
22.5
PSNR
22
21.5 Dyadic+Wedgelet
Dyadic+Wedgelet+Arclet
21
20.5
20
0 100 200 300 400 500 600
Number of pieces
Figure 3.9: Plot for image ’camera’ : PSNR against number of segments for a
wedge model (red) and combination of wedge and arclet model(blue)
23.5
23
22.5
PSNR
Dyadic+Wedgelet
22
Dyadic+Wedgelet+Arclet
21.5
21
20.5
20
0 100 200 300 400 500 600
Number of pieces
Figure 3.10: Plot for image ’barbara’ : PSNR against number of segments for a
wedge model (red) and combination of wedge and arclet model(blue)
53
We observe PSNR from arclet scheme for over all images is approximately
increased +0.1 to +0.3 when compare to PSNR of wedgelet scheme. Totally, the
efficiency is small for image ’barbara’ than for image ’camera. This is due to the
qualitative of ratios influence for the image contents. Image’ barbara’ contains
much more texture, for while we can not expect to do much better by further of
the geometrical scheme.
54
Figure 3.11: Image ’bird’, 256 x 256. segmentation with a dyadic square model,
wedge model(180 angles) and arc model (32 possible center points of circles.γ =
0.01
55
Figure 3.12: Image ’circles’, 256 x 256. segmentation with a dyadic square model,
wedge model(180 angles) and arc model (32 possible center points of circles.
γ = 0.001
56
Figure 3.13: Image ’camera’, 256 x 256. segmentation with a dyadic square
model, wedge model(180 angles) and arc model (32 possible center points of
circles. γ = 0.01
57
Figure 3.14: Image ’obelix’, 256 x 256. segmentation with a dyadic square model,
wedge model(180 angles) and arc model (32 possible center points of circles.
γ = 0.01
58
Figure 3.15: Image ’peppers’, 256 x 256. segmentation with a dyadic square
model, wedge model(180 angles) and arc model (32 possible center points of
circles. γ = 0.01
59
Figure 3.16: Image ’splash’, 256 x 256. segmentation with a dyadic square model,
wedge model(180 angles) and arc model (32 possible center points of circles.
γ = 0.01
60
Figure 3.17: Image ’barbara’, 256 x 256. segmentation with a dyadic square
model, wedge model(180 angles) and arc model (32 possible center points of
circles. γ = 0.01
61
The performance of arclet scheme can improve PSNR values when compare
with the wedgelet scheme. We observe, however that the improvement of the
PSNR values is not a large as we could expect. We may give some possible
explanations to this phenomenon.
• Natural images contain not only a single arc line, but mostly arcs in the
image having width itself, a thick curve. The arclet decomposition attempts
to do more partitions to find the optimal arcs.
Dyadic+Wedgelet
32 Dyadic+Wedgelet+Arclet
Dyadic+Wedgelet+Ringlet
30
PSNR
28
26
24
22
0 200 400 600 800 1000
Number of pieces
Figure 3.18: the plot shows the improvement of PSNR values with ’ringlet’
scheme.
The improvement of distortion rates with ringlet scheme can be observed with
up to +0.5 Db. which is satsfied.
62
Figure 3.19: Image ’bird’, 256 x 256. segmentation with a dyadic square model,
wedge model and ringlet model
63
Figure 3.20: Image ’splash’, 256 x 256. segmentation with a dyadic square model,
wedge model and ringlet model
64
Appendix: Original Images
65
Figure A.2: 256 x 256 Bird
66
Figure A.4: 256 x 256 Circles
67
Figure A.5: 256 x 256 Obelix
68
Figure A.6: 256 x 256 Peppers
69
Bibliography
[1] G. Casella and C.P. Robert, Monte Carlos Statistical Methods, Springer
Texts in Statistics, Springer-Verlag, 1999.
[2] L. Demaret, F.Friedrich and H.Fuehr, A Quick guide to wedgelets, GSF Re-
search Center for Environment and Health, January 28,2005.
70
[13] G. Sawitzki, Extensibible Statiscal Software: On a Voyager to Oberon,
J.Computational and Graphical Statist, 5(3):263-283, 1996.
[15] L.N. Trefethen and D.Bau., Numerical Linear algebra, SIAM, Philadephia,
Pennsylvania,1997.
[16] Katrin Wicker, Diploma thesis : Das Potts-Modell zur segmentation ver-
rauschter Daten, Munich University of Technology, 2004
[17] R.M. Willett and R.D. Nowak, Platelets: a multiscal approach for recover-
ing edges and surfaces in photon-limited medical imaging, IEEE Transac-
tions on Medical Imaging, 22:332-350, 2003.
[18] G. Winkler, Image Analysis, Random Fields and Markov Chain Monte Carlo
Methods,Applications of Mathematics; Vol.27, 2nd Edition,Springer,2002.
71
Abstract
This thesis is concerned with efficient algorithms for the segmentation of images
using so-called ”arclets”, a geometry-based approach. Arclets are an extension
of quadtree approximation allowing to include curved edges. We design fast and
flexible algorithms to compute arclet approximations of digital images.
Arclet approximation relies on quadtree structure. A criterion for the choice
of segmentations is given by minimization of a complexity penalised functional
over dyadic arclet partitions. Due to the structure of the functional, this problem
can be reduced to the computation of local approximation errors. We develop new
algorithms for the efficient computation of the local approximation errors.