# Tangent Estimation of 3D Digital Curves

Kacper Pluta, Technion – Israel Institute of Technology, Center for Graphics and Geometric Computing

Technion 04/11/2018

Y. Kenmochi

CNRS, France

a joint work with

J.-O. Lachaud

University of Savoy, France

## Digital Geometry

A classical problem of digital geometry is to estimate geometric properties of digitized shapes without any knowledge about the underlying continuous shape.

## Digital Geometry

Definition (Multigrid Discrete Space)

Let

h > 0
$h > 0$
Figure comes from R. Klette & A. Rosenfeld: Digital Geometry: Geometrical Mehods For Digital Picture Analysis, Morgan Kaufmann 2004

be a grid resolution and

\mathbb{Z}_h = \left\{\frac{i}{h}| i \in \mathbb{Z}\right\}
$\mathbb{Z}_h = \left\{\frac{i}{h}| i \in \mathbb{Z}\right\}$

, then

\mathbb{Z}^n_h
$\mathbb{Z}^n_h$

is the

set of n-D discrete points in a grid of the resolution h.

## Digital Geometry in Image Processing Pipeline

The information about the tangent orientation at the integer points of the skeleton allows for local measurements.

## Methods for Tangent Estimating

Approximation techniques in the Euclidean space

Methods which work directly in discrete spaces

+ very good accuracy

- can be costly

- poor behavior on sharp corners

+ good accuracy

+ simple and fast

- often poor behavior on corrupted/noisy curves

Some methods fix size of the computational window globally. Therefore, they cannot adapt to local geometry of the shape.

\mathbf{x}_0
$\mathbf{x}_0$
\mathbf{x}_1
$\mathbf{x}_1$

Some methods fix size of the computational window globally. Change of the resolution involves change of the window size.

\mathbf{x}_0
$\mathbf{x}_0$
\mathbf{x}_1
$\mathbf{x}_1$

The size of the computational window can be adopted to the local curve's geometry thanks to the notion of Digital Straight Segments.

# What is a curve in    ?

\mathbb{Z}^3
$\mathbb{Z}^3$

## Digital Curves

3D Digital Curve

Any set

\mathbf{C}
$\mathbf{C}$

such that

|\mathbf{C}| \geq 2
$|\mathbf{C}| \geq 2$

is called a 3D digital k-curve iff there

\mathbf{p},\mathbf{q} \in \mathbf{C}
$\mathbf{p},\mathbf{q} \in \mathbf{C}$

such that

|\Gamma_k(\mathbf{p}) \cap \mathbf{C}| = |\Gamma_k(\mathbf{q}) \cap \mathbf{C}| = 2
$|\Gamma_k(\mathbf{p}) \cap \mathbf{C}| = |\Gamma_k(\mathbf{q}) \cap \mathbf{C}| = 2$

and for any

\mathbf{x} \in \mathbf{C} \setminus \{\mathbf{p}, \mathbf{q}\},
$\mathbf{x} \in \mathbf{C} \setminus \{\mathbf{p}, \mathbf{q}\},$

we have

|\Gamma_k(\mathbf{x}) \cap \mathbf{C}| = 3 .
$|\Gamma_k(\mathbf{x}) \cap \mathbf{C}| = 3 .$

are possibly two points

Given a point

\mathbf{x} \in \mathbb{Z}^3,
$\mathbf{x} \in \mathbb{Z}^3,$

\mathbf{x}
$\mathbf{x}$

is defined as:

\Gamma_k(\mathbf{x}) = \{\mathbf{y} | d^2(\mathbf{x},\mathbf{y}) \leq n \} \setminus \{\mathbf{x}\},
$\Gamma_k(\mathbf{x}) = \{\mathbf{y} | d^2(\mathbf{x},\mathbf{y}) \leq n \} \setminus \{\mathbf{x}\},$

where

d
$d$

stands for the Euclidean distance function and k for an

