#include "sift.h"
#include "imop.h"
#include "mathop.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
Defines | |
#define | VL_SIFT_BILINEAR_ORIENTATIONS 1 |
Use bilinear interp. to compute orientations. | |
#define | EXPN_SZ 256 |
#define | EXPN_MAX 25.0 |
Functions | |
VL_INLINE double | fast_expn (double x) |
Fast ![]() | |
VL_INLINE void | fast_expn_init () |
Initialize tables for fast_expn. | |
static void | copy_and_upsample_rows (vl_sift_pix *dst, vl_sift_pix const *src, int width, int height) |
Copy imge, upsample rows and take transpose. | |
static void | copy_and_downsample (vl_sift_pix *dst, vl_sift_pix const *src, int width, int height, int d) |
Copy and downsample an image. | |
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. | |
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. | |
static void | update_gradient (VlSiftFilt *f) |
Update gradients to current GSS octave. | |
int | vl_sift_calc_keypoint_orientations (VlSiftFilt *f, double angles[4], VlSiftKeypoint const *k) |
Calculate the keypoint orientation(s). | |
VL_INLINE vl_sift_pix | normalize_histogram (vl_sift_pix *begin, vl_sift_pix *end) |
Normalizes in norm L_2 a descriptor. | |
void | vl_sift_calc_keypoint_descriptor (VlSiftFilt *f, vl_sift_pix *descr, VlSiftKeypoint const *k, double angle0) |
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. | |
Variables | |
double | expn_tab [EXPN_SZ] |
For internal use only.
#define EXPN_MAX 25.0 |
#define EXPN_SZ 256 |
#define VL_SIFT_BILINEAR_ORIENTATIONS 1 |
For internal use only.
static void copy_and_downsample | ( | vl_sift_pix * | dst, | |
vl_sift_pix const * | src, | |||
int | width, | |||
int | height, | |||
int | d | |||
) | [static] |
For internal use only.
dst | output imgae buffer. | |
src | input image buffer. | |
width | input image width. | |
height | input image height. | |
d | octaves (non negative). |
1/2^d
of its original size. The parameters width and height are the size of the input image. The destination image dst is assumed to be floor(width/2^d)
pixels wide and floor(height/2^d)
pixels high.
static void copy_and_upsample_rows | ( | vl_sift_pix * | dst, | |
vl_sift_pix const * | src, | |||
int | width, | |||
int | height | |||
) | [static] |
For internal use only.
dst | output imgage buffer. | |
src | input image buffer. | |
width | input image width. | |
height | input image height. |
Upsampling is performed by linear interpolation.
VL_INLINE double fast_expn | ( | double | x | ) |
For internal use only.
x | argument. |
VL_INLINE void fast_expn_init | ( | ) |
For internal use only.
VL_INLINE vl_sift_pix normalize_histogram | ( | vl_sift_pix * | begin, | |
vl_sift_pix * | end | |||
) |
For internal use only.
begin | begin of histogram. | |
end | end of histogram. |
static void update_gradient | ( | VlSiftFilt * | f | ) | [static] |
For internal use only.
f | SIFT filter. |
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
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. |