next up previous contents
Next: Image Feature Functions Up: Feature Representation Previous: Introduction   Contents

Image Features

A number of purely 2D and localised image features are available. These include edges, corners, region boundaries. Latter, a more symbolic 2D primitive, called a Point2, is introduced. This is used for the representation of, amongst other things, vertex locations. All 2D feature location primitives and the Vec2 data type can be treated in a uniform manor using POS2 (Position 2D) macros (see below). This facilitates the generation of primitive independent code (eg. polygonal approximation).

Edges are the most important image feature in the Tina system. Each individual edge location (one per pixel through which the edge passes) is represented the edgel data structure

typedef struct edgel
{
    Ts_id ts_id;                /* Tina structure identifier */
    unsigned int type; /* includes information as to rectification status */
    unsigned int label;
    struct vec2 pos;
    float orient; /* these could go to props list perhaps NAT */
    float contrast;
    struct list *props;
} Edgel;

Although strictly defined for use to describe edge elements this data structure is sufficiently flexible to allow its use for any well located image feature. Currently the edgel is also used to represent corner points (although this may change in a future release of the system).

The Vec2 pos is the sub pixel location of the edge with respect to the underlying image (or a transformed version of it). Where the center of the pixel indexed [i, j] is at sub pixel image location [i+0.5, j+0.5]. The fields orient and con represent the orientation of the edge and its absolute image contrast. The contrast of an edge is proportional to the absolute gradient across it. The orientation of an edge, given in radians is given by the local direction along the edge (- to degrees with + clockwise). Orientations 0, and - are all horizontal, with 0 being light above dark and and - both being dark above light.

The type of an edge is more complex than that of other Tina primitives as it contains several pieces of information. The type is split into 8 4-bit fields the lower 5 of which have already been defined.


field mask value
1 0x0000000F type
2 0x000000F0 conn
3 0x00000F00 rect
4 0x0000F000 loop
5 0x000F0000 match
6 0x00F00000 corr

type specifies the process that generated the edge, eg.

conn describes the connectivity of the edge, eg.

An isolated edge is more important than an edge that is not linked. The edge linker leaves isolated edges unlinked where as the corner matcher flags its edge features as isolated.

rect and corr specify the rectification and distortion correction, or other transformation, state of an edge, eg:

loop identifies those edges that are part of a looped edge string, eg

Raw edges that have none of the above fields set to meaningful values have type EDGE_RAW which includes:

EDGE_UNKNOWN, EDGE_NOLINK and EDGE_NOT_RECTIFIED).

The following masks have been defined for setting and getting fields from the edge type, eg:

Raw edges that have non of the above field set to meaningful values have type EDGE_RAW

name mask
EDGE_SET_CORR_MASK 0xFF0FFFFF
EDGE_SET_MATCH_MASK 0xFFF0FFFF
EDGE_SET_LOOP_MASK 0xFFFF0FFF
EDGE_SET_RECT_MASK 0xFFFFF0FF
EDGE_SET_CONN_MASK 0xFFFFFF0F
EDGE_SET_TYPE_MASK 0xFFFFFFF0
EDGE_GET_CORR_MASK 0x00F00000
EDGE_GET_MATCH_MASK 0x000F0000
EDGE_GET_LOOP_MASK 0x0000F000
EDGE_GET_RCT_MASK 0x00000F00
EDGE_GET_CONN_MASK 0x000000F0
EDGE_GET_TYPE_MASK 0x0000000F

For example to set the rectification field to EDGE_RECTIFIED

edge->type &= EDGE_SET_RECT_MASK;
edge->type |= EDGE_RECTIFIED;

And to get the state of the rectification field

edge->type & EDGE_GET_RECT_MASK

After linking edges can be accessed through a list of Tina Strings & see
Generic List section of the manual). This is stored on the property list of the edgerect using the defined type STRING. Elements of tina strings or other topological data structures that refer to edge elements use the defined type EDGE.



Subsections
next up previous contents
Next: Image Feature Functions Up: Feature Representation Previous: Introduction   Contents
root 2017-09-20