**Name**

**km_codecurve_ai** Compute affine-invariant codes for a single curve

**Command Synopsis**

**km_codecurve_ai** *NNorm* *FNorm* *NCurve* *curve* *curve_IP* *curve_FP* *curve_BP* *dictionary*

NNorm: number of points in the coder

FNorm: ratio of points to be encoded

NCurve: index of the curve in the list

curve: curve to encode (Flist)

curve_IP: indices of inflexion points of the curve (1-Flist)

curve_FP: indices of flat points of the curve (1-Flist)

curve_BP: indices of bitangent points of the curve (2-Flist)

dictionary: output dictionnary (Flists)

**Function Summary**

Flists km_codecurve_ai (curve , curve_IP , curve_FP , curve_BP , dict , NC , NN , FN )

Flist curve ;

Flist curve_IP ;

Flist curve_FP ;

Flist curve_BP ;

Flists dict ;

int NC ;

int NN ;

float FN ;

**Description**

This module computes a list of affine invariant codes that represent locally a curve.

To begin with, the inflexion, flat, and bitangent points (resp. IP, FP and BP) of the curve are computed, each one is associated with a direction *L*_{1}. This direction is either the tangent to IP and FP, or the bitangent to BP.

The affine invariant frame is defined in the following way. For each IP, FP and BP, the next tangent to the curve (*L*_{2}) is drawn. Let us consider the straight lines (*L*_{3} and *L*_{4}) parallel to *L*_{1}, between *L*_{1} and *L*_{2}, and at a distance 1/3 and 2/3 from *L*_{1}. Let *P*_{1} and *P*_{2} be the intersection points between *L*_{3} and *L*_{4} and the portion of the curve limited by the point of contact of *L*_{1} and *L*_{2} with the curve. If *L*_{5} is the line passing through *P*_{1} and *P*_{2}, consider the next tangent (*L*_{6}) to the curve parallel to *L*_{5}. Finally, denote *R*_{1}, *R*_{2} and *R*_{3} the intersection points between respectively *L*_{1} and *L*_{6}, *L*_{1} and *L*_{5}, and *L*_{2} and *L*_{5}.

The affine normalization is defined by mapping these three points to the triangle (0, 0) - (1, 0) - (1, 1) of the plane.

To end with, a piece of the curve is encoded in this frame. Let us consider the arc of length
| *R*_{1}*R*_{2}|×FNorm whose center point is the intersection of the curve and the median of the segment [*R*_{1}, *R*_{2}]. The coordinates of
NNorm equidistant points lying on this arc are computed in the affine invariant frame. These
NNorm points are a local code of the curve.

Each code is stored in an Flist structure, whose data field contains the following informations: number of the curve, indices of both limits of the encoded arc in the initial curve, coordinates of the central point of the arc, indices of both points of the curve surrounding the central point, coordinates of *R*_{1}, *R*_{2} and *R*_{3}, and step between encoded points. The data field is useful for postprocessing.

The result is the collection of these codes stored in an Flists structure.

For more details, see J.-L. Lisani's PhD dissertation [Lis01] or [LMMM03].

**See Also**

**Version 1.1**

Last Modification date : Thu Apr 15 00:46:13 2004

**Author**

Jose-Luis Lisani, Pablo Muse, Frederic Sur