Documentation>C API
Covariant feature detectors

Author
  Karel Lenc
  Andrea Vedaldi
  Michal Perdoch

covdet.h implements a number of covariant feature detectors, based on three cornerness measures (determinant of the Hessian, trace of the Hessian (aka Difference of Gaussians, and Harris). It supprots affine adaptation, orientation estimation, as well as Laplacian scale detection.

- Covariant detectors fundamentals
- Principles of covariant detection
- Differential and integral image operations
- Cornerness measures

# Getting started

The VlCovDet object implements a number of covariant feature detectors: Difference of Gaussian, Harris, determinant of Hessian. Variant of the basic detectors support scale selection by maximizing the Laplacian measure as well as affine normalization.

// create a detector object
VlCovDet * covdet = vl_covdet_new(method) ;
// set various parameters (optional)
vl_covdet_set_first_octave(covdet, -1) ; // start by doubling the image resolution
vl_covdet_set_octave_resolution(covdet, octaveResolution) ;
vl_covdet_set_peak_threshold(covdet, peakThreshold) ;
vl_covdet_set_edge_threshold(covdet, edgeThreshold) ;
// process the image and run the detector
vl_covdet_put_image(covdet, image, numRows, numCols) ;
vl_covdet_detect(covdet) ;
// drop features on the margin (optional)
vl_covdet_drop_features_outside (covdet, boundaryMargin) ;
// compute the affine shape of the features (optional)
vl_covdet_extract_affine_shape(covdet) ;
// compute the orientation of the features (optional)
vl_covdet_extract_orientations(covdet) ;
// get feature frames back
vl_size numFeatures = vl_covdet_get_num_features(covdet) ;
VlCovDetFeature const * feature = vl_covdet_get_features(covdet) ;
// get normalized feature appearance patches (optional)
vl_size w = 2*patchResolution + 1 ;
for (i = 0 ; i < numFeatures ; ++i) {
float * patch = malloc(w*w*sizeof(*desc)) ;
vl_covdet_extract_patch_for_frame(covdet,
patch,
patchResolution,
patchRelativeExtent,
patchRelativeSmoothing,
feature[i].frame) ;
// do something with patch
}
vl_covdet_extract_orientations
void vl_covdet_extract_orientations(VlCovDet *self)
Extract the orientation(s) for the stored features.
Definition covdet.c:2870
vl_covdet_set_edge_threshold
void vl_covdet_set_edge_threshold(VlCovDet *self, double edgeThreshold)
Set the edge threshold.
Definition covdet.c:3186
vl_covdet_set_octave_resolution
void vl_covdet_set_octave_resolution(VlCovDet *self, vl_size r)
Set the octave resolutuon.
Definition covdet.c:3349
vl_covdet_get_features
void * vl_covdet_get_features(VlCovDet *self)
Get the stored frames.
Definition covdet.c:3439
vl_covdet_get_num_features
vl_size vl_covdet_get_num_features(VlCovDet const *self)
Get number of stored frames.
Definition covdet.c:3430
vl_covdet_extract_patch_for_frame
vl_bool vl_covdet_extract_patch_for_frame(VlCovDet *self, float *patch, vl_size resolution, double extent, double sigma, VlFrameOrientedEllipse frame)
Helper for extracting patches.
Definition covdet.c:2443
vl_covdet_drop_features_outside
void vl_covdet_drop_features_outside(VlCovDet *self, double margin)
Drop features (partially) outside the image.
Definition covdet.c:3128
vl_covdet_new
VlCovDet * vl_covdet_new(VlCovDetMethod method)
Create a new object instance.
Definition covdet.c:1513
vl_covdet_detect
void vl_covdet_detect(VlCovDet *self)
Detect scale-space features.
Definition covdet.c:1935
vl_covdet_extract_affine_shape
void vl_covdet_extract_affine_shape(VlCovDet *self)
Extract the affine shape for the stored features.
Definition covdet.c:2664
vl_covdet_set_first_octave
void vl_covdet_set_first_octave(VlCovDet *self, vl_index o)
Set the index of the first octave.
Definition covdet.c:3261
vl_covdet_set_peak_threshold
void vl_covdet_set_peak_threshold(VlCovDet *self, double peakThreshold)
Set the peak threshold.
Definition covdet.c:3210
vl_covdet_put_image
int vl_covdet_put_image(VlCovDet *self, float const *image, vl_size width, vl_size height)
Detect features in an image.
Definition covdet.c:1693
VlCovDet
struct _VlCovDet VlCovDet
Covariant feature detector.
vl_size
vl_uint64 vl_size
Unsigned integer holding the size of a memory block.
Definition host.h:392
VlCovDetFeature
A detected feature shape and location.
Definition covdet.h:138

This example code:

- Calls vl_covdet_new constructs a new detector object. covdet.h supports a variety of different detectors (see VlCovDetMethod).
- Optionally calls various functions to set the detector parameters if needed (e.g. vl_covdet_set_peak_threshold).
- Calls vl_covdet_put_image to start processing a new image. It causes the detector to compute the scale space representation of the image, but does not compute the features yet.
- Calls vl_covdet_detect runs the detector. At this point features are ready to be extracted. However, one or all of the following steps may be executed in order to process the features further.
- Optionally calls vl_covdet_drop_features_outside to drop features outside the image boundary.
- Optionally calls vl_covdet_extract_affine_shape to compute the affine shape of features using affine adaptation.
- Optionally calls vl_covdet_extract_orientations to compute the dominant orientation of features looking for the dominant gradient orientation in patches.
- Optionally calls vl_covdet_extract_patch_for_frame to extract a normalized feature patch, for example to compute an invariant feature descriptor.