#include <gandalf/vision/canny_edge.h>
The Canny edge detector is described in [3].
It involves three stages:
Gan_Image *pImage; /* declare image from which edges will be computed */
Gan_Mask1D *pFilter; /* convolution mask */
Gan_EdgeFeatureMap EdgeMap; /* declare edge map */
/* ... fill image ... */
/* initialise edge map */
gan_edge_feature_map_form ( &EdgeMap,
10000, /* initial limit on number of edges */
500 ); /* initial limit on number of edge strings */
/* create convolution mask */
pFilter = gan_gauss_mask_new ( GAN_FLOAT, 1.0, 9, 1.0, NULL );
/* apply Canny edge detector */
gan_canny_edge_q ( pImage, /* input image */
NULL, /* or binary mask of pixels to be processed */
pFilter, pFilter, /* image smoothing filters */
0.008, /* lower edge strength threshold */
0.024, /* upper edge strength threshold */
10, /* threshold on string length */
NULL, /* or affine coordinate transformation */
NULL, /* or pointer to camera structure defining
distortion model */
NULL, /* or parameters of local feature map */
&EdgeMap ); /* result edge map */
/* free convolution mask and edge map */
gan_mask1D_free ( pFilter );
gan_edge_feature_map_free ( &EdgeMap );