Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

sdet_grid_finder Class Reference

#include <sdet_grid_finder.h>

Inheritance diagram for sdet_grid_finder:

Inheritance graph
[legend]
List of all members.

Detailed Description

Definition at line 91 of file sdet_grid_finder.h.

Public Types

enum  debug {
  NO_DEBUG = 0, VANISHING_POINT, AFFINE_GROUP_BEFORE_SKEW_SCALE, AFFINE_GROUP_AFTER_SKEW_SCALE,
  TRANS_PERIM_LINES, AFFINE_GROUP_AFTER_TRANS
}

Public Member Functions

 sdet_grid_finder (sdet_grid_finder_params &gfp)
 constructor from a parameter block (the only way).
 ~sdet_grid_finder ()
 Default Destructor.
bool match_grid ()
 find the grid in the set of line segments.
bool compute_homography ()
bool compute_manual_homography (vsol_point_2d_sptr ul, vsol_point_2d_sptr ur, vsol_point_2d_sptr lr, vsol_point_2d_sptr ll)
 The user will select the four corners of the grid in order to provide.
void clear ()
 Clear internal storage.
bool set_lines (const float xsize, const float ysize, vcl_vector< vsol_line_2d_sptr > const &lines)
 if there are less than 2 dominant groups then return false.
bool get_homography (vgl_h_matrix_2d< double > &homog)
bool get_debug_lines (vcl_vector< vsol_line_2d_sptr > &lines)
bool get_debug_grid_lines (vcl_vector< vsol_line_2d_sptr > &lines)
bool get_affine_lines (vcl_vector< vsol_line_2d_sptr > &lines)
bool get_matched_lines (vcl_vector< vsol_line_2d_sptr > &lines)
bool get_mapped_lines (vcl_vector< vsol_line_2d_sptr > &lines)
 Get the original set of lines mapped by the line homography.
bool get_backprojected_grid (vcl_vector< vsol_line_2d_sptr > &lines)
 Get the grid lines mapped back onto the image.
void set_verbose ()
void unset_verbose ()
bool transform_grid_points (vnl_matrix_fixed< double, 3, 3 > &K, vnl_matrix_fixed< double, 3, 4 > &M, vcl_vector< vsol_point_2d_sptr > &points)
 test camera parameter matrices.
bool init_output_file (vcl_ofstream &outstream)
 write transformed grid points to a file.
bool write_image_points (vcl_ofstream &outstream)
 append the output file with points calculated using homography_.
bool check_grid_match (vil1_image img)
 make sure homography and image correspond with each other.
bool SanityCheck ()
 Checks that parameters are within acceptable bounds.
void get_debug_choices (vcl_vector< vcl_string > &choices)

Public Attributes

int n_lines_x_
 number of horizontal grid lines
int n_lines_y_
 number of vertical grid lines
double spacing_
 spacing between lines
int thresh_
 bin threshold for dominant orientation groups
float angle_tol_
 angle tolerance for a dominant group
bool verbose_
 print informative debug output
int debug_state_
 general purpose debug state

Protected Member Functions

vsol_line_2d_sptr transform_line (vgl_h_matrix_2d< double > const &h, vsol_line_2d_sptr const &l)
 transform a vsol line by transforming the end points.
bool get_vanishing_point (vcl_vector< vsol_line_2d_sptr > const &para_lines, vgl_homg_point_2d< double > &vp)
 the vanishing point of a line bundle.
bool scale_transform (const double max_distance, vcl_vector< vsol_line_2d_sptr > const &gh, vcl_vector< vsol_line_2d_sptr > const &gv, vnl_matrix_fixed< double, 3, 3 > &S)
 Form a histogram of all pairwise distances of lines from the origin.
bool compute_vanishing_points ()
 vanishing points of the grid lines.
bool compute_projective_homography ()
 Compute a projective homography that sends the two major group vanishing points to the x and y directions.
bool compute_affine_homography ()
bool compute_homography_linear_chamfer (vgl_h_matrix_2d< double > &H)
 Assumes that a set of lines have been binned in the 1-d chamfer index.
bool get_square_pixel_stats (vil1_image img, int x, int y, double &mean_intensity, double &intensity_sigma)
 gets pixels stats from img within grid square specified by x,y.
void InitParams (const int n_lines_x, const int n_lines_y, const double spacing, const int thresh, const float angle_tol, bool verbose, int debug_state)

