SIFT  1.1.2
Data Structures | Macros | Enumerations | Functions
imgfeatures.h File Reference
#include "cxcore.h"

Data Structures

struct  feature
 Structure to represent an affine invariant image feature. More...
 

Macros

#define FEATURE_MAX_D   128
 max feature descriptor length
 

Enumerations

enum  feature_type
 FEATURE_OXFD
FEATURE_LOWE.
 
enum  feature_match_type
 FEATURE_FWD_MATCH
FEATURE_BCK_MATCH
FEATURE_MDL_MATCH.
 

Functions

int import_features (char *filename, int type, struct feature **feat)
 Reads image features from file. More...
 
int export_features (char *filename, struct feature *feat, int n)
 Exports a feature set to a file formatted depending on the type of features, as specified in the feature struct's type field. More...
 
void draw_features (IplImage *img, struct feature *feat, int n)
 Displays a set of features on an image. More...
 
double descr_dist_sq (struct feature *f1, struct feature *f2)
 Calculates the squared Euclidian distance between two feature descriptors. More...
 

Detailed Description

Functions and structures for dealing with image features.

Copyright (C) 2006-2010 Rob Hess hess@.nosp@m.eecs.nosp@m..oreg.nosp@m.onst.nosp@m.ate.e.nosp@m.du

Version
1.1.2-20100521

Function Documentation

◆ import_features()

int import_features ( char *  filename,
int  type,
struct feature **  feat 
)

Reads image features from file.

The file should be formatted either as from the code provided by the Visual Geometry Group at Oxford or from the code provided by David Lowe.

Parameters
filenamelocation of a file containing image features
typedetermines how features are input. If type is FEATURE_OXFD, the input file is treated as if it is from the code provided by the VGG at Oxford: http://www.robots.ox.ac.uk:5000/~vgg/research/affine/index.html

If type is FEATURE_LOWE, the input file is treated as if it is from David Lowe's SIFT code: http://www.cs.ubc.ca/~lowe/keypoints
featpointer to an array in which to store imported features; memory for this array is allocated by this function and must be released by the caller using free(*feat)
Returns
Returns the number of features imported from filename or -1 on error

◆ export_features()

int export_features ( char *  filename,
struct feature feat,
int  n 
)

Exports a feature set to a file formatted depending on the type of features, as specified in the feature struct's type field.

Parameters
filenamename of file to which to export features
featfeature array
nnumber of features
Returns
Returns 0 on success or 1 on error

◆ draw_features()

void draw_features ( IplImage *  img,
struct feature feat,
int  n 
)

Displays a set of features on an image.

Parameters
imgimage on which to display features
featarray of Oxford-type features
nnumber of features

◆ descr_dist_sq()

double descr_dist_sq ( struct feature f1,
struct feature f2 
)

Calculates the squared Euclidian distance between two feature descriptors.

