#include <yape.h>
Classes | |
struct | dir_table |
Public Member Functions | |
yape (int width, int height) | |
Constructor for detection in width x height images. | |
virtual | ~yape () |
void | set_radius (int radius) |
int | get_radius (void) |
void | set_tau (int tau) |
int | get_tau (void) |
void | activate_bins (void) |
void | disactivate_bins (void) |
void | set_use_bins (bool p_use_bins) |
bool | get_use_bins (void) |
void | set_bins_number (int nb_u, int nb_v) |
void | activate_subpixel (void) |
Subpixel. Can be activated or disactived (default) for monoscale detection. Always activated for multi-scale detection. | |
void | disactivate_subpixel (void) |
void | set_use_subpixel (bool p_use_subpixel) |
void | set_minimal_neighbor_number (int p_minimal_neighbor_number) |
int | get_minimal_neighbor_number (void) |
int | detect (IplImage *image, keypoint *points, int max_point_number, IplImage *smoothed_image=0) |
void | raw_detect (IplImage *im) |
detect interest points and add them to tmp_points. | |
int | pick_best_points (keypoint *points, unsigned int max_point_number) |
sort and select the max_point_number best features. | |
IplImage * | get_scores_image (void) |
Return scores and filtered images, for debugging purposes. | |
IplImage * | get_filtered_image (void) |
void | subpix_refine (IplImage *im, keypoint *p) |
Static Public Member Functions | |
static int | static_detect (IplImage *image, keypoint *points, int max_point_number, int radius=7, int tau=10) |
Static function for point detection. Slower but avoids an instantiation. | |
Protected Types | |
typedef std::vector< keypoint > | keypoint_vector |
Protected Member Functions | |
void | reserve_tmp_arrays (void) |
int | get_local_maxima (IplImage *image, int R, float scale) |
Find local maximas in score image and append them to tmp_points. | |
void | perform_one_point (const unsigned char *I, const int x, short *Scores, const int Im, const int Ip, const short *dirs, const unsigned char opposite, const unsigned char dirs_nb) |
bool | double_check (IplImage *image, int x, int y, short *dirs, unsigned char dirs_nb) |
bool | third_check (const short *Sb, const int next_line) |
void | precompute_directions (IplImage *image, short *_Dirs, int *_Dirs_nb, int R) |
void | init_for_monoscale (void) |
Protected Attributes | |
int | minimal_neighbor_number |
int | width |
int | height |
int | radius |
int | tau |
dir_table * | Dirs |
int * | Dirs_nb |
keypoint_vector | tmp_points |
bool | use_bins |
keypoint_vector | bins [10][10] |
int | bin_nb_u |
int | bin_nb_v |
bool | use_subpixel |
IplImage * | scores |
IplImage * | filtered_image |
int | stats_state [100] |
int | stats_iter [100] |
int | score |
int | a |
int | b |
int | A |
int | B0 |
int | B1 |
int | B2 |
int | state |
CvMat * | H |
CvMat * | mg |
CvMat * | shift |
Stands for Yet Another Point Extractor.
Usage:
You need OpenCV to use this code. Two different uses of the Yape class are possible:
1) The simplest way is to call the static function static_detect:
int N = yape::static_detect(image, points, maxNumberOfPoints[, radius]);
where:
image
is a pointer on a IplImage
structure from OpenCv. The type of the image should be IPL_DEPTH_8U
, with one channel; The lowest its value is, the finest are the detected points;points
is a array of keypoint s. It should be large enough to store all the detected points;maxNumberOfPoints
is the desired maximum number of detected points.radius
is a parameter for the point detection. Its value should be between 3 and 7, its default value is 7.The function returns the actual number of detected points.
2) Detection in a large number of images of same size:
If the detection should be performed on a large number of images of same size, you should first create an instance of the detector. The yape constructor performs some pre-computation and pre- memory allocation to save some computation time during the actual detection.
// Create an instance of Yape for detection in 640x480 images: yape * pe = new yape(640, 480); // The default value for the radius is 7. Use set_radius() to change it: pe->set_radius(3); // Call the function detect() exactly like the static_detect() function: N[0] = pe->detect(images[0], points[0], 100); N[1] = pe->detect(images[1], points[1], 100); N[2] = pe->detect(images[2], points[2], 100); N[3] = pe->detect(images[3], points[3], 100); ... // Call the destructor: delete pe;
Definition at line 86 of file yape.h.
typedef std::vector<keypoint> yape::keypoint_vector [protected] |
yape::yape | ( | int | width, | |
int | height | |||
) |
Constructor for detection in width
x height
images.
Definition at line 46 of file yape.cpp.
References activate_bins(), disactivate_subpixel(), height, init_for_monoscale(), minimal_neighbor_number, radius, set_bins_number(), set_minimal_neighbor_number(), tau, and width.
Referenced by static_detect().
yape::~yape | ( | ) | [virtual] |
void yape::activate_bins | ( | void | ) | [inline] |
void yape::activate_subpixel | ( | void | ) | [inline] |
Subpixel. Can be activated or disactived (default) for monoscale detection. Always activated for multi-scale detection.
Definition at line 106 of file yape.h.
References set_use_subpixel().
int yape::detect | ( | IplImage * | image, | |
keypoint * | points, | |||
int | max_point_number, | |||
IplImage * | smoothed_image = 0 | |||
) |
Definition at line 463 of file yape.cpp.
References filtered_image, get_local_maxima(), pick_best_points(), radius, raw_detect(), reserve_tmp_arrays(), subpix_refine(), and use_subpixel.
Referenced by static_detect().
void yape::disactivate_bins | ( | void | ) | [inline] |
void yape::disactivate_subpixel | ( | void | ) | [inline] |
bool yape::double_check | ( | IplImage * | image, | |
int | x, | |||
int | y, | |||
short * | dirs, | |||
unsigned char | dirs_nb | |||
) | [protected] |
IplImage* yape::get_filtered_image | ( | void | ) | [inline] |
int yape::get_local_maxima | ( | IplImage * | image, | |
int | R, | |||
float | scale | |||
) | [protected] |
Find local maximas in score image and append them to tmp_points.
Definition at line 674 of file yape.cpp.
References bin_nb_u, bin_nb_v, bins, is_local_maxima(), keypoint::scale, keypoint::score, scores, third_check(), tmp_points, keypoint::u, use_bins, keypoint::v, and yape_bin_size.
Referenced by pyr_yape::detect(), and detect().
int yape::get_minimal_neighbor_number | ( | void | ) | [inline] |
IplImage* yape::get_scores_image | ( | void | ) | [inline] |
bool yape::get_use_bins | ( | void | ) | [inline] |
void yape::init_for_monoscale | ( | void | ) | [protected] |
Definition at line 97 of file yape.cpp.
References Dirs, Dirs_nb, filtered_image, height, precompute_directions(), scores, yape::dir_table::t, width, and yape_max_radius.
Referenced by yape().
void yape::perform_one_point | ( | const unsigned char * | I, | |
const int | x, | |||
short * | Scores, | |||
const int | Im, | |||
const int | Ip, | |||
const short * | dirs, | |||
const unsigned char | opposite, | |||
const unsigned char | dirs_nb | |||
) | [protected] |
Definition at line 238 of file yape.cpp.
References A, a, A_INF, A_NOT_INF, A_NOT_SUP, A_SUP, b, B0, B0_INF, B0_NOT_INF, B0_NOT_SUP, B0_SUP, B1, B1_EQUAL_B2_NOT_INF, B1_EQUAL_B2_NOT_SUP, B1_INF, B1_INF_B2_INF, B1_INF_B2_NOT_SUP, B1_INF_B2_SUP, B1_NOT_INF, B1_NOT_INF_B2_NOT_INF, B1_NOT_SUP, B1_NOT_SUP_B2_NOT_SUP, B1_SUP, B1_SUP_B2_INF, B1_SUP_B2_NOT_INF, B1_SUP_B2_SUP, B2, B2_INF, B2_NOT_INF, B2_NOT_SUP, B2_SUP, GET_A, GET_B0, GET_B1, GET_B2, GOTO_END_NOT_AN_INTEREST_POINT, GOTO_STATE, PUT_B2_IN_B1_AND_GET_B2, score, and state.
Referenced by raw_detect().
int yape::pick_best_points | ( | keypoint * | points, | |
unsigned int | max_point_number | |||
) |
sort and select the max_point_number best features.
This method sorts tmp_points and select the max_point_number best points, as long as the score is high enough.
Definition at line 503 of file yape.cpp.
References bin_nb_u, bin_nb_v, bins, mymin(), N, tmp_points, and use_bins.
Referenced by pyr_yape::detect(), and detect().
void yape::precompute_directions | ( | IplImage * | image, | |
short * | _Dirs, | |||
int * | _Dirs_nb, | |||
int | R | |||
) | [protected] |
Definition at line 127 of file yape.cpp.
Referenced by init_for_monoscale(), and pyr_yape::pyr_yape().
void yape::raw_detect | ( | IplImage * | im | ) |
detect interest points and add them to tmp_points.
Detect interest points, without filtering and without selecting best ones.
Just find them and add them to tmp_points. tmp_points is not cleared in this method.
Definition at line 558 of file yape.cpp.
References Dirs, Dirs_nb, perform_one_point(), radius, scores, yape::dir_table::t, and tau.
Referenced by pyr_yape::detect(), and detect().
void yape::reserve_tmp_arrays | ( | void | ) | [protected] |
Definition at line 111 of file yape.cpp.
References bin_nb_u, bin_nb_v, bins, tmp_points, use_bins, yape_bin_size, and yape_tmp_points_array_size.
Referenced by pyr_yape::detect(), and detect().
void yape::set_bins_number | ( | int | nb_u, | |
int | nb_v | |||
) | [inline] |
void yape::set_minimal_neighbor_number | ( | int | p_minimal_neighbor_number | ) | [inline] |
void yape::set_radius | ( | int | radius | ) |
Definition at line 87 of file yape.cpp.
References radius.
Referenced by kpt_tracker::kpt_tracker(), and static_detect().
void yape::set_tau | ( | int | tau | ) |
void yape::set_use_bins | ( | bool | p_use_bins | ) | [inline] |
Definition at line 101 of file yape.h.
References use_bins.
Referenced by activate_bins(), and disactivate_bins().
void yape::set_use_subpixel | ( | bool | p_use_subpixel | ) | [inline] |
Definition at line 108 of file yape.h.
References use_subpixel.
Referenced by activate_subpixel(), and disactivate_subpixel().
int yape::static_detect | ( | IplImage * | image, | |
keypoint * | points, | |||
int | max_point_number, | |||
int | radius = 7 , |
|||
int | tau = 10 | |||
) | [static] |
void yape::subpix_refine | ( | IplImage * | im, | |
keypoint * | p | |||
) |
Definition at line 761 of file yape.cpp.
References Dirs, Dirs_nb, fit_quadratic_2x2(), radius, keypoint::score, score, scores, yape::dir_table::t, keypoint::u, and keypoint::v.
Referenced by pyr_yape::detect(), and detect().
bool yape::third_check | ( | const short * | Sb, | |
const int | next_line | |||
) | [inline, protected] |
Definition at line 607 of file yape.cpp.
References E, minimal_neighbor_number, N, S, and W.
Referenced by get_local_maxima().
int yape::A [protected] |
int yape::a [protected] |
int yape::b [protected] |
int yape::B0 [protected] |
int yape::B1 [protected] |
int yape::B2 [protected] |
int yape::bin_nb_u [protected] |
Definition at line 169 of file yape.h.
Referenced by get_local_maxima(), pick_best_points(), reserve_tmp_arrays(), and set_bins_number().
int yape::bin_nb_v [protected] |
Definition at line 169 of file yape.h.
Referenced by get_local_maxima(), pick_best_points(), reserve_tmp_arrays(), and set_bins_number().
keypoint_vector yape::bins[10][10] [protected] |
Definition at line 168 of file yape.h.
Referenced by get_local_maxima(), pick_best_points(), and reserve_tmp_arrays().
dir_table* yape::Dirs [protected] |
Definition at line 159 of file yape.h.
Referenced by init_for_monoscale(), pyr_yape::pyr_yape(), raw_detect(), pyr_yape::select_level(), subpix_refine(), pyr_yape::~pyr_yape(), and ~yape().
int* yape::Dirs_nb [protected] |
Definition at line 160 of file yape.h.
Referenced by init_for_monoscale(), pyr_yape::pyr_yape(), raw_detect(), pyr_yape::select_level(), subpix_refine(), pyr_yape::~pyr_yape(), and ~yape().
IplImage * yape::filtered_image [protected] |
Definition at line 175 of file yape.h.
Referenced by detect(), get_filtered_image(), init_for_monoscale(), and ~yape().
int yape::height [protected] |
int yape::minimal_neighbor_number [protected] |
Definition at line 141 of file yape.h.
Referenced by get_minimal_neighbor_number(), set_minimal_neighbor_number(), third_check(), and yape().
int yape::radius [protected] |
Definition at line 150 of file yape.h.
Referenced by pyr_yape::detect(), detect(), pyr_yape::pyramidBlurDetect(), raw_detect(), set_radius(), subpix_refine(), and yape().
int yape::score [protected] |
IplImage* yape::scores [protected] |
Definition at line 175 of file yape.h.
Referenced by get_local_maxima(), get_scores_image(), init_for_monoscale(), pyr_yape::pyr_yape(), raw_detect(), pyr_yape::select_level(), subpix_refine(), pyr_yape::~pyr_yape(), and ~yape().
CvMat* yape::shift [protected] |
int yape::state [protected] |
int yape::stats_iter[100] [protected] |
int yape::stats_state[100] [protected] |
int yape::tau [protected] |
Definition at line 153 of file yape.h.
Referenced by double_check(), get_tau(), raw_detect(), set_tau(), and yape().
keypoint_vector yape::tmp_points [protected] |
Definition at line 164 of file yape.h.
Referenced by get_local_maxima(), pick_best_points(), and reserve_tmp_arrays().
bool yape::use_bins [protected] |
Definition at line 167 of file yape.h.
Referenced by get_local_maxima(), get_use_bins(), pick_best_points(), reserve_tmp_arrays(), and set_use_bins().
bool yape::use_subpixel [protected] |
int yape::width [protected] |