#include <bsol_hough_line_index.h>
Public Member Functions | |
bsol_hough_line_index (const int r_dimension, const int theta_dimension) | |
Simple Constructor. | |
bsol_hough_line_index (const float x0, const float y0, const float xsize, const float ysize, const float angle_range=180.0, const float angle_increment=5.0) | |
Constructors from given bounds. | |
bsol_hough_line_index (vbl_bounding_box< double, 2 > const &box, const float angle_range=180.0, const float angle_increment=5.0) | |
bsol_hough_line_index (bsol_hough_line_index const &i) | |
~bsol_hough_line_index () | |
Destructor. | |
float | getxsize_ () const |
float | getysize_ () const |
int | get_r_dimension () const |
int | get_theta_dimension () const |
void | array_loc (vsol_line_2d_sptr const &line, float &r, float &theta) |
Get the bsol_hough_line_index array location of a line segment. | |
void | array_loc (vsol_line_2d_sptr const &line, int &r, int &theta) |
Compute the bsol_hough_line_index array locations corresponding to a line. | |
int | trans_loc (const int transx, const int transy, const int ry, const int theta) |
r Location for a translated line position. | |
int | count (const int r, const int theta) |
Get line count at a particular location in bsol_hough_line_index space. | |
bool | index (vsol_line_2d_sptr const &line) |
Insert a new line into the index. | |
bool | index_new (vsol_line_2d_sptr const &line) |
Insert a unique new line into the index. | |
bool | find (vsol_line_2d_sptr const &line) |
find if a line is in the index. | |
bool | remove (vsol_line_2d_sptr const &line) |
remove a line. | |
void | lines_at_index (const int r, const int theta, vcl_vector< vsol_line_2d_sptr > &lines) |
Lines in a line index bin at integer r and theta bin indices. | |
vcl_vector< vsol_line_2d_sptr > | lines_at_index (const int r, const int theta) |
Return a list of vsol_line_2d_sptr(s) which are at the index location. | |
void | lines_in_interval (vsol_line_2d_sptr const &l, const float r_dist, const float theta_dist, vcl_vector< vsol_line_2d_sptr > &lines) |
Lines in a tolerance box around the r and theta of a given line. | |
vcl_vector< vsol_line_2d_sptr > | lines_in_interval (vsol_line_2d_sptr const &l, const float r_dist, const float theta_dist) |
Return a list of vsol_line_2d_sptr(s) which are within a distance(radius) of the r,theta values of a given line. | |
void | parallel_lines (const float angle, const float angle_dist, vcl_vector< vsol_line_2d_sptr > &lines) |
Lines parallel to a given angle in degrees. | |
vcl_vector< vsol_line_2d_sptr > | parallel_lines (const float angle, const float angle_dist) |
Return a list of vsol_line_2d_sptr(s) which are within angle_dist of a given angle. | |
void | lines_at_angle (vsol_line_2d_sptr const &l, const float angle, const float angle_dist, vcl_vector< vsol_line_2d_sptr > &lines) |
Lines at an angle to a given line (angle is in degrees). | |
vcl_vector< vsol_line_2d_sptr > | lines_at_angle (vsol_line_2d_sptr const &l, const float angle, const float angle_dist) |
Return a new list of vsol_line_2d_sptr(s) which are oriented at an angle with respect to a given line. | |
void | parallel_lines (vsol_line_2d_sptr const &l, const float angle_dist, vcl_vector< vsol_line_2d_sptr > &lines) |
Lines parallel to a given line with angle_dist in degrees. | |
vcl_vector< vsol_line_2d_sptr > | parallel_lines (vsol_line_2d_sptr const &l, const float angle_dist) |
Return a list of vsol_line_2d_sptr(s) which are within angle_dist of the orientation of a given line. | |
vcl_vector< int > | angle_histogram () |
Angle histogram - projection of hough space onto theta axis. | |
int | dominant_directions (const int thresh, const float angle_tol, vcl_vector< int > &dirs) |
Dominant line directions found by non-maximum suppression above thresh. | |
int | dominant_line_groups (const int thresh, const float angle_tol, vcl_vector< vcl_vector< vsol_line_2d_sptr > > &groups) |
Dominant parallel line groups. | |
vbl_array_2d< unsigned char > | get_hough_image () |
An image of the hough space. | |
void | clear_index () |
Clear the bsol_hough_line_index index space. | |
void | ref () |
void | unref () |
int | get_references () const |
bool | is_referenced () const |
Protected Member Functions | |
void | init (const int r_dimension, const int theta_dimension) |
Constructor Utility. | |
vcl_vector< int > | non_maximum_suppress (const int radius, vcl_vector< int > const &bins) |
Suppress values in the angle histogram which are not locally a maximum. | |
Private Attributes | |
float | xo_ |
X Origin of the Cartesian Space. | |
float | yo_ |
Y Origin of the Cartesian Space. | |
float | xsize_ |
Dimensions of the Cartesian space. | |
float | ysize_ |
float | angle_range_ |
Granularity of the line index. | |
float | angle_increment_ |
int | r_dim_ |
The dimensions of the index space. | |
int | th_dim_ |
vbl_array_2d< vcl_vector < vsol_line_2d_sptr > * > | index_ |
The index space for lines. An array of vectors of line indices. |
Definition at line 123 of file bsol_hough_line_index.h.
bsol_hough_line_index::bsol_hough_line_index | ( | const int | r_dimension, |
const int | theta_dimension | ||
) |
Simple Constructor.
Definition at line 42 of file bsol_hough_line_index.cxx.
bsol_hough_line_index::bsol_hough_line_index | ( | const float | x0, |
const float | y0, | ||
const float | xsize, | ||
const float | ysize, | ||
const float | angle_range = 180.0 , |
||
const float | angle_increment = 5.0 |
||
) |
Constructors from given bounds.
Definition at line 56 of file bsol_hough_line_index.cxx.
bsol_hough_line_index::bsol_hough_line_index | ( | vbl_bounding_box< double, 2 > const & | box, |
const float | angle_range = 180.0 , |
||
const float | angle_increment = 5.0 |
||
) |
Definition at line 78 of file bsol_hough_line_index.cxx.
bsol_hough_line_index::bsol_hough_line_index | ( | bsol_hough_line_index const & | i | ) | [inline] |
Definition at line 141 of file bsol_hough_line_index.h.
bsol_hough_line_index::~bsol_hough_line_index | ( | ) |
Destructor.
Definition at line 97 of file bsol_hough_line_index.cxx.
vcl_vector< int > bsol_hough_line_index::angle_histogram | ( | ) |
Angle histogram - projection of hough space onto theta axis.
Fill the angle histogram.
Definition at line 563 of file bsol_hough_line_index.cxx.
void bsol_hough_line_index::array_loc | ( | vsol_line_2d_sptr const & | line, |
float & | r, | ||
float & | theta | ||
) |
Get the bsol_hough_line_index array location of a line segment.
Compute the bsol_hough_line_index array locations corresponding to a line.
Definition at line 108 of file bsol_hough_line_index.cxx.
void bsol_hough_line_index::array_loc | ( | vsol_line_2d_sptr const & | line, |
int & | r, | ||
int & | theta | ||
) |
Compute the bsol_hough_line_index array locations corresponding to a line.
Definition at line 145 of file bsol_hough_line_index.cxx.
void bsol_hough_line_index::clear_index | ( | ) |
Clear the bsol_hough_line_index index space.
Definition at line 538 of file bsol_hough_line_index.cxx.
int bsol_hough_line_index::count | ( | const int | r, |
const int | theta | ||
) |
Get line count at a particular location in bsol_hough_line_index space.
Return the count at a given r and theta.
Definition at line 179 of file bsol_hough_line_index.cxx.
int bsol_hough_line_index::dominant_directions | ( | const int | thresh, |
const float | angle_tol, | ||
vcl_vector< int > & | dirs | ||
) |
Dominant line directions found by non-maximum suppression above thresh.
Find the dominant peaks in the direction histogram.
The output vector contains the theta indices of dominant direction peaks.
thresh | is the minimum number of lines in a valid peak. |
angle | tol is the width of the peak in degrees. |
Definition at line 735 of file bsol_hough_line_index.cxx.
int bsol_hough_line_index::dominant_line_groups | ( | const int | thresh, |
const float | angle_tol, | ||
vcl_vector< vcl_vector< vsol_line_2d_sptr > > & | groups | ||
) |
Dominant parallel line groups.
Get the dominant line groups in the hough index.
Sets of lines belonging to distinct orientations are returned.
Definition at line 753 of file bsol_hough_line_index.cxx.
bool bsol_hough_line_index::find | ( | vsol_line_2d_sptr const & | line | ) |
find if a line is in the index.
find if a line is in the array.
Definition at line 240 of file bsol_hough_line_index.cxx.
vbl_array_2d< unsigned char > bsol_hough_line_index::get_hough_image | ( | ) |
An image of the hough space.
An image of the hough index, useful for debugging applications that use this class.
Definition at line 774 of file bsol_hough_line_index.cxx.
int bsol_hough_line_index::get_r_dimension | ( | ) | const [inline] |
Definition at line 154 of file bsol_hough_line_index.h.
int bsol_hough_line_index::get_theta_dimension | ( | ) | const [inline] |
Definition at line 155 of file bsol_hough_line_index.h.
float bsol_hough_line_index::getxsize_ | ( | ) | const [inline] |
Definition at line 151 of file bsol_hough_line_index.h.
float bsol_hough_line_index::getysize_ | ( | ) | const [inline] |
Definition at line 152 of file bsol_hough_line_index.h.
bool bsol_hough_line_index::index | ( | vsol_line_2d_sptr const & | line | ) |
Insert a new line into the index.
Method to index into bsol_hough_line_index index given a vsol_line_2d_sptr.
The timestamp is not updated to facilitate lazy insertion of multiple items.
Definition at line 195 of file bsol_hough_line_index.cxx.
bool bsol_hough_line_index::index_new | ( | vsol_line_2d_sptr const & | line | ) |
Insert a unique new line into the index.
Method to index into bsol_hough_line_index index given a vsol_line_2d_sptr.
Only new vsol_line_2d_sptr pointers are added to the bin.
Definition at line 215 of file bsol_hough_line_index.cxx.
void bsol_hough_line_index::init | ( | const int | r_dimension, |
const int | theta_dimension | ||
) | [protected] |
Constructor Utility.
Definition at line 549 of file bsol_hough_line_index.cxx.
void bsol_hough_line_index::lines_at_angle | ( | vsol_line_2d_sptr const & | l, |
const float | angle, | ||
const float | angle_dist, | ||
vcl_vector< vsol_line_2d_sptr > & | lines | ||
) |
Lines at an angle to a given line (angle is in degrees).
Fill a list of vsol_line_2d_sptr(s) which are oriented at an angle with respect to a given line.
A specified angular tolerance can be given.
Definition at line 465 of file bsol_hough_line_index.cxx.
vcl_vector< vsol_line_2d_sptr > bsol_hough_line_index::lines_at_angle | ( | vsol_line_2d_sptr const & | l, |
const float | angle, | ||
const float | angle_dist | ||
) |
Return a new list of vsol_line_2d_sptr(s) which are oriented at an angle with respect to a given line.
A specified angular tolerance can be given.
Definition at line 486 of file bsol_hough_line_index.cxx.
void bsol_hough_line_index::lines_at_index | ( | const int | r, |
const int | theta, | ||
vcl_vector< vsol_line_2d_sptr > & | lines | ||
) |
Lines in a line index bin at integer r and theta bin indices.
Fill a vector of vsol_line_2d_sptr(s) which are at the index location.
Definition at line 274 of file bsol_hough_line_index.cxx.
vcl_vector< vsol_line_2d_sptr > bsol_hough_line_index::lines_at_index | ( | const int | r, |
const int | theta | ||
) |
Return a list of vsol_line_2d_sptr(s) which are at the index location.
Definition at line 294 of file bsol_hough_line_index.cxx.
void bsol_hough_line_index::lines_in_interval | ( | vsol_line_2d_sptr const & | l, |
const float | r_dist, | ||
const float | theta_dist, | ||
vcl_vector< vsol_line_2d_sptr > & | lines | ||
) |
Lines in a tolerance box around the r and theta of a given line.
Fill a list of vsol_line_2d_sptr(s) which are within a distance(radius) of the r,theta values of a given line.
r is in distance units and theta is in degrees.
Definition at line 307 of file bsol_hough_line_index.cxx.
vcl_vector< vsol_line_2d_sptr > bsol_hough_line_index::lines_in_interval | ( | vsol_line_2d_sptr const & | l, |
const float | r_dist, | ||
const float | theta_dist | ||
) |
Return a list of vsol_line_2d_sptr(s) which are within a distance(radius) of the r,theta values of a given line.
Definition at line 372 of file bsol_hough_line_index.cxx.
vcl_vector< int > bsol_hough_line_index::non_maximum_suppress | ( | const int | radius, |
vcl_vector< int > const & | bins | ||
) | [protected] |
Suppress values in the angle histogram which are not locally a maximum.
The neighborhood for computing the local maximum is [radius X radius], e.g. for radius =1 the neighborhood is [-X-], for radius = 2, the neighborhood is [--X--], etc.
Definition at line 694 of file bsol_hough_line_index.cxx.
void bsol_hough_line_index::parallel_lines | ( | const float | angle, |
const float | angle_dist, | ||
vcl_vector< vsol_line_2d_sptr > & | lines | ||
) |
Lines parallel to a given angle in degrees.
Fill a list of vsol_line_2d_sptr(s) which are within angle_dist of a given angle.
Definition at line 393 of file bsol_hough_line_index.cxx.
vcl_vector< vsol_line_2d_sptr > bsol_hough_line_index::parallel_lines | ( | const float | angle, |
const float | angle_dist | ||
) |
Return a list of vsol_line_2d_sptr(s) which are within angle_dist of a given angle.
Definition at line 450 of file bsol_hough_line_index.cxx.
void bsol_hough_line_index::parallel_lines | ( | vsol_line_2d_sptr const & | l, |
const float | angle_dist, | ||
vcl_vector< vsol_line_2d_sptr > & | lines | ||
) |
Lines parallel to a given line with angle_dist in degrees.
Fill a list of vsol_line_2d_sptr(s) which are within angle_dist of the orientation of a given line.
Definition at line 501 of file bsol_hough_line_index.cxx.
vcl_vector< vsol_line_2d_sptr > bsol_hough_line_index::parallel_lines | ( | vsol_line_2d_sptr const & | l, |
const float | angle_dist | ||
) |
Return a list of vsol_line_2d_sptr(s) which are within angle_dist of the orientation of a given line.
Definition at line 521 of file bsol_hough_line_index.cxx.
bool bsol_hough_line_index::remove | ( | vsol_line_2d_sptr const & | line | ) |
remove a line.
remove a line from the Hough index.
The timestamp is not updated to facilitate lazy insertion of multiple items. See vsol_line_2d_sptrGroup as an example.
Definition at line 253 of file bsol_hough_line_index.cxx.
int bsol_hough_line_index::trans_loc | ( | const int | transx, |
const int | transy, | ||
const int | ry, | ||
const int | theta | ||
) |
r Location for a translated line position.
Modify bsol_hough_line_index array R location under translation.
Definition at line 158 of file bsol_hough_line_index.cxx.
float bsol_hough_line_index::angle_increment_ [private] |
Definition at line 261 of file bsol_hough_line_index.h.
float bsol_hough_line_index::angle_range_ [private] |
Granularity of the line index.
Definition at line 260 of file bsol_hough_line_index.h.
vbl_array_2d<vcl_vector<vsol_line_2d_sptr>* > bsol_hough_line_index::index_ [private] |
The index space for lines. An array of vectors of line indices.
Definition at line 267 of file bsol_hough_line_index.h.
int bsol_hough_line_index::r_dim_ [private] |
The dimensions of the index space.
Definition at line 263 of file bsol_hough_line_index.h.
int bsol_hough_line_index::th_dim_ [private] |
Definition at line 264 of file bsol_hough_line_index.h.
float bsol_hough_line_index::xo_ [private] |
X Origin of the Cartesian Space.
Definition at line 254 of file bsol_hough_line_index.h.
float bsol_hough_line_index::xsize_ [private] |
Dimensions of the Cartesian space.
Definition at line 257 of file bsol_hough_line_index.h.
float bsol_hough_line_index::yo_ [private] |
Y Origin of the Cartesian Space.
Definition at line 255 of file bsol_hough_line_index.h.
float bsol_hough_line_index::ysize_ [private] |
Definition at line 258 of file bsol_hough_line_index.h.