next up previous contents
Next: Rectification Up: Examples from Edge Tool Previous: Canny Callback   Contents

Geom2 Callback

The basic geom callback is argument free and is as follows

static int stereo_images;

static void geom2_proc(void)
{
    if (stereo_images)
        stereo_geom2_proc();
    else
        mono_geom2_proc();
}

The variable stereo_images is used to select the appropriate Tina interface module procedures. We shall consider the case of monocular image processing

static int linear_approx;

static void mono_geom2_proc(void)
{
    Imrect *er;
    Tv     *tv;
    List   *strings;
    double  low_th, up_th;

    if ((er = mono_edges_get()) == NULL)
        return;

    low_th = low_fit_thres;
    up_th = up_fit_thres;

    strings = (List *) prop_get(er->props, STRING);

    switch (approx_type)
    {
    case POLY_PROX:
        strings = poly_strings(strings, low_th);
        break;
    case LINEAR_PROX:
        strings = linear_strings(strings, low_th);
        break;
    case CONIC_PROX:
        conic_filter_set(conic_bckf);   /* set bias corrected filter */
        strings = conic_strings(strings, 12, low_th, up_th, max_div);
        break;
    case LINEAR_CONIC_PROX:
        conic_filter_set(conic_bckf);   /* set bias corrected filter */
        strings = linear_strings(strings, low_th);
        poly_strings_find_conics(strings, sample, low_th, up_th, max_div);
        break;
    }

    if (options & JOIN)
        strings = conic_join(strings, er->region, conf_thres,
                             low_th, up_th, max_div);

    mono_geom_set(strings);
    tv = mono_tv_get();
    tv_repaint(tv);
    reclist_list_draw(tv, strings, NULL, geom_col_draw, NULL);
}

First the list of edge strings are recovered from the property list of the mono edges imrect (also called an edgerect) using the type definition ER_STRINGS (EdgeRect STRINGS). These use the standard Tstring (Tina string) data structures to index connected edges. The list of Line2 strings produced by either linear_strings , poly_strings or conic_strings reflect the structure of the original list of edge strings. Each poly string is recovered from a separate edge string and the order of Line2 elements (possibly a singleton) along the string reflects the order of edges along the original string.

Note that on completion each Line2 element has on its property list, indexed by the definition STRING, an index into the edge sub string to which it corresponds.

The new list data structure is finally registered in the mono geometry global variable for external access by other tool utilities with mono_geom_set.


next up previous contents
Next: Rectification Up: Examples from Edge Tool Previous: Canny Callback   Contents
root 2017-09-20