Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
sdet_grid_finder Class Reference

#include <sdet_grid_finder.h>

Inheritance diagram for sdet_grid_finder:
Inheritance graph
[legend]

List of all members.

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 ()
void set_line_length_threshold (double length)
bool get_grid_points (vcl_vector< double > &image_x, vcl_vector< double > &image_y)
 get all grid corner points, in column-major order.
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_
vcl_vector< double > image_x_
 grid corner point coordinates in the image.
vcl_vector< double > image_y_
double length_threshold_
 minimum length of line segments used to estimate the vanishing point.

Friends

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

Detailed Description

Definition at line 94 of file sdet_grid_finder.h.


Member Enumeration Documentation

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 324 of file sdet_grid_finder.cxx.

sdet_grid_finder::~sdet_grid_finder ( )

Default Destructor.

Definition at line 337 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.

Check grid match by verifying image intensity values within grid squares.

Definition at line 1485 of file sdet_grid_finder.cxx.

void sdet_grid_finder::clear ( )

Clear internal storage.

Definition at line 1475 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::compute_affine_homography ( ) [protected]

Definition at line 709 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::compute_homography ( )

Definition at line 1232 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 922 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 1091 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 537 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::compute_vanishing_points ( ) [protected]

vanishing points of the grid lines.

Definition at line 502 of file sdet_grid_finder.cxx.

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

Definition at line 1284 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 1369 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 1332 of file sdet_grid_finder.cxx.

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

Definition at line 1324 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::get_grid_points ( vcl_vector< double > &  image_x,
vcl_vector< double > &  image_y 
)

get all grid corner points, in column-major order.

Definition at line 1291 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 1350 of file sdet_grid_finder.cxx.

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

Definition at line 1340 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 1565 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 427 of file sdet_grid_finder.cxx.

bool sdet_grid_finder::init_output_file ( vcl_ofstream &  outstream)

write transformed grid points to a file.

initialize and output file. The file will be in the format taken by.

the zhang calibration routine located in bmvl/bcal

Definition at line 1411 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 530 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 641 of file sdet_grid_finder.cxx.

void sdet_grid_finder::set_line_length_threshold ( double  length) [inline]

Definition at line 129 of file sdet_grid_finder.h.

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.

Set the edges to be processed.

Definition at line 389 of file sdet_grid_finder.cxx.

void sdet_grid_finder::set_verbose ( ) [inline]

Definition at line 127 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 1449 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.

Transform a vsol line using the point transform.

Definition at line 1269 of file sdet_grid_finder.cxx.

void sdet_grid_finder::unset_verbose ( ) [inline]

Definition at line 128 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 1427 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

Definition at line 201 of file sdet_grid_finder.h.

Definition at line 180 of file sdet_grid_finder.h.

Definition at line 191 of file sdet_grid_finder.h.

Definition at line 192 of file sdet_grid_finder.h.

angle tolerance for a dominant group

Definition at line 62 of file sdet_grid_finder_params.h.

Definition at line 196 of file sdet_grid_finder.h.

Definition at line 197 of file sdet_grid_finder.h.

Definition at line 188 of file sdet_grid_finder.h.

Definition at line 187 of file sdet_grid_finder.h.

general purpose debug state

Definition at line 64 of file sdet_grid_finder_params.h.

Definition at line 185 of file sdet_grid_finder.h.

Definition at line 189 of file sdet_grid_finder.h.

Definition at line 190 of file sdet_grid_finder.h.

members.

Definition at line 177 of file sdet_grid_finder.h.

Definition at line 202 of file sdet_grid_finder.h.

Definition at line 181 of file sdet_grid_finder.h.

vcl_vector<double> sdet_grid_finder::image_x_ [protected]

grid corner point coordinates in the image.

Definition at line 205 of file sdet_grid_finder.h.

vcl_vector<double> sdet_grid_finder::image_y_ [protected]

Definition at line 206 of file sdet_grid_finder.h.

Definition at line 193 of file sdet_grid_finder.h.

minimum length of line segments used to estimate the vanishing point.

Use to ignore short line segments, which are generally less reliable.

Definition at line 211 of file sdet_grid_finder.h.

Definition at line 184 of file sdet_grid_finder.h.

Definition at line 186 of file sdet_grid_finder.h.

number of horizontal grid lines

Definition at line 58 of file sdet_grid_finder_params.h.

number of vertical grid lines

Definition at line 59 of file sdet_grid_finder_params.h.

Definition at line 200 of file sdet_grid_finder.h.

Definition at line 179 of file sdet_grid_finder.h.

spacing between lines

Definition at line 60 of file sdet_grid_finder_params.h.

bin threshold for dominant orientation groups

Definition at line 61 of file sdet_grid_finder_params.h.

Definition at line 178 of file sdet_grid_finder.h.

print informative debug output

Definition at line 63 of file sdet_grid_finder_params.h.

Definition at line 198 of file sdet_grid_finder.h.

Definition at line 199 of file sdet_grid_finder.h.

float sdet_grid_finder::xmax_ [protected]

Definition at line 182 of file sdet_grid_finder.h.

float sdet_grid_finder::ymax_ [protected]

Definition at line 183 of file sdet_grid_finder.h.


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