Go to the documentation of this file.00001
00002 #ifndef ClosestImagePointFinder_h_
00003 #define ClosestImagePointFinder_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <vcl_vector.h>
00023 #include <vnl/vnl_vector.h>
00024 #include <vgl/vgl_fwd.h>
00025
00026 class HomgInterestPointSet;
00027 class vcl_multimap_double_int;
00028 class HomgPoint2D;
00029
00030 class ClosestImagePointFinder
00031 {
00032 public:
00033
00034
00035 ClosestImagePointFinder(const HomgInterestPointSet& corners);
00036 ClosestImagePointFinder(vcl_vector<vgl_homg_point_2d<double> > const& corners);
00037 ClosestImagePointFinder(const vcl_vector<HomgPoint2D>& corners);
00038 ~ClosestImagePointFinder();
00039
00040
00041
00042
00043
00044 void get_all_within_search_region(double cx, double cy, double w, double h, vcl_vector<int>* out_indices);
00045 void get_all_within_search_region(vgl_box_2d<double> const& region, vcl_vector<int>* out_indices);
00046
00047 int get_closest_within_region(double cx, double cy, double w, double h, int* out_index = 0);
00048 int get_closest_within_distance(double cx, double cy, double r, int* out_index = 0);
00049
00050
00051 double get_last_squared_distance() const { return last_d2_; }
00052 int get_last_num_candidates() const { return last_inrange_; }
00053 int get_last_match_index() const { return last_index_; }
00054 double get_last_x() const { return px_[last_index_]; }
00055 double get_last_y() const { return py_[last_index_]; }
00056
00057 protected:
00058
00059
00060 int get_closest_within_region(double cx, double cy, double w, double h, int* out_index, double mindist_sq);
00061
00062 vnl_vector<double> px_;
00063 vnl_vector<double> py_;
00064 vcl_multimap_double_int* y2i_;
00065 double last_d2_;
00066 int last_inrange_;
00067 int last_index_;
00068 };
00069
00070 #endif // ClosestImagePointFinder_h_