    Next: Geometrical Primitives Up: Image Features Previous: Image Features   Contents

## Image Feature Functions

The following is a list of frequently used image feature functions.

```Edgel  *edge_alloc(int type)

Edgel  *edge_copy(Edgel * edge)

void    edge_free(Edgel * edge)
```

For allocating copying and freeing individual edges respectively. Freeing an edge will also free its property list. Copying an edge makes a copy of its property list see proplist_copy).

```void    edge_add_prop(Edgel * e, void *ptr, int type,
void (*free_func) ( /* ??? */ ),
Bool dofree)

void   *edge_prop_get(Edgel * e, int ptype)

void    edge_save_pos_prop(Edgel * edge, int type, int prop_type)

void    edge_get_pos_prop(Edgel * edge, int type, int prop_type)

Vec2    edge_image_pos(Edgel * edge)
```

Edge property lists see list section of the programmers guide) can be manipulated explicitly using the functions edge_add_prop and edge_prop_get by calling
proplist_addifnp and prop_get respectively).

In particular the property list is used to store the position of the edge with respect to different coordinate frames. This is useful when an edge is rectified for example. The function edgesave_pos_prop saves the current edge location on the property list with the type prop_type. The argument type is required to allow standard Tina indirect function call application. It also allows the function to be applied indirectly to nonedge structures.
The defined types IMPOS and RECTPOS are used to identify image positions and rectified positions respectively.

The function edge_image_pos examines rect field the edge type to check if the edge location has been altered. If so it checks the property list for IMPOS. If successful that image location is returned. All other situations return the pos field of the edge structure.

```int     er_add_edge(Imrect * edgerect, Edgel * edge)

void    er_put_edge(Edgel * edge, Imrect * edgerect, int i, int j)

Edgel  *er_get_edge(Imrect * edgerect, int i, int j)

void    er_rm_edges(Imrect * edgerect, unsigned int mask, unsigned int type)

void    er_free(Imrect * edgerect)
```

Edge/Edgerect manipulation functions. er_add_edge adds the edge according to its internal position truncated) provided that edgerect location exists and is still empty & nil). Unsuccessful calls return
false.

er_put_edge forces the edge into the location i, j provided it lies within the region covered by the edgerect. And er_get_edge recovers it.

er_rm_edges removes from the edgerect those edges for which

```type == edge->type(mask
```

is true. While er_free removes all edges from the edgerect and frees it up.

```void    er_set_row_index(Imrect * er)

void    er_find_edge_strings(Imrect * er)

void    er_find_simple_edge_strings(Imrect * er)

void    er_edge_strings_thres(Imrect * er, int length_thres,
double contrast_thres)

List   *es_list_thres(List * strings, int length_thres, double contrast_thres)
```

The edgerect supports alternative indices into the underlying sparse edge data. These are accessed through the property list of the edgerect.

The first is a row index. It is stored using the property type ROWS (or
ER_ROWS in old fashioned implementations). The row index is defined

```List **index;
```

and is defined over the vertical extent of the region of interest of the edgerect. The ptr index[r] is to an ordered list of all the edges on row r ofthe edgerect. To get hold of the row index it is necessary to call

```index = prop_get(er->props, ROWS);
```

Connected edge strings are identified and stored on the property list, using the property type STRING, by calling er_find_edge_strings.

Edge strings can be thresholded by both length and max contrast) by calls to either;
er_edge_strings_thres
or:
es_list_thres
which work on the edgerect through its property list) or directly on a list of
edge strings, respectively.

```void    er_apply_to_all_edges(Imrect * edgerect, void (*edgefunc) ( /* ??? */ ),
void *data)

void    er_apply_to_all_strings(Imrect * er, void (*func) ( /* ??? */ ),
void *data)

void    es_apply_to_all_edges(Imrect *er, void (*func) ( /* ??? */ ), void *data)
```

Functions to apply the func and data combination to all edges in an edgerect, all strings referenced by an edgerect and all the edges on the strings referenced by an edgerect respectively. They have standard indirect functioncall format except that er_apply_to_all_edges has additional arguments i, j to indicate the image location concerned.    Next: Geometrical Primitives Up: Image Features Previous: Image Features   Contents
root 2019-03-24