Protected Attributes

bool groups_valid_
 members.
bool vanishing_points_valid_
bool projective_homography_valid_
bool affine_homography_valid_
bool homography_valid_
float xmax_
float ymax_
vcl_vector< vsol_line_2d_sptrlines_
vcl_vector< vsol_line_2d_sptrdisplay_lines_
vcl_vector< vsol_line_2d_sptrmatched_lines_
vcl_vector< vsol_line_2d_sptrdebug_lines_
vcl_vector< vsol_line_2d_sptrdebug_grid_lines_
vcl_vector< vsol_line_2d_sptrgroup0_
vcl_vector< vsol_line_2d_sptrgroup1_
vcl_vector< vsol_line_2d_sptrafgroup0_
vcl_vector< vsol_line_2d_sptrafgroup1_
bsol_hough_line_index_sptr index_
grid_profile_matcher chamf0_
grid_profile_matcher chamf90_
vgl_homg_point_2d< double > vp0_
vgl_homg_point_2d< double > vp90_
vgl_h_matrix_2d< double > projective_homography_
vgl_h_matrix_2d< double > affine_homography_
vgl_h_matrix_2d< double > homography_

Friends

vcl_ostream & operator<< (vcl_ostream &, const sdet_grid_finder_params &gfp)


Member Enumeration Documentation

enum sdet_grid_finder_params::debug [inherited]
 

Enumerator:
NO_DEBUG 
VANISHING_POINT 
AFFINE_GROUP_BEFORE_SKEW_SCALE 
AFFINE_GROUP_AFTER_SKEW_SCALE 
TRANS_PERIM_LINES 
AFFINE_GROUP_AFTER_TRANS 

Definition at line 19 of file sdet_grid_finder_params.h.


Constructor & Destructor Documentation

sdet_grid_finder::sdet_grid_finder sdet_grid_finder_params gfp  ) 
 

constructor from a parameter block (the only way).

Definition at line 304 of file sdet_grid_finder.cxx.

sdet_grid_finder::~sdet_grid_finder  ) 
 

Default Destructor.

Definition at line 316 of file sdet_grid_finder.cxx.


Member Function Documentation

bool sdet_grid_finder::check_grid_match vil1_image  img  ) 
 

make sure homography and image correspond with each other.

Definition at line 1403 of file sdet_grid_finder.cxx.

void sdet_grid_finder::clear  ) 
 

Clear internal storage.

Definition at line 1393 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::compute_affine_homography  )  [protected]
 

Definition at line 697 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::compute_homography  ) 
 

Definition at line 1191 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::compute_homography_linear_chamfer vgl_h_matrix_2d< double > &  H  )  [protected]
 

Assumes that a set of lines have been binned in the 1-d chamfer index.

Assumes that dindex0_ are vertical lines and dindex90_ are horizontal

Definition at line 902 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::compute_manual_homography vsol_point_2d_sptr  ul,
vsol_point_2d_sptr  ur,
vsol_point_2d_sptr  lr,
vsol_point_2d_sptr  ll
 

The user will select the four corners of the grid in order to provide.

a rough estimate of the homography, then grid lines will be used to calculate a fine-tuned homography

Definition at line 1060 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::compute_projective_homography  )  [protected]
 

Compute a projective homography that sends the two major group vanishing points to the x and y directions.

Definition at line 522 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::compute_vanishing_points  )  [protected]
 

vanishing points of the grid lines.

Definition at line 487 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::get_affine_lines vcl_vector< vsol_line_2d_sptr > &  lines  ) 
 

Definition at line 1239 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::get_backprojected_grid vcl_vector< vsol_line_2d_sptr > &  lines  ) 
 

Get the grid lines mapped back onto the image.

Definition at line 1291 of file sdet_grid_finder.cxx.

void sdet_grid_finder_params::get_debug_choices vcl_vector< vcl_string > &  choices  )  [inherited]
 

Definition at line 38 of file sdet_grid_finder_params.cxx.

bool sdet_grid_finder::get_debug_grid_lines vcl_vector< vsol_line_2d_sptr > &  lines  ) 
 

Definition at line 1254 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::get_debug_lines vcl_vector< vsol_line_2d_sptr > &  lines  ) 
 

Definition at line 1246 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::get_homography vgl_h_matrix_2d< double > &  homog  ) 
 

bool sdet_grid_finder::get_mapped_lines vcl_vector< vsol_line_2d_sptr > &  lines  ) 
 

Get the original set of lines mapped by the line homography.

Definition at line 1271 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::get_matched_lines vcl_vector< vsol_line_2d_sptr > &  lines  ) 
 

Definition at line 1262 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::get_square_pixel_stats vil1_image  img,
int  x,
int  y,
double &  mean_intensity,
double &  intensity_sigma
[protected]
 

gets pixels stats from img within grid square specified by x,y.

Not returning a valid sigma value for now -DEC

Definition at line 1484 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::get_vanishing_point vcl_vector< vsol_line_2d_sptr > const &  para_lines,
vgl_homg_point_2d< double > &  vp
[protected]
 

the vanishing point of a line bundle.

Definition at line 406 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::init_output_file vcl_ofstream &  outstream  ) 
 

write transformed grid points to a file.

the zhang calibration routine located in bmvl/bcal

Definition at line 1331 of file sdet_grid_finder.cxx.

void sdet_grid_finder_params::InitParams const int  n_lines_x,
const int  n_lines_y,
const double  spacing,
const int  thresh,
const float  angle_tol,
bool  verbose,
int  debug_state
[protected, inherited]
 

Definition at line 49 of file sdet_grid_finder_params.cxx.

bool sdet_grid_finder::match_grid  ) 
 

find the grid in the set of line segments.

Definition at line 515 of file sdet_grid_finder.cxx.

bool sdet_grid_finder_params::SanityCheck  )  [inherited]
 

Checks that parameters are within acceptable bounds.

Note that msg << ends seems to restart the string and erase the previous string. We should only use it as the last call, use vcl_endl otherwise.

Definition at line 72 of file sdet_grid_finder_params.cxx.

bool sdet_grid_finder::scale_transform const double  max_distance,
vcl_vector< vsol_line_2d_sptr > const &  gh,
vcl_vector< vsol_line_2d_sptr > const &  gv,
vnl_matrix_fixed< double, 3, 3 > &  S
[protected]
 

Form a histogram of all pairwise distances of lines from the origin.

h_i is the count, d_i is the average distance in a bin The first peak is the distance between grid lines in the horizontal (gh) and vertical (gv) directions. The transformation makes each of these distances equal to spacing. The result is returned in S.

Definition at line 627 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::set_lines const float  xsize,
const float  ysize,
vcl_vector< vsol_line_2d_sptr > const &  lines
 

if there are less than 2 dominant groups then return false.

Definition at line 368 of file sdet_grid_finder.cxx.

void sdet_grid_finder::set_verbose  )  [inline]
 

Definition at line 124 of file sdet_grid_finder.h.

bool sdet_grid_finder::transform_grid_points vnl_matrix_fixed< double, 3, 3 > &  K,
vnl_matrix_fixed< double, 3, 4 > &  M,
vcl_vector< vsol_point_2d_sptr > &  points
 

test camera parameter matrices.

Definition at line 1367 of file sdet_grid_finder.cxx.

vsol_line_2d_sptr sdet_grid_finder::transform_line vgl_h_matrix_2d< double > const &  h,
vsol_line_2d_sptr const &  l
[protected]
 

transform a vsol line by transforming the end points.

Definition at line 1225 of file sdet_grid_finder.cxx.

void sdet_grid_finder::unset_verbose  )  [inline]
 

Definition at line 125 of file sdet_grid_finder.h.

bool sdet_grid_finder::write_image_points vcl_ofstream &  outstream  ) 
 

append the output file with points calculated using homography_.

Definition at line 1345 of file sdet_grid_finder.cxx.


Friends And Related Function Documentation

vcl_ostream& operator<< vcl_ostream &  os,
const sdet_grid_finder_params gfp
[friend, inherited]
 

Definition at line 108 of file sdet_grid_finder_params.cxx.


Member Data Documentation

vgl_h_matrix_2d<double> sdet_grid_finder::affine_homography_ [protected]
 

Definition at line 195 of file sdet_grid_finder.h.

bool sdet_grid_finder::affine_homography_valid_ [protected]
 

Definition at line 174 of file sdet_grid_finder.h.

vcl_vector<vsol_line_2d_sptr> sdet_grid_finder::afgroup0_ [protected]
 

Definition at line 185 of file sdet_grid_finder.h.

vcl_vector<vsol_line_2d_sptr> sdet_grid_finder::afgroup1_ [protected]
 

Definition at line 186 of file sdet_grid_finder.h.

float sdet_grid_finder_params::angle_tol_ [inherited]
 

angle tolerance for a dominant group

Definition at line 53 of file sdet_grid_finder_params.h.

grid_profile_matcher sdet_grid_finder::chamf0_ [protected]
 

Definition at line 190 of file sdet_grid_finder.h.

grid_profile_matcher sdet_grid_finder::chamf90_ [protected]
 

Definition at line 191 of file sdet_grid_finder.h.

vcl_vector<vsol_line_2d_sptr> sdet_grid_finder::debug_grid_lines_ [protected]
 

Definition at line 182 of file sdet_grid_finder.h.

vcl_vector<vsol_line_2d_sptr> sdet_grid_finder::debug_lines_ [protected]
 

Definition at line 181 of file sdet_grid_finder.h.

int sdet_grid_finder_params::debug_state_ [inherited]
 

general purpose debug state

Definition at line 55 of file sdet_grid_finder_params.h.

vcl_vector<vsol_line_2d_sptr> sdet_grid_finder::display_lines_ [protected]
 

Definition at line 179 of file sdet_grid_finder.h.

vcl_vector<vsol_line_2d_sptr> sdet_grid_finder::group0_ [protected]
 

Definition at line 183 of file sdet_grid_finder.h.

vcl_vector<vsol_line_2d_sptr> sdet_grid_finder::group1_ [protected]
 

Definition at line 184 of file sdet_grid_finder.h.

bool sdet_grid_finder::groups_valid_ [protected]
 

members.

Definition at line 171 of file sdet_grid_finder.h.

vgl_h_matrix_2d<double> sdet_grid_finder::homography_ [protected]
 

Definition at line 196 of file sdet_grid_finder.h.

bool sdet_grid_finder::homography_valid_ [protected]
 

Definition at line 175 of file sdet_grid_finder.h.

bsol_hough_line_index_sptr sdet_grid_finder::index_ [protected]
 

Definition at line 187 of file sdet_grid_finder.h.

vcl_vector<vsol_line_2d_sptr> sdet_grid_finder::lines_ [protected]
 

Definition at line 178 of file sdet_grid_finder.h.

vcl_vector<vsol_line_2d_sptr> sdet_grid_finder::matched_lines_ [protected]
 

Definition at line 180 of file sdet_grid_finder.h.

int sdet_grid_finder_params::n_lines_x_ [inherited]
 

number of horizontal grid lines

Definition at line 49 of file sdet_grid_finder_params.h.

int sdet_grid_finder_params::n_lines_y_ [inherited]
 

number of vertical grid lines

Definition at line 50 of file sdet_grid_finder_params.h.

vgl_h_matrix_2d<double> sdet_grid_finder::projective_homography_ [protected]
 

Definition at line 194 of file sdet_grid_finder.h.

bool sdet_grid_finder::projective_homography_valid_ [protected]
 

Definition at line 173 of file sdet_grid_finder.h.

double sdet_grid_finder_params::spacing_ [inherited]
 

spacing between lines

Definition at line 51 of file sdet_grid_finder_params.h.

int sdet_grid_finder_params::thresh_ [inherited]
 

bin threshold for dominant orientation groups

Definition at line 52 of file sdet_grid_finder_params.h.

bool sdet_grid_finder::vanishing_points_valid_ [protected]
 

Definition at line 172 of file sdet_grid_finder.h.

bool sdet_grid_finder_params::verbose_ [inherited]
 

print informative debug output

Definition at line 54 of file sdet_grid_finder_params.h.

vgl_homg_point_2d<double> sdet_grid_finder::vp0_ [protected]
 

Definition at line 192 of file sdet_grid_finder.h.

vgl_homg_point_2d<double> sdet_grid_finder::vp90_ [protected]
 

Definition at line 193 of file sdet_grid_finder.h.

float sdet_grid_finder::xmax_ [protected]
 

Definition at line 176 of file sdet_grid_finder.h.

float sdet_grid_finder::ymax_ [protected]
 

Definition at line 177 of file sdet_grid_finder.h.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 14:52:46 2008 for contrib/brl/bseg/sdet by  doxygen 1.4.4