adjacency relation i.e., 6 (face), 18 (edge), 26 (vertex).

## Digital Curves

A digital 26-curve i.e.,

n \leq 3
$n \leq 3$

## The Tangent Estimation Algorithm, In Short

• Decompose the digital k-curve into digital k-line segments. Then, such line segments approximate the tangent directions at their points

• For each point of the curve estimate a discrete tangent as a weighted sum of the directions given by the the k-line segments passing through the point

# The Building Blocks

## Arithmetic Digital Line

An arithmetic line of parameters

2D Arithmetic Line

(a, b, c)
$(a, b, c)$

and of arithmetic thickness

\omega
$\omega$

is defined as

D(a, b, c, \omega) = \{ (p, q) \in \mathbb{Z}^2 | c \leq a p - b q < c + \omega \}
$D(a, b, c, \omega) = \{ (p, q) \in \mathbb{Z}^2 | c \leq a p - b q < c + \omega \}$

where

a, b, c, \omega \in \mathbb{Z}
$a, b, c, \omega \in \mathbb{Z}$

and

\gcd(a, b) = 1.
$\gcd(a, b) = 1.$
\omega
$\omega$

Theorem [Reveillès 1991]

D(a, b, c, \omega)
$D(a, b, c, \omega)$

Let

be an arithmetic line, then:

1. If

\omega < \max(|a|, |b|)
$\omega < \max(|a|, |b|)$

then

D(a, b, c, \omega)
$D(a, b, c, \omega)$

is not connected,

2. If

\omega = \max(|a|, |b|)
$\omega = \max(|a|, |b|)$

then

D(a, b, c, \omega)
$D(a, b, c, \omega)$

is 8-connected,

3. If

\omega = |a| + |b|
$\omega = |a| + |b|$

then

D(a, b, c, \omega)
$D(a, b, c, \omega)$

is 4-connected.

1.

2.

3.

## Arithmetic Digital Line

Definition (Remainder)

## Remainder and Leaning Point

The remainder associated to a point

\mathbf{p} = (p_1, p_2)
$\mathbf{p} = (p_1, p_2)$

of

D(a, b, c, \omega)
$D(a, b, c, \omega)$

is an

integer value defined as

r(\mathbf{p}) = a p_1 - b p_2.
$r(\mathbf{p}) = a p_1 - b p_2.$
• When
r(\mathbf{p}) = c
$r(\mathbf{p}) = c$

then

\mathbf{p}
$\mathbf{p}$

is called a

lower leaning point

• When
r(\mathbf{p}) = c + \omega - 1
$r(\mathbf{p}) = c + \omega - 1$

then

\mathbf{p}
$\mathbf{p}$

called an upper leaning point

is

## Arithmetic Digital Line Recognition

Let

• M(i, j) be a segment of a digital 8-line
D(a, b, c, \omega)
$D(a, b, c, \omega)$

with

0 \leq a < b,
$0 \leq a < b,$
•                    be the point of the greatest abscissa of M,
\mathbf{q} = (q_1, q_2)
$\mathbf{q} = (q_1, q_2)$
• l and l' be the lower leaning points of minimum and maximum abscissae of M,
• u and u' be the upper leaning points of minimum and maximum abscissae of M,

\mathbf{p} = (p_1, p_2)
$\mathbf{p} = (p_1, p_2)$

connected to M such that

p_1 = q_1 + 1
$p_1 = q_1 + 1$

we verify if

M' = M \cup \{\mathbf{p}\}
$M' = M \cup \{\mathbf{p}\}$

is an 8-conneted line segment.

## Arithmetic Digital Line Recognition

Theorem [Debled-Rennesson and Reveillès, 1995]

We have

1. if

c \leq r(\mathbf{p}) < b
$c \leq r(\mathbf{p}) < b$

then M' is an 8-connected line segment

2. if

r(\mathbf{p}) < c - 1
$r(\mathbf{p}) < c - 1$
D(a, b, c, \omega)
$D(a, b, c, \omega)$

