Public Member Functions | Private Member Functions | Private Attributes
fhs_searcher Class Reference

Use F&H's DP style algorithm to search for global solutions to model match. More...

#include <fhs_searcher.h>

List of all members.

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.
void set_geom_wt (double geom_wt)
 Set scaling applied to shape cost (default 1.0).
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_arcarc_
 Arcs defining neighbour relationships between features.
double geom_wt_
 Scaling applied to shape cost (default 1.0).
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).

Detailed Description

Use F&H's DP style algorithm to search for global solutions to model match.

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 28 of file fhs_searcher.h.


Constructor & Destructor Documentation

fhs_searcher::fhs_searcher ( )

Default constructor.

Definition at line 18 of file fhs_searcher.cxx.


Member Function Documentation

double fhs_searcher::best_points ( vcl_vector< vgl_point_2d< double > > &  pts) const

Compute optimal position of all points.

Assumes search() has been called first Returns cost at optimal position

Assumes search() has been called first

Definition at line 247 of file fhs_searcher.cxx.

void fhs_searcher::combine_responses ( unsigned  im_index,
const vimt_image_2d_of< float > &  feature_response 
) [private]

Combine responses for image im_index, given supplied feature_response for that node.

Combine responses for image im_index.

Definition at line 56 of file fhs_searcher.cxx.

unsigned fhs_searcher::n_points ( ) const [inline]

Number of points represented.

Definition at line 75 of file fhs_searcher.h.

void fhs_searcher::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.

Assumes search() has been called first

Definition at line 200 of file fhs_searcher.cxx.

const vimt_image_2d_of< float > & fhs_searcher::root_cost_image ( ) const

Return final total cost image for root.

Definition at line 258 of file fhs_searcher.cxx.

unsigned fhs_searcher::root_node ( ) const

Index of root node (set by last call to set_tree().

Definition at line 49 of file fhs_searcher.cxx.

void fhs_searcher::search ( const vcl_vector< vimt_image_2d_of< float > > &  feature_response)

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

Parameters:
geom_wtis the weighting applied to the geometric component of the cost.

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 155 of file fhs_searcher.cxx.

void fhs_searcher::set_geom_wt ( double  geom_wt)

Set scaling applied to shape cost (default 1.0).

Definition at line 42 of file fhs_searcher.cxx.

void fhs_searcher::set_tree ( const vcl_vector< fhs_arc > &  arcs,
unsigned  root_node 
)

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 26 of file fhs_searcher.cxx.


Member Data Documentation

vcl_vector<fhs_arc> fhs_searcher::arc_ [private]

Arcs defining neighbour relationships between features.

Ordered so that parents precede children

Definition at line 33 of file fhs_searcher.h.

vcl_vector<unsigned> fhs_searcher::arc_to_j_ [private]

arc_to_j_[j] gives index of arc ending at given j.

Definition at line 39 of file fhs_searcher.h.

vcl_vector<vcl_vector<unsigned> > fhs_searcher::children_ [private]

children_[i] gives list of child nodes of node i in tree.

Definition at line 42 of file fhs_searcher.h.

vcl_vector<vimt_image_2d_of<float> > fhs_searcher::dist_im_ [private]

Workspace for sum of responses, transformed by distance function.

Definition at line 48 of file fhs_searcher.h.

double fhs_searcher::geom_wt_ [private]

Scaling applied to shape cost (default 1.0).

Definition at line 36 of file fhs_searcher.h.

vcl_vector<vimt_image_2d_of<int> > fhs_searcher::pos_im_ [private]

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 52 of file fhs_searcher.h.

vcl_vector<vimt_image_2d_of<float> > fhs_searcher::sum_im_ [private]

Workspace for accumulated sum of responses.

Definition at line 45 of file fhs_searcher.h.


The documentation for this class was generated from the following files: