#include <fhs_searcher.h>
Model consists of a set of features, together with a tree of neighbour relationships of the form pos(j) = pos(i) + (N(mx,var_x),N(my,var_y)) where N(m,var) is a gaussian with mean m and variance var.
The aim is to find a set of points {p(i)} which minimise sum_i F_i(p(i)) + sum_k shape_cost(arc(k)) where k indexes the set of arcs defining neighbour relationships, and shape_cost(arc) = dx*dx/arc.var_x + dy*dy.var_y (dx=p(arc_j).x()-p(arc_i).x()-arc.mx) This is achieved using a combination of a quadratic distance function applied to each feature response image F(i), and a dynamic programming approach to combining the data.
Algorithm based on papers by Felzenszwalb and Huttenlocher on Pictoral Structure Matching.
Definition at line 27 of file fhs_searcher.h.
Public Member Functions | |
| fhs_searcher () | |
| Default constructor. | |
| void | set_tree (const vcl_vector< fhs_arc > &arcs, unsigned root_node) |
| Set tree defining relationships between features. | |
| unsigned | root_node () const |
| Index of root node (set by last call to set_tree(). | |
| unsigned | n_points () const |
| Number of points represented. | |
| void | search (const vcl_vector< vimt_image_2d_of< float > > &feature_response) |
| Perform global search. | |
| void | points_from_root (const vgl_point_2d< double > &root_pt, vcl_vector< vgl_point_2d< double > > &pts) const |
| Compute optimal position of all points given position of root. | |
| double | best_points (vcl_vector< vgl_point_2d< double > > &pts) const |
| Compute optimal position of all points. | |
| const vimt_image_2d_of< float > & | root_cost_image () const |
| Return final total cost image for root. | |
Private Member Functions | |
| void | combine_responses (unsigned im_index, const vimt_image_2d_of< float > &feature_response) |
| Combine responses for image im_index, given supplied feature_response for that node. | |
Private Attributes | |
| vcl_vector< fhs_arc > | arc_ |
| Arcs defining neighbour relationships between features. | |
| vcl_vector< unsigned > | arc_to_j_ |
| arc_to_j_[j] gives index of arc ending at given j. | |
| vcl_vector< vcl_vector< unsigned > > | children_ |
| children_[i] gives list of child nodes of node i in tree. | |
| vcl_vector< vimt_image_2d_of< float > > | sum_im_ |
| Workspace for accumulated sum of responses. | |
| vcl_vector< vimt_image_2d_of< float > > | dist_im_ |
| Workspace for sum of responses, transformed by distance function. | |
| vcl_vector< vimt_image_2d_of< int > > | pos_im_ |
| pos_[i](x,y,0),pos_[i](x,y,1) is position of best response for (x,y). | |
|
|
Default constructor.
Definition at line 16 of file fhs_searcher.cxx. |
|
|
Compute optimal position of all points. Assumes search() has been called first Returns cost at optimal position Definition at line 237 of file fhs_searcher.cxx. |
|
||||||||||||
|
Combine responses for image im_index, given supplied feature_response for that node.
Definition at line 46 of file fhs_searcher.cxx. |
|
|
Number of points represented.
Definition at line 67 of file fhs_searcher.h. |
|
||||||||||||
|
Compute optimal position of all points given position of root. Assumes search() has been called first Definition at line 190 of file fhs_searcher.cxx. |
|
|
Return final total cost image for root.
Definition at line 248 of file fhs_searcher.cxx. |
|
|
Index of root node (set by last call to set_tree().
Definition at line 39 of file fhs_searcher.cxx. |
|
|
Perform global search. Images of feature response supplied. The transformation (world2im()) for each image can be used to indicate regions which don't necessarily overlap. However, effective displacements are assumed to be in pixel sized steps. After calling search(), results can be obtained using points() and best_points() etc Definition at line 145 of file fhs_searcher.cxx. |
|
||||||||||||
|
Set tree defining relationships between features. Input arcs define neighbour relationships in any order. root_node defines which feature to be used as the root Definition at line 23 of file fhs_searcher.cxx. |
|
|
Arcs defining neighbour relationships between features. Ordered so that parents precede children Definition at line 32 of file fhs_searcher.h. |
|
|
arc_to_j_[j] gives index of arc ending at given j.
Definition at line 35 of file fhs_searcher.h. |
|
|
children_[i] gives list of child nodes of node i in tree.
Definition at line 38 of file fhs_searcher.h. |
|
|
Workspace for sum of responses, transformed by distance function.
Definition at line 44 of file fhs_searcher.h. |
|
|
pos_[i](x,y,0),pos_[i](x,y,1) is position of best response for (x,y). Result is in image co-ordinates. Definition at line 48 of file fhs_searcher.h. |
|
|
Workspace for accumulated sum of responses.
Definition at line 41 of file fhs_searcher.h. |
1.4.4