or

r(\mathbf{p}) > b
$r(\mathbf{p}) > b$

then M' is not 8-connected

3. if

r(\mathbf{p}) = c - 1
$r(\mathbf{p}) = c - 1$

then M' is an 8-connected line segment

D(p_2 - u_2, p_1 - u_1, -a p_1 + b p_2, \omega)
$D(p_2 - u_2, p_1 - u_1, -a p_1 + b p_2, \omega)$

4. if

r(\mathbf{p}) = b
$r(\mathbf{p}) = b$

then M' is an 8-connected line

D(p_2 - l_2, p_1 - l_1, -a p_1 + b p_2 + b - 1, \omega)
$D(p_2 - l_2, p_1 - l_1, -a p_1 + b p_2 + b - 1, \omega)$

1.

4.

## Arithmetic Digital Line Recognition

It is then possible to decompose a sequence of k-connected points into digital k-connected line segments.

\mathit{M}_1(0, 18)
$\mathit{M}_1(0, 18)$
\mathit{M}_2(18, 29)
$\mathit{M}_2(18, 29)$
\mathit{M}_3(29, 42)
$\mathit{M}_3(29, 42)$
\mathit{M}_4(42, 60)
$\mathit{M}_4(42, 60)$
\mathbf{C}(0,60)
$\mathbf{C}(0,60)$

a 8-connected digital curve i.e., a sequence of points from 0 to 60.

Figure comes from I. Debled-Rennesson: Reconnaissance des droites et plans discrets, PhD Thesis 1995

## Arithmetic Digital Line Recognition

\mathit{M}_1(0, 18)
$\mathit{M}_1(0, 18)$
\mathit{M}_2(18, 29)
$\mathit{M}_2(18, 29)$
\mathit{M}_3(29, 42)
$\mathit{M}_3(29, 42)$
\mathit{M}_4(42, 60)
$\mathit{M}_4(42, 60)$
Figure comes from I. Debled-Rennesson: Reconnaissance des droites et plans discrets, PhD Thesis 1995

Over the years several discrete tangent estimators based on a digital line recognition has been proposed.

They all try to make the right balance between the longest and the most centered DSS around a point of interest.

Figure comes from I. Debled-Rennesson: Reconnaissance des droites et plans discrets, PhD Thesis 1995

## Curve Functionality

A set C of 3D integer points is functional along an axis (say x) if the points of C can be sorted such that the x-component increase by one between two consecutive points.

The projections             and             have the same cardinal as C i.e.,
these projections are bijective.

\pi_{xy}(\mathbf{C})
$\pi_{xy}(\mathbf{C})$
\pi_{zx}(\mathbf{C})
$\pi_{zx}(\mathbf{C})$

Definition

Proposition

## Curve Functionality

\pi_{xy}(\mathbf{C})
$\pi_{xy}(\mathbf{C})$
\pi_{zx}(\mathbf{C})
$\pi_{zx}(\mathbf{C})$

## Curve Functionality

From now on we consider a 3D 26-connected curve
C, which is functional.

Any 26-connected 3D digital curve can be decomposed into functional parts of size at least two with an overlap of at least one point.

## 3D k-digital Line Segment

In the 3D case, M(i, j) is verified iff two of the three projections of C

on the planes

O_{xy}, O_{xz}
$O_{xy}, O_{xz}$

and

O_{yz}
$O_{yz}$

are 2D digital line segments.

M is 26-connected iff the two valid projections are 8-connected.

\pi_{xy}(\mathbf{C})
$\pi_{xy}(\mathbf{C})$
\pi_{zx}(\mathbf{C})
$\pi_{zx}(\mathbf{C})$

## 3D Maximal Line Segments

A digital line segment M is maximal if it cannot be extended anymore from any end.

Definition

Let M be a 3D maximal segment along C. Then there exists one 2D maximal DSS along             and a 2D maximal DSS along             such that M is the intersection of their back projection onto C.

\pi_{xy}(\mathbf{C})
$\pi_{xy}(\mathbf{C})$
\pi_{zx}(\mathbf{C})
$\pi_{zx}(\mathbf{C})$

Proposition

# Tangent Estimation Algorithm

## The Tangent Estimation Algorithm, In Short

• Decompose the digital k-curve into maximal k-line segments. Then, such line segments approximate the tangent directions at their points

• For each point of the curve estimate a discrete tangent as a weighted sum of the directions given by the the k-line segments passing through the point

## Tangential Cover

For any digital curve C, there is a unique set

\mathcal{M}
$\mathcal{M}$

segments called the tangential cover [Feschet and Tougne 1999].

of maximal

## Tangential Cover

The set of maximal segments going through a point

\mathbf{x} \in \mathbf{C}
$\mathbf{x} \in \mathbf{C}$

is called

the pencil of maximal segments at

\mathbf{x}
$\mathbf{x}$

and defined as

P(\mathbf{x}) = \{ M_i \in \mathcal{M} | \mathbf{x} \in M_i \}.
$P(\mathbf{x}) = \{ M_i \in \mathcal{M} | \mathbf{x} \in M_i \}.$

## Eccentricity

The eccentricity

\mathbf{x}
$\mathbf{x}$
M_i
$M_i$
L_i
$L_i$
m_i
$m_i$
e_i(\mathbf{x})
$e_i(\mathbf{x})$

of a point

\mathbf{x}
$\mathbf{x}$

with respect to a maximal

segment

M_i
$M_i$

is the relative position between the extremities of

M_i
$M_i$

such that

e_i(\mathbf{x}) = \begin{cases} \| \mathbf{x} - m_i \|_1 & \quad \text{if } M_i \in P(\mathbf{x}),\\ 0 & \quad \text{otherwise.} \end{cases}
$e_i(\mathbf{x}) = \begin{cases} \| \mathbf{x} - m_i \|_1 & \quad \text{if } M_i \in P(\mathbf{x}),\\ 0 & \quad \text{otherwise.} \end{cases}$
\lambda
$\lambda$

## Estimator

The

\lambda
$\lambda$

direction

\mathbf{t}(\mathbf{x})
$\mathbf{t}(\mathbf{x})$

at the point

\mathbf{x}
$\mathbf{x}$

of a digital k-curve is defined

as a weighted combination of the vectors

\mathbf{t}_i
$\mathbf{t}_i$

of the covering

maximal segments

M_i
$M_i$

such that

\mathbf{t} (\mathbf{x}) = \frac{\sum_{M_i \in P(\mathbf{x})} \lambda(e_{i}(\mathbf{x}))\frac{\mathbf{t}_i}{|\mathbf{t}_i|}}{\sum_{M_i \in P(\mathbf{x})} \lambda(e_{i}(\mathbf{x}))}.
$\mathbf{t} (\mathbf{x}) = \frac{\sum_{M_i \in P(\mathbf{x})} \lambda(e_{i}(\mathbf{x}))\frac{\mathbf{t}_i}{|\mathbf{t}_i|}}{\sum_{M_i \in P(\mathbf{x})} \lambda(e_{i}(\mathbf{x}))}.$
\lambda
$\lambda$

## -Functions

\lambda: x \mapsto \sin(\pi x)
$\lambda: x \mapsto \sin(\pi x)$
\lambda: x \mapsto 64 (-x^6 + 3 x^5 - 3 x^4 + x^3)
$\lambda: x \mapsto 64 (-x^6 + 3 x^5 - 3 x^4 + x^3)$
\lambda: x \mapsto \frac{2}{e^{15 (x - 1/2)} + e^{-15 (x - 1/2)}}
$\lambda: x \mapsto \frac{2}{e^{15 (x - 1/2)} + e^{-15 (x - 1/2)}}$

A function

\lambda
$\lambda$

maps from

