#include "cxcore.h"
|
struct | feature |
| Structure to represent an affine invariant image feature. More...
|
|
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
◆ 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
-
filename | location of a file containing image features |
type | determines 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
|
feat | pointer 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
-
filename | name of file to which to export features |
feat | feature array |
n | number 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
-
img | image on which to display features |
feat | array of Oxford-type features |
n | number of features |
◆ descr_dist_sq()
Calculates the squared Euclidian distance between two feature descriptors.
- Parameters
-
f1 | first feature |
f2 | second feature |
- Returns
- Returns the squared Euclidian distance between the descriptors of f1 and f2.
int d
descriptor length
Definition: imgfeatures.h:53
int array_double(void **array, int n, int size)
Doubles the size of an array with error checking.
void erase_from_stream(FILE *stream, int n)
Erases a specified number of characters from a stream.
int n
number of features
Definition: kdtree.h:35
struct feature * features
features at this node
Definition: kdtree.h:34
struct feature * fwd_match
matching feature from forward image
Definition: imgfeatures.h:57
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
int type
feature type, OXFD or LOWE
Definition: imgfeatures.h:55
struct kd_node * kd_right
right child
Definition: kdtree.h:37
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.
int n
number of elements in pq
Definition: minpq.h:36
void fatal_error(char *format,...)
Prints an error message and aborts the program.
void * minpq_extract_min(struct min_pq *min_pq)
Removes and returns the element of a minimizing priority queue with the smallest key.
void display_big_img(IplImage *img, char *title)
Displays an image, making sure it fits on screen.
double dist_sq_2D(CvPoint2D64f p1, CvPoint2D64f p2)
Calculates the squared distance between two points.
feature_match_type
FEATURE_FWD_MATCH FEATURE_BCK_MATCH FEATURE_MDL_MATCH.
Definition: imgfeatures.h:22
a minimizing priority queue
Definition: minpq.h:32
char * replace_extension(const char *file, const char *extn)
Replaces a file's extension, which is assumed to be everything after the last dot ('.
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...
void kdtree_release(struct kd_node *kd_root)
De-allocates memory held by a kd tree.
double y
y coord
Definition: imgfeatures.h:47
#define FEATURE_MAX_D
max feature descriptor length
Definition: imgfeatures.h:35
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
holds feature data relevant to detection
Definition: sift.h:28
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...
Structure to represent an affine invariant image feature.
Definition: imgfeatures.h:44
double a
Oxford-type affine region parameter.
Definition: imgfeatures.h:48
int leaf
1 if node is a leaf, 0 otherwise
Definition: kdtree.h:33
CvPoint2D64f img_pt
location in image
Definition: imgfeatures.h:60
int minpq_insert(struct min_pq *min_pq, void *data, int key)
Inserts an element into a minimizing priority queue.
holds feature data relevant to ransac
Definition: xform.h:20
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...
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
double scl
scale of a Lowe-style feature
Definition: imgfeatures.h:51
double x
x coord
Definition: imgfeatures.h:46
double kv
partition key value
Definition: kdtree.h:32
void * feature_data
user-definable data
Definition: imgfeatures.h:62
a node in a k-d tree
Definition: kdtree.h:29
void draw_features(IplImage *img, struct feature *feat, int n)
Displays a set of features on an image.
CvPoint2D64f mdl_pt
location in model
Definition: imgfeatures.h:61
feature_type
FEATURE_OXFD FEATURE_LOWE.
Definition: imgfeatures.h:15
struct kd_node * kdtree_build(struct feature *features, int n)
A function to build a k-d tree database from keypoints in an array.
double c
Oxford-type affine region parameter.
Definition: imgfeatures.h:50
int sift_features(IplImage *img, struct feature **feat)
Finds SIFT features in an image using default parameter values.
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
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.
int ki
partition key index
Definition: kdtree.h:31
char * basename(const char *pathname)
A function that removes the path from a filename.
double b
Oxford-type affine region parameter.
Definition: imgfeatures.h:49
struct kd_node * kd_left
left child
Definition: kdtree.h:36
int import_features(char *filename, int type, struct feature **feat)
Reads image features from file.
struct feature * mdl_match
matching feature from model
Definition: imgfeatures.h:59
double descr_dist_sq(struct feature *f1, struct feature *f2)
Calculates the squared Euclidian distance between two feature descriptors.
void progress(int done)
Displays progress in the console with a spinning pinwheel.
double ori
orientation of a Lowe-style feature
Definition: imgfeatures.h:52
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
IplImage * stack_imgs(IplImage *img1, IplImage *img2)
Combines two images by scacking one on top of the other.
void draw_x(IplImage *img, CvPoint pt, int r, int w, CvScalar color)
Draws an x on an image.
char * prepend_path(const char *path, const char *file)
Prepends a path to a filename.
an element in a minimizing priority queue
Definition: minpq.h:24
struct min_pq * minpq_init()
Creates a new minimizing priority queue.
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
int category
all-purpose feature category
Definition: imgfeatures.h:56
void minpq_release(struct min_pq **min_pq)
De-allocates the memory held by a minimizing priorioty queue.
int win_closed(char *name)
Checks if a HighGUI window is still open or not.
void vid_view(IplImage **imgs, int n, char *win_name)
Allows user to view an array of images as a video.
double descr[FEATURE_MAX_D]
descriptor
Definition: imgfeatures.h:54
struct feature * bck_match
matching feature from backmward image
Definition: imgfeatures.h:58