The Harris corner detector (original) (raw)

next up previous contents
Next: Line segment detection Up: Feature detection Previous: Displaying a corner map Contents

  #include <gandalf/vision/harris_corner.h>

The Harris corner detector [#!Harris:Stephens:ALVEY88!#] computes the locally averaged moment matrix computed from the image gradients, and then combines the eigenvalues of the moment matrix to compute a corner ``strength'', of which maximum values indicate the corner positions. Here is an example code fragment using the Harris corner detector.

  Gan_Image *pImage; /* declare image from which corners will be computed */
  Gan_Mask1D *pFilter; /* convolution mask */
  Gan_CornerFeatureMap CornerMap; /* declare corner map */

  /* ... fill image ... */

  /* initialise corner map */
  gan_corner_feature_map_form ( &CornerMap,
                                1000 ); /* initial limit on number of corners */

  /* create convolution mask */
  pFilter = gan_gauss_mask_new ( GAN_FLOAT, 1.0, 9, 1.0, NULL );
  
  /* apply Harris corner detector */
  gan_harris_corner_q ( pImage, /* input image */
                        NULL, /* or binary mask of pixels to be processed */
                        NULL, NULL, /* or image pre-smoothing masks */
                        pFilter, pFilter, /* gradient smoothing */
                        0.04, /* kappa used in computing corner strength */
                        0.04, /* corner strength threshold */
                        NULL, /* or affine coordinate transformation */
                        0, /* status value to assign to each corner */
                        NULL, /* or pointer to camera structure defining
                                 distortion model */
                        NULL, /* or parameters of local feature map */
                        &CornerMap ); /* result corner map */

  /* free convolution mask and corner map */
  gan_mask1D_free ( pFilter );
  gan_corner_feature_map_free ( &CornerMap );

2006-03-17