Parameters
f1first feature
f2second feature
Returns
Returns the squared Euclidian distance between the descriptors of f1 and f2.
feature::d
int d
descriptor length
Definition: imgfeatures.h:53
array_double
int array_double(void **array, int n, int size)
Doubles the size of an array with error checking.
ransac_xform
CvMat * ransac_xform(struct feature *features, int n, int mtype, ransac_xform_fn xform_fn, int m, double p_badxform, ransac_err_fn err_fn, double err_tol, struct feature ***inliers, int *n_in)
Calculates a best-fit image transform from image feature correspondences using RANSAC.
erase_from_stream
void erase_from_stream(FILE *stream, int n)
Erases a specified number of characters from a stream.
kd_node::n
int n
number of features
Definition: kdtree.h:35
kd_node::features
struct feature * features
features at this node
Definition: kdtree.h:34
feature::fwd_match
struct feature * fwd_match
matching feature from forward image
Definition: imgfeatures.h:57
ransac_xform_fn
CvMat *(* ransac_xform_fn)(CvPoint2D64f *pts, CvPoint2D64f *mpts, int n)
Prototype for transformation functions passed to ransac_xform().
Definition: xform.h:54
pixval8
static int pixval8(IplImage *img, int r, int c)
A function to get a pixel value from an 8-bit unsigned image.
Definition: utils.h:34
feature::type
int type
feature type, OXFD or LOWE
Definition: imgfeatures.h:55
kd_node::kd_right
struct kd_node * kd_right
right child
Definition: kdtree.h:37
kdtree_bbf_knn
int kdtree_bbf_knn(struct kd_node *kd_root, struct feature *feat, int k, struct feature ***nbrs, int max_nn_chks)
Finds an image feature's approximate k nearest neighbors in a kd tree using Best Bin First search.
min_pq::n
int n
number of elements in pq
Definition: minpq.h:36
fatal_error
void fatal_error(char *format,...)
Prints an error message and aborts the program.
minpq_extract_min
void * minpq_extract_min(struct min_pq *min_pq)
Removes and returns the element of a minimizing priority queue with the smallest key.
display_big_img
void display_big_img(IplImage *img, char *title)
Displays an image, making sure it fits on screen.
dist_sq_2D
double dist_sq_2D(CvPoint2D64f p1, CvPoint2D64f p2)
Calculates the squared distance between two points.
feature_match_type
feature_match_type
FEATURE_FWD_MATCH FEATURE_BCK_MATCH FEATURE_MDL_MATCH.
Definition: imgfeatures.h:22
min_pq
a minimizing priority queue
Definition: minpq.h:32
replace_extension
char * replace_extension(const char *file, const char *extn)
Replaces a file's extension, which is assumed to be everything after the last dot ('.
kdtree_bbf_spatial_knn
int kdtree_bbf_spatial_knn(struct kd_node *kd_root, struct feature *feat, int k, struct feature ***nbrs, int max_nn_chks, CvRect rect, int model)
Finds an image feature's approximate k nearest neighbors within a specified spatial region in a kd tr...
kdtree_release
void kdtree_release(struct kd_node *kd_root)
De-allocates memory held by a kd tree.
feature::y
double y
y coord
Definition: imgfeatures.h:47
FEATURE_MAX_D
#define FEATURE_MAX_D
max feature descriptor length
Definition: imgfeatures.h:35
setpix32f
static void setpix32f(IplImage *img, int r, int c, float val)
A function to set a pixel value in a 32-bit floating-point image.
Definition: utils.h:76
detection_data
holds feature data relevant to detection
Definition: sift.h:28
persp_xform_pt
CvPoint2D64f persp_xform_pt(CvPoint2D64f pt, CvMat *T)
Performs a perspective transformation on a single point.
export_features
int export_features(char *filename, struct feature *feat, int n)
Exports a feature set to a file formatted depending on the type of features, as specified in the feat...
feature
Structure to represent an affine invariant image feature.
Definition: imgfeatures.h:44
feature::a
double a
Oxford-type affine region parameter.
Definition: imgfeatures.h:48
kd_node::leaf
int leaf
1 if node is a leaf, 0 otherwise
Definition: kdtree.h:33
feature::img_pt
CvPoint2D64f img_pt
location in image
Definition: imgfeatures.h:60
minpq_insert
int minpq_insert(struct min_pq *min_pq, void *data, int key)
Inserts an element into a minimizing priority queue.
ransac_data
holds feature data relevant to ransac
Definition: xform.h:20
minpq_get_min
void * minpq_get_min(struct min_pq *min_pq)
Returns the element of a minimizing priority queue with the smallest key without removing it from the...
setpix64f
static void setpix64f(IplImage *img, int r, int c, double val)
A function to set a pixel value in a 64-bit floating-point image.
Definition: utils.h:104
feature::scl
double scl
scale of a Lowe-style feature
Definition: imgfeatures.h:51
feature::x
double x
x coord
Definition: imgfeatures.h:46
kd_node::kv
double kv
partition key value
Definition: kdtree.h:32
feature::feature_data
void * feature_data
user-definable data
Definition: imgfeatures.h:62
kd_node
a node in a k-d tree
Definition: kdtree.h:29
dlt_homog
CvMat * dlt_homog(CvPoint2D64f *pts, CvPoint2D64f *mpts, int n)
Calculates a planar homography from point correspondeces using the direct linear transform.
draw_features
void draw_features(IplImage *img, struct feature *feat, int n)
Displays a set of features on an image.
feature::mdl_pt
CvPoint2D64f mdl_pt
location in model
Definition: imgfeatures.h:61
feature_type
feature_type
FEATURE_OXFD FEATURE_LOWE.
Definition: imgfeatures.h:15
kdtree_build
struct kd_node * kdtree_build(struct feature *features, int n)
A function to build a k-d tree database from keypoints in an array.
feature::c
double c
Oxford-type affine region parameter.
Definition: imgfeatures.h:50
sift_features
int sift_features(IplImage *img, struct feature **feat)
Finds SIFT features in an image using default parameter values.
pixval64f
static double pixval64f(IplImage *img, int r, int c)
A function to get a pixel value from a 64-bit floating-point image.
Definition: utils.h:90
_sift_features
int _sift_features(IplImage *img, struct feature **feat, int intvls, double sigma, double contr_thr, int curv_thr, int img_dbl, int descr_width, int descr_hist_bins)
Finda SIFT features in an image using user-specified parameter values.
kd_node::ki
int ki
partition key index
Definition: kdtree.h:31
homog_xfer_err
double homog_xfer_err(CvPoint2D64f pt, CvPoint2D64f mpt, CvMat *H)
Calculates the transfer error between a point and its correspondence for a given homography,...
basename
char * basename(const char *pathname)
A function that removes the path from a filename.
feature::b
double b
Oxford-type affine region parameter.
Definition: imgfeatures.h:49
kd_node::kd_left
struct kd_node * kd_left
left child
Definition: kdtree.h:36
import_features
int import_features(char *filename, int type, struct feature **feat)
Reads image features from file.
feature::mdl_match
struct feature * mdl_match
matching feature from model
Definition: imgfeatures.h:59
lsq_homog
CvMat * lsq_homog(CvPoint2D64f *pts, CvPoint2D64f *mpts, int n)
Calculates a least-squares planar homography from point correspondeces.
descr_dist_sq
double descr_dist_sq(struct feature *f1, struct feature *f2)
Calculates the squared Euclidian distance between two feature descriptors.
ransac_err_fn
double(* ransac_err_fn)(CvPoint2D64f pt, CvPoint2D64f mpt, CvMat *T)
Prototype for error functions passed to ransac_xform().
Definition: xform.h:71
progress
void progress(int done)
Displays progress in the console with a spinning pinwheel.
feature::ori
double ori
orientation of a Lowe-style feature
Definition: imgfeatures.h:52
setpix8
static void setpix8(IplImage *img, int r, int c, uchar val)
A function to set a pixel value in an 8-bit unsigned image.
Definition: utils.h:48
stack_imgs
IplImage * stack_imgs(IplImage *img1, IplImage *img2)
Combines two images by scacking one on top of the other.
draw_x
void draw_x(IplImage *img, CvPoint pt, int r, int w, CvScalar color)
Draws an x on an image.
prepend_path
char * prepend_path(const char *path, const char *file)
Prepends a path to a filename.
pq_node
an element in a minimizing priority queue
Definition: minpq.h:24
minpq_init
struct min_pq * minpq_init()
Creates a new minimizing priority queue.
pixval32f
static float pixval32f(IplImage *img, int r, int c)
A function to get a pixel value from a 32-bit floating-point image.
Definition: utils.h:62
feature::category
int category
all-purpose feature category
Definition: imgfeatures.h:56
minpq_release
void minpq_release(struct min_pq **min_pq)
De-allocates the memory held by a minimizing priorioty queue.
win_closed
int win_closed(char *name)
Checks if a HighGUI window is still open or not.
vid_view
void vid_view(IplImage **imgs, int n, char *win_name)
Allows user to view an array of images as a video.
feature::descr
double descr[FEATURE_MAX_D]
descriptor
Definition: imgfeatures.h:54
feature::bck_match
struct feature * bck_match
matching feature from backmward image
Definition: imgfeatures.h:58