#include <stdio.h>
#include "generic.h"
Go to the source code of this file.
Data Structures | |
struct | _VlSiftKeypoint |
SIFT filter keypoint. More... | |
struct | _VlSiftFilt |
SIFT filter. More... | |
Typedefs | |
typedef vl_single | vl_sift_pix |
SIFT filter pixel type. | |
Functions | |
Create and destroy | |
VlSiftFilt * | vl_sift_new (int width, int height, int O, int S, int o_min) |
Create a new SIFT filter. | |
void | vl_sift_delete (VlSiftFilt *f) |
Delete SIFT filter. | |
Process data | |
int | vl_sift_process_first_octave (VlSiftFilt *f, vl_sift_pix const *im) |
Start processing a new image. | |
int | vl_sift_process_next_octave (VlSiftFilt *f) |
Process next octave. | |
void | vl_sift_detect (VlSiftFilt *f) |
Detect keypoints. | |
int | vl_sift_calc_keypoint_orientations (VlSiftFilt *f, double angles[4], VlSiftKeypoint const *k) |
Calculate the keypoint orientation(s). | |
void | vl_sift_calc_keypoint_descriptor (VlSiftFilt *f, vl_sift_pix *descr, VlSiftKeypoint const *k, double angle) |
Compute the descriptor of a keypoint. | |
void | vl_sift_keypoint_init (VlSiftFilt const *f, VlSiftKeypoint *k, double x, double y, double sigma) |
Initialize a keypoint from its position and scale. | |
Retrieve data and parameters | |
VL_INLINE int | vl_sift_get_octave_index (VlSiftFilt const *f) |
Get current octave index. | |
VL_INLINE int | vl_sift_get_octave_num (VlSiftFilt const *f) |
Get number of octaves. | |
VL_INLINE int | vl_sift_get_octave_first (VlSiftFilt const *f) |
Get first octave. | |
VL_INLINE int | vl_sift_get_octave_width (VlSiftFilt const *f) |
Get current octave width. | |
VL_INLINE int | vl_sift_get_octave_height (VlSiftFilt const *f) |
Get current octave height. | |
VL_INLINE int | vl_sift_get_level_num (VlSiftFilt const *f) |
Get number of levels per octave. | |
VL_INLINE int | vl_sift_get_keypoints_num (VlSiftFilt const *f) |
Get number of keypoints. | |
VL_INLINE double | vl_sift_get_peak_thresh (VlSiftFilt const *f) |
Get peaks treashold. | |
VL_INLINE double | vl_sift_get_edge_thresh (VlSiftFilt const *f) |
Get edges threshold. | |
VL_INLINE double | vl_sift_get_norm_thresh (VlSiftFilt const *f) |
Get norm threshold. | |
VL_INLINE vl_sift_pix * | vl_sift_get_octave (VlSiftFilt const *f, int s) |
Get current octave data. | |
VL_INLINE VlSiftKeypoint const * | vl_sift_get_keypoints (VlSiftFilt const *f) |
Get keypoints. | |
Set parameters | |
VL_INLINE void | vl_sift_set_peak_thresh (VlSiftFilt *f, double t) |
Set peaks threshold. | |
VL_INLINE void | vl_sift_set_edge_thresh (VlSiftFilt *f, double t) |
Set edges threshold. | |
VL_INLINE void | vl_sift_set_norm_thresh (VlSiftFilt *f, double t) |
Set norm threshold. |
parameter | alt. name | standard value | set by |
![]() | O | as big as possible | vl_sift_new() |
![]() | o_min | -1 | vl_sift_new() |
![]() | S | 3 | vl_sift_new() |
This score as a minimum (equal to 4) when both eigenvaues of the Jacobian are equal (curved peak) and is bigger and bigger as one of the eigenvalues grows and the other stays small. Peaks are retained if the score is below the quantity , where
is the edge threshold. Notice that this quantity has a minimum equal to 4 when
and grows thereafter. Therefore the range of the edge threshold is
.
The histogram is then smoothed and the maximum is selected. In addition to the biggest mode, up to other three modes whose amplitude is within the 80% of the biggest mode are retained too, returned as additional orientations.
parameter | alt. name | standard value | set by |
![]() | edge_thresh | 10.0 | vl_sift_set_edge_thresh() |
![]() | peak_thresh | 0 | vl_sift_set_peak_thresh() |
While SIFT descriptor is a 3-D array but it is usually presented as a vector. This vector is obtained by stacking the 3-D array being
is the fastest varying index and y the slowest.
The histogram uses soft binning, so that bins partially overlap. There are bins along the x and y directions and
along the
direction.
The actual sizes of the descriptor depend on the size of the keypoint as follows:
The following table summarizes the descriptors parameters along with their standard vale.
parameter | alt. name | standard value |
![]() | BP | 4 |
![]() | BO | 8 |
![]() | magnif | 3 |
The keypoint coordinates (x,y) are expressed in the standard image convention (y axis pointing down). This also establishes the convention for expressing the angle th of a vector v (here v could be either the gradient of the image or the direction of the keypoint). To slightly complicate the matter, however, the index th of the descriptor h(th,x,y) follows the opposite convention (this is for compatibility with Lowe's original SIFT implementation), as shown by the figure:
void vl_sift_calc_keypoint_descriptor | ( | VlSiftFilt * | f, | |
vl_sift_pix * | descr, | |||
VlSiftKeypoint const * | k, | |||
double | angle0 | |||
) |
f | SIFT filter. | |
descr | SIFT descriptor (output) | |
k | keypoint. | |
angle0 | keypoint direction. |
The function assumes that the keypoint is on the current octave. If not, it does not do anything.
int vl_sift_calc_keypoint_orientations | ( | VlSiftFilt * | f, | |
double | angles[4], | |||
VlSiftKeypoint const * | k | |||
) |
f | SIFT filter. | |
angles | orientations (output). | |
k | keypoint. |
The function requries the keypoint scale level k->s
to be in the range s_min+1
and s_max-2
(where usually s_min=0
and s_max=S+2
). If this is not the case, the function returns zero orientations.
void vl_sift_delete | ( | VlSiftFilt * | f | ) |
void vl_sift_detect | ( | VlSiftFilt * | f | ) |
The function detect keypoints in the current octave filling the internal keypoint buffer. Keypoints can be retrieved by vl_sift_get_keypoints().
f | SIFT filter. |
Index GSS
For internal use only.
Index matrix A
VL_INLINE double vl_sift_get_edge_thresh | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
VL_INLINE VlSiftKeypoint const * vl_sift_get_keypoints | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
VL_INLINE int vl_sift_get_keypoints_num | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
VL_INLINE int vl_sift_get_level_num | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
VL_INLINE double vl_sift_get_norm_thresh | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
VL_INLINE vl_sift_pix * vl_sift_get_octave | ( | VlSiftFilt const * | f, | |
int | s | |||
) |
f | SIFT filter. | |
s | level index. |
s_min = -1
and s_max = S + 2
, where S
is the number of levels per octave.
VL_INLINE int vl_sift_get_octave_first | ( | VlSiftFilt const * | f | ) |
-------------------------------------------------------------------
f | SIFT filter. |
VL_INLINE int vl_sift_get_octave_height | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
VL_INLINE int vl_sift_get_octave_index | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
VL_INLINE int vl_sift_get_octave_num | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
VL_INLINE int vl_sift_get_octave_width | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
VL_INLINE double vl_sift_get_peak_thresh | ( | VlSiftFilt const * | f | ) |
f | SIFT filter. |
void vl_sift_keypoint_init | ( | VlSiftFilt const * | f, | |
VlSiftKeypoint * | k, | |||
double | x, | |||
double | y, | |||
double | sigma | |||
) |
f | SIFT filter. | |
k | SIFT keypoint (output). | |
x | x coordinate of the center. | |
y | y coordinate of the center. | |
sigma | scale. |
VlSiftFilt* vl_sift_new | ( | int | width, | |
int | height, | |||
int | O, | |||
int | S, | |||
int | o_min | |||
) |
width | image width. | |
height | image height. | |
O | number of octaves. | |
S | number of levels per octave. | |
o_min | first octave index. |
Setting O to a negative value sets the number of octaves to the maximum possible value depending on the size of the image.
int vl_sift_process_first_octave | ( | VlSiftFilt * | f, | |
vl_sift_pix const * | im | |||
) |
f | SIFT filter. | |
im | image data. |
int vl_sift_process_next_octave | ( | VlSiftFilt * | f | ) |
f | SIFT filter. |
VL_INLINE void vl_sift_set_edge_thresh | ( | VlSiftFilt * | f, | |
double | t | |||
) |
f | SIFT filter. | |
t | threshold. |
VL_INLINE void vl_sift_set_norm_thresh | ( | VlSiftFilt * | f, | |
double | t | |||
) |
f | SIFT filter. | |
t | threshold. |
VL_INLINE void vl_sift_set_peak_thresh | ( | VlSiftFilt * | f, | |
double | t | |||
) |
f | SIFT filter. | |
t | threshold. |