Multi-res point finder. More...
#include <mfpf_mr_point_finder.h>
Public Member Functions | |
mfpf_mr_point_finder () | |
Dflt ctor. | |
virtual | ~mfpf_mr_point_finder () |
Destructor. | |
unsigned | size () const |
Number of finders. | |
const mfpf_point_finder & | finder (unsigned L) const |
Point finder at level L. | |
mfpf_point_finder & | finder (unsigned L) |
Point finder at level L. | |
void | set (const vcl_vector< mfpf_point_finder * > &finders) |
Define point finders. Clone of each taken. | |
unsigned | max_after_pruning () const |
Maximum number of candidates to retain during multi_search_and_prune. | |
void | set_max_after_pruning (unsigned max_n) |
Maximum number of candidates to retain during multi_search_and_prune. | |
unsigned | image_level (unsigned i, const mfpf_pose &pose, const vimt_image_pyramid &im_pyr) const |
Select best level for searching around pose with finder i . | |
void | get_sample_vector (const vimt_image_pyramid &image_pyr, const vgl_point_2d< double > &p, const vgl_vector_2d< double > &u, unsigned L, vcl_vector< double > &v) |
Get sample image at specified point for level L of the point_finder hierarchy. | |
double | search (const vimt_image_pyramid &im_pyr, const mfpf_pose &pose0, mfpf_pose &best_pose) |
Searches around given pose, starting at coarsest model. | |
double | mr_search (const vimt_image_pyramid &im_pyr, mfpf_pose &pose, int L_lo, int L_hi) |
Searches around given pose, starting at coarsest model. | |
void | refine_match (const vimt_image_pyramid &im_pyr, mfpf_pose &pose, double &fit, unsigned L=0) |
Perform local optimisation to refine position,scale and angle. | |
void | multi_search (const vimt_image_pyramid &im_pyr, const mfpf_pose &pose0, vcl_vector< mfpf_pose > &poses, vcl_vector< double > &fits) |
Find all local optima at coarsest scale and search around each. | |
void | multi_search_and_prune (const vimt_image_pyramid &im_pyr, const mfpf_pose &pose0, vcl_vector< mfpf_pose > &poses, vcl_vector< double > &fits, int prune_level=-1) |
Find all non-overlapping local optima. | |
void | save_images_of_models (const vcl_string &basepath) const |
Save an image summarising each model in the hierarchy. | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual void | print_summary (vcl_ostream &os) const |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
Protected Attributes | |
vcl_vector< mbl_cloneable_ptr < mfpf_point_finder > > | finders_ |
Set of cost function objects. | |
unsigned | max_after_pruning_ |
Maximum number of candidates to retain during multi_search_and_prune. |
Multi-res point finder.
Contains a set of mfpf_point_finders, each trained at a different resolution. Contains search algorithms to take advantage of this.
Definition at line 18 of file mfpf_mr_point_finder.h.
mfpf_mr_point_finder::mfpf_mr_point_finder | ( | ) |
Dflt ctor.
Definition at line 24 of file mfpf_mr_point_finder.cxx.
mfpf_mr_point_finder::~mfpf_mr_point_finder | ( | ) | [virtual] |
Destructor.
Definition at line 34 of file mfpf_mr_point_finder.cxx.
void mfpf_mr_point_finder::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Definition at line 350 of file mfpf_mr_point_finder.cxx.
void mfpf_mr_point_finder::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Definition at line 337 of file mfpf_mr_point_finder.cxx.
const mfpf_point_finder& mfpf_mr_point_finder::finder | ( | unsigned | L | ) | const [inline] |
Point finder at level L.
Definition at line 41 of file mfpf_mr_point_finder.h.
mfpf_point_finder& mfpf_mr_point_finder::finder | ( | unsigned | L | ) | [inline] |
Point finder at level L.
Definition at line 45 of file mfpf_mr_point_finder.h.
void mfpf_mr_point_finder::get_sample_vector | ( | const vimt_image_pyramid & | image_pyr, |
const vgl_point_2d< double > & | p, | ||
const vgl_vector_2d< double > & | u, | ||
unsigned | L, | ||
vcl_vector< double > & | v | ||
) |
Get sample image at specified point for level L of the point_finder hierarchy.
Definition at line 82 of file mfpf_mr_point_finder.cxx.
unsigned mfpf_mr_point_finder::image_level | ( | unsigned | i, |
const mfpf_pose & | pose, | ||
const vimt_image_pyramid & | im_pyr | ||
) | const |
Select best level for searching around pose with finder i
.
Select best level for searching around pose with finder i.
Selects pyramid level with pixel sizes best matching the model pixel size at given pose.
Definition at line 56 of file mfpf_mr_point_finder.cxx.
vcl_string mfpf_mr_point_finder::is_a | ( | ) | const [virtual] |
Name of the class.
Definition at line 311 of file mfpf_mr_point_finder.cxx.
unsigned mfpf_mr_point_finder::max_after_pruning | ( | ) | const [inline] |
Maximum number of candidates to retain during multi_search_and_prune.
If zero, then refine all.
Definition at line 54 of file mfpf_mr_point_finder.h.
double mfpf_mr_point_finder::mr_search | ( | const vimt_image_pyramid & | im_pyr, |
mfpf_pose & | pose, | ||
int | L_lo, | ||
int | L_hi | ||
) |
Searches around given pose, starting at coarsest model.
Searches with finder(L_hi) and feeds best result into search for next model, until level L_lo. Result can be further improved by a call to refine_match()
Definition at line 144 of file mfpf_mr_point_finder.cxx.
void mfpf_mr_point_finder::multi_search | ( | const vimt_image_pyramid & | im_pyr, |
const mfpf_pose & | pose0, | ||
vcl_vector< mfpf_pose > & | poses, | ||
vcl_vector< double > & | fits | ||
) |
Find all local optima at coarsest scale and search around each.
Runs search at coarsest resolution, to find all local optima. If multiple angles/scales considered, the there may be many nearby responses. Each candidate is then localised by searching at finer and finer resolutions. Final responses may be further improved with refine_match()
Definition at line 189 of file mfpf_mr_point_finder.cxx.
void mfpf_mr_point_finder::multi_search_and_prune | ( | const vimt_image_pyramid & | im_pyr, |
const mfpf_pose & | pose0, | ||
vcl_vector< mfpf_pose > & | poses, | ||
vcl_vector< double > & | fits, | ||
int | prune_level = -1 |
||
) |
Find all non-overlapping local optima.
Runs search at coarsest resolution, to find all local optima. If multiple angles/scales considered, the there may be many nearby responses. Each candidate is then localised by searching at finer and finer resolutions. After searching to level prune_level, overlapping responses are pruned (best match in any overlapping group is retained). prune_level is defined modulo size(), so -1 is equivalent to pruning at the coarsest level (size()-1). Final responses may be further improved with refine_match().
Definition at line 225 of file mfpf_mr_point_finder.cxx.
void mfpf_mr_point_finder::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Definition at line 317 of file mfpf_mr_point_finder.cxx.
void mfpf_mr_point_finder::refine_match | ( | const vimt_image_pyramid & | im_pyr, |
mfpf_pose & | pose, | ||
double & | fit, | ||
unsigned | L = 0 |
||
) |
Perform local optimisation to refine position,scale and angle.
Uses finder(L) to do refinement.
Definition at line 171 of file mfpf_mr_point_finder.cxx.
void mfpf_mr_point_finder::save_images_of_models | ( | const vcl_string & | basepath | ) | const |
Save an image summarising each model in the hierarchy.
Saves images to basepath_L0.png, basepath_L1.png ...
Definition at line 281 of file mfpf_mr_point_finder.cxx.
double mfpf_mr_point_finder::search | ( | const vimt_image_pyramid & | im_pyr, |
const mfpf_pose & | pose0, | ||
mfpf_pose & | best_pose | ||
) |
Searches around given pose, starting at coarsest model.
Searches with coarsest model, and feeds best result into search for next model. Result can be further improved by a call to refine_match().
Returns match fit with finder(0) at best_pose.
Searches with coarsest model, and feeds best result into search for next model. Result can be further improved by a call to refine()
Definition at line 118 of file mfpf_mr_point_finder.cxx.
void mfpf_mr_point_finder::set | ( | const vcl_vector< mfpf_point_finder * > & | finders | ) |
Define point finders. Clone of each taken.
Definition at line 46 of file mfpf_mr_point_finder.cxx.
void mfpf_mr_point_finder::set_max_after_pruning | ( | unsigned | max_n | ) |
Maximum number of candidates to retain during multi_search_and_prune.
If zero, then refine all.
Definition at line 40 of file mfpf_mr_point_finder.cxx.
unsigned mfpf_mr_point_finder::size | ( | ) | const [inline] |
Number of finders.
Definition at line 38 of file mfpf_mr_point_finder.h.
short mfpf_mr_point_finder::version_no | ( | ) | const |
Version number for I/O.
Definition at line 301 of file mfpf_mr_point_finder.cxx.
vcl_vector<mbl_cloneable_ptr<mfpf_point_finder> > mfpf_mr_point_finder::finders_ [protected] |
Set of cost function objects.
Definition at line 23 of file mfpf_mr_point_finder.h.
unsigned mfpf_mr_point_finder::max_after_pruning_ [protected] |
Maximum number of candidates to retain during multi_search_and_prune.
If zero, then refine all.
Definition at line 27 of file mfpf_mr_point_finder.h.