[0,1]
$[0,1]$

to

\mathbb{R}^+
$\mathbb{R}^+$

with

\lambda(0) = \lambda(1) = 0
$\lambda(0) = \lambda(1) = 0$

and

\lambda > 0
$\lambda > 0$

elsewhere.

# Multigrid Convergence

## What does it mean multigrid convergent?

D(X,h)
$D(X,h)$
X
$X$

Continuous shape

and its digitization

with respect to h.

Definition [Coeurjolly et al. 12]

The estimator

\hat{Q}
$\hat{Q}$

is multigrid-convergent for a family of shapes

\mathbb{X}
$\mathbb{X}$

iff

for any

X \in \mathbb{X},
$X \in \mathbb{X},$

there exists a grid step

h_X > 0
$h_X > 0$

such that the

estimate

\hat{Q}(D(X,h), \mathbf{y} , h)
$\hat{Q}(D(X,h), \mathbf{y} , h)$

is defined for all

\mathbf{y} \in \partial D(X,h)
$\mathbf{y} \in \partial D(X,h)$

with

0 < h < h_X,
$0 < h < h_X,$

and for any

\mathbf{x} \in \partial X,
$\mathbf{x} \in \partial X,$
\forall \mathbf{y} \in \partial D(X,h)
$\forall \mathbf{y} \in \partial D(X,h)$

with

\| \mathbf{y} - \mathbf{x} \|_1 \leq h, | \hat{Q} (D(X,h), \mathbf{y}, h ) - Q(X,\mathbf{x}) | \leq \tau_{X,\mathbf{x}}(h).
$\| \mathbf{y} - \mathbf{x} \|_1 \leq h, | \hat{Q} (D(X,h), \mathbf{y}, h ) - Q(X,\mathbf{x}) | \leq \tau_{X,\mathbf{x}}(h).$
\tau_{X,\mathbf{x}}
$\tau_{X,\mathbf{x}}$

Where

is a function defining the speed of convergence of

Any digital point sufficiently close to the point of the interest has its estimated geometric quantity, which tends toward the expected local value of the geometric function as h tends toward 0.

\hat{Q}
$\hat{Q}$

towards

Q
$Q$

at a point

\mathbf{x} \in \partial X.
$\mathbf{x} \in \partial X.$

## Multigrid Convergence

Theorem [Lachaud et al. 07]

The 2D      MST estimator is multigrid convergent toward the tangent direction along the boundary of any convex shape with three time differentiable boundary and continuous curvature. An upper bound for its average rate of convergence is           , as the grid step h tends toward 0.

\lambda-
$\lambda-$
O(h^{\frac{1}{3}})
$O(h^{\frac{1}{3}})$

## Steps of Proving Convergence in 2D

1.  Maximal segments have unbounded digital length with a finer and finer resolution

2. The slope of a maximal segment is then proved to tend toward the tangent direction of any point it covers

For the details see [Lachaud et al. 07]

## Convergence in 2D

h = 1
$h = 1$
h = 0.1
$h = 0.1$

h

h

Average Absolute Error

Average Absolute Error

For the details see [Coeurjolly et al. 12]

The plots comes from [Coeurjolly et al. 12]

## Convergence in 2D

For the details see [Coeurjolly et al. 12]

h = 1
$h = 1$
h = 0.1
$h = 0.1$

h

h

Average Absolute Error

Average Absolute Error

The plots comes from [Coeurjolly et al. 12]

## Properties of 3D Maximal Segments

In contrast to their 2D counterparts, 3D maximal segments can be short, even for very small h. This poses a problem for proving the convergence of 3D      MST.

\lambda-
$\lambda-$

Good News

We can derive two other methods for which we can prove the bound of average convergence, and then experimentally compare the convergence rate of the three methods.

Proposition

Let us denote by         the Euclidean length of the curve   .
Then the asymptotic average digital length         of 3D maximal segments along h-digitizations of    with gridstep h follows

