KJB
|
Class to manipulate a set of edge segments. More...
#include <line_segment_set.h>
Public Member Functions | |
Edge_segment_set () | |
Edge_segment_set (const std::vector< Edge_segment > &isegments) | |
Edge_segment_set (const kjb::Edge_set *edge_set, const std::vector< Line_segment > &isegments) | |
Edge_segment_set (const kjb::Edge_set *edge_set, bool use_num_pts_as_length=true) | |
Edge_segment_set (const kjb::Edge_set *edge_set, const char *filename) | |
Edge_segment_set (const kjb::Edge_set *edge_set, std::istream &in) | |
Edge_segment_set (const Edge_segment_set &src) | |
Edge_segment_set & | operator= (const Edge_segment_set &iseg) |
~Edge_segment_set () | |
void | init_from_edge_set (const kjb::Edge_set *edge_set, bool use_num_pts_as_length=true) |
const std::vector< Edge_segment > & | get_segments () |
unsigned int | size () const |
const Edge_segment & | get_segment (unsigned int i) const |
returns the ith fitted line segment More... | |
void | add_segment (const Edge_segment &isegment) |
Adds a line segment to this collection. More... | |
const kjb::Edge & | get_edge (unsigned int i) |
returns the ith collection of edge points the segments were fitted to More... | |
void | draw (kjb::Image &img, double ir, double ig, double ib, double width=1.0) const |
Draws this line segment set. More... | |
void | randomly_color (kjb::Image &img, double width=1.0) const |
Randomly colors this line segment set on an image. More... | |
void | read (std::istream &in, const kjb::Edge_set *edge_set) |
Reads this Edge_segment_set from an input stream. More... | |
void | read (const char *filename, const kjb::Edge_set *edge_set) |
Reads this Edge_segment_set from an input file. More... | |
void | read (std::istream &in) |
Reads this Edge_segment_set from an input stream. More... | |
void | read (const char *fname) |
Reads this Edge_segment_set from an input file. More... | |
void | write (std::ostream &out) const |
Writes this Edge_segment_set to an output stream. More... | |
void | write (const char *fname) const |
Writes this Edge_segment_set to a file. More... | |
void | remove_overlapping_segments (kjb::Edge_set &edges, double collinear_threshold=0.12, double overlapping_threshold=10) |
In case there are multiple roughly collinear edge segments, only the longest one is kept. This function is mostly for debug purposes. More... | |
void | remove_non_straight_segments (kjb::Edge_set &edges, double threshold) |
void | remove_frame_segments (unsigned int num_rows, unsigned int num_cols, kjb::Edge_set &edges) |
kjb::Edge_set * | convert_to_edge_set (unsigned int num_rows, unsigned int num_cols) |
void | find_vertical_segment_pairs (std::vector< Segment_pair > &pairs, int num_rows) const |
Public Member Functions inherited from kjb::Readable | |
virtual | ~Readable () |
Deletes this Readable. More... | |
Public Member Functions inherited from kjb::Writeable | |
virtual | ~Writeable () |
Deletes this Writeable. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from kjb::Readable | |
static const char * | read_field_value (std::istream &in, const char *field_name, char *field_buf, size_t buf_len, char separator=':') |
Reads a line off in into a buffer and returns a pointer to the field value in the buffer. More... | |
static const char * | read_field_value (std::istream &in, const char *field_name, char separator=':') |
Reads a line off in into an internal buffer and returns a pointer to the field value in the buffer. More... | |
Class to manipulate a set of edge segments.
|
inline |
|
inline |
Edge_segment_set::Edge_segment_set | ( | const kjb::Edge_set * | edge_set, |
const std::vector< Line_segment > & | isegments | ||
) |
Edge_segment_set::Edge_segment_set | ( | const kjb::Edge_set * | edge_set, |
bool | use_num_pts_as_length = true |
||
) |
Constructs a fitted_edge_segment_set from a set of detected edges
edge_set | the detected edges |
Edge_segment_set::Edge_segment_set | ( | const kjb::Edge_set * | edge_set, |
const char * | filename | ||
) |
Constructs an edge segment set by reading it from an input stream. The input edge_set is necessary to bind the fitted segments to the original detected edges
edge_set | set of edges fitted to the line segments to be read |
filename | the input file to read this edge segment set from |
Edge_segment_set::Edge_segment_set | ( | const kjb::Edge_set * | edge_set, |
std::istream & | in | ||
) |
Constructs an edge segment set by reading it from an input stream. The input edge_set is necessary to bind the fitted segments to the original detected edges
edge_set | set of edges fitted to the line segments to be read |
in | the input stream to read this edge segment set from |
|
inline |
|
inline |
|
inline |
Adds a line segment to this collection.
kjb::Edge_set * Edge_segment_set::convert_to_edge_set | ( | unsigned int | num_rows, |
unsigned int | num_cols | ||
) |
void Edge_segment_set::draw | ( | kjb::Image & | img, |
double | ir, | ||
double | ig, | ||
double | ib, | ||
double | width = 1.0 |
||
) | const |
Draws this line segment set.
Draws the line segment on an image
img | the image |
ir | the red channel |
ig | the green channel |
ib | the blue channel |
width | the width of the segment to be drawn (in pixel) |
void Edge_segment_set::find_vertical_segment_pairs | ( | std::vector< Segment_pair > & | pairs, |
int | num_rows | ||
) | const |
|
inline |
returns the ith collection of edge points the segments were fitted to
|
inline |
returns the ith fitted line segment
|
inline |
Returns a vector containing the fitted line segments
|
inline |
|
inline |
void Edge_segment_set::randomly_color | ( | kjb::Image & | img, |
double | width = 1.0 |
||
) | const |
Randomly colors this line segment set on an image.
Draws the line segment set using a different random color for each segment
img | the image |
width | the width of the segment to be drawn (in pixel) |
void Edge_segment_set::read | ( | std::istream & | in, |
const kjb::Edge_set * | edge_set | ||
) |
Reads this Edge_segment_set from an input stream.
Read an edge segment set from an input stream. The input edge_set is necessary to bind the fitted segments to the original detected edges
edge_set | set of edges fitted to the line segments to be read |
in | the input stream to read this edge segment set from |
void Edge_segment_set::read | ( | const char * | filename, |
const kjb::Edge_set * | edge_set | ||
) |
Reads this Edge_segment_set from an input file.
Read an edge segment set from an input file. The input edge_set is necessary to bind the fitted segments to the original detected edges
edge_set | set of edges fitted to the line segments to be read |
in | the input file to read this edge segment set from |
|
virtual |
Reads this Edge_segment_set from an input stream.
Reads this Edge_segment_set from an input stream. Not implemented
Implements kjb::Readable.
|
inlinevirtual |
Reads this Edge_segment_set from an input file.
Reimplemented from kjb::Readable.
void Edge_segment_set::remove_frame_segments | ( | unsigned int | num_rows, |
unsigned int | num_cols, | ||
kjb::Edge_set & | edges | ||
) |
In case there are multiple roughly collinear edge segments, only the longest one is kept. This function is mostly for debug purposes
edges | The edge_set this edge_segment_set was built from |
void Edge_segment_set::remove_non_straight_segments | ( | kjb::Edge_set & | edges, |
double | threshold | ||
) |
void Edge_segment_set::remove_overlapping_segments | ( | kjb::Edge_set & | edges, |
double | collinear_threshold = 0.12 , |
||
double | overlapping_threshold = 10 |
||
) |
In case there are multiple roughly collinear edge segments, only the longest one is kept. This function is mostly for debug purposes.
In case there are multiple roughly collinear edge segments, only the longest one is kept. This function is mostly for debug purposes
edges | The edge_set this edge_segment_set was built from |
|
inline |
Returns the number of segments in this set
|
virtual |
Writes this Edge_segment_set to an output stream.
Implements kjb::Writeable.
|
inlinevirtual |
Writes this Edge_segment_set to a file.
Reimplemented from kjb::Writeable.