\mathcal{L}(\gamma)
$\mathcal{L}(\gamma)$
\gamma
$\gamma$
\bar{\Lambda}(h)
$\bar{\Lambda}(h)$
\gamma
$\gamma$
\bar{\Lambda}(h) = \mathcal{L}(\gamma) \Omega\left(h^{-\frac{1}{3}}\right).
$\bar{\Lambda}(h) = \mathcal{L}(\gamma) \Omega\left(h^{-\frac{1}{3}}\right).$

## Properties of 3D Maximal Segments

Proposition

For any point    of a functional curve C, there exists some 3D maximal segment       such that:

\mathbf{x}
$\mathbf{x}$
M_k
$M_k$
• it is in the vicinity of
\mathbf{x}: d(\mathbf{x}, M_k) \leq \frac{\ell}{2},
$\mathbf{x}: d(\mathbf{x}, M_k) \leq \frac{\ell}{2},$
• it is long enough:
L(M_k) \geq \frac{\ell}{2},
$L(M_k) \geq \frac{\ell}{2},$

where     is the digital length of the shortest 2D maximal segments along the two valid projections.

\ell
$\ell$

## Asymptotic Properties and Multigrid Convergence

Filtered 3D     MST

\lambda-
$\lambda-$

Using the previous proposition we discard all the 3D maximal

L \leq \frac{\ell}{2}.
$L \leq \frac{\ell}{2}.$

segments with length

3D DSS is considered as being at the beginning (resp. end) of a 3D DSS that is not further away than

\frac{\ell}{2}.
$\frac{\ell}{2}.$

Then, each point not covered by a

## Asymptotic Properties and Multigrid Convergence

3D      MST by 2D

We consider two valid projection with respect to the main axis. We use 2D      MST on the 2D projective curves, and finally we combine the two 2D estimations of the tangent directions into a 3D tangent direction at each 3D point.

\lambda-
$\lambda-$
\lambda-
$\lambda-$

## Asymptotic Properties and Multigrid Convergence

Theorem

The 3D tangent estimator by combination of 2D maximal segments, and the 3D tangent estimator by filtered 3D maximal segments are both multigrid convergent toward the 3D tangent. An upper bound for their average rate of convergence is           , as the grid step h tends toward 0.

O(h^{\frac{1}{3}})
$O(h^{\frac{1}{3}})$

## Conclusion and Perspectives

• Understand behavior of the estimator on non-functional curves
• Future improvements for noisy data e.g., skeletons obtained from segmented CT scans
• Comparison with other methods

### Perspectives

We studied a 3D tangent estimator that is fast, simple and has good asymptotic behaviors

### Conclusion

The source code has been submitted to DGtal C++ library.

## References

• J.-P. Reveillès: Géométrie Discrète, Calcul en Nombres Entiers et Algorithmique, Habilitation à diriger des recherches, Université Louis-Pasteur, 1991, https://hal.archives-ouvertes.fr/tel-01279525
• I. Debled-Rennesson and J.-P. Reveillès: A linear algorithm for segmentation of digital curves, International Journal of Pattern Recognition and Artificial Intelligence, vol. 9(6), 1995.

• F. Feschet, L. Tougne: Optimal time computation of the tangent of a discrete curve: application to the curvature, in: Proceedings of DGCI’99, pp. 31–40, Springer 1999

• J.-O. Lachaud, A. Vialard, F. de Vieilleville: Fast, accurate and convergent tangent estimation on digital contours, Image and Vision Computing, pp. 1572-1587, vol. 25(10), 2007

• D. Coeurjolly, J.-O. Lachaud, T. Roussillon: Multigrid Convergence of Discrete Geometric Estimators, Lecture Notes in Computational Vision and Biomechanics, pp. 395-424, vol. 2, Springer 2012

By Kacper Pluta

# Tangent Estimation of 3D Digital Curves

A seminary talk about 3D Lambda-maximal segment tangent estimator.

• 135