KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
kjb::Line_segment_set Class Reference

Class to manipulate a set of line segments. More...

#include <line_segment_set.h>

Inheritance diagram for kjb::Line_segment_set:
kjb::Readable kjb::Writeable

Public Member Functions

 Line_segment_set ()
 
 Line_segment_set (const std::vector< Line_segment > &isegments)
 
 Line_segment_set (std::istream &in)
 
 Line_segment_set (const char *file_name)
 
 Line_segment_set (const Line_segment_set &src)
 
Line_segment_setoperator= (const Line_segment_set &iseg)
 
 ~Line_segment_set ()
 
void read_from_Kovesi_format (const std::string path_to_file)
 
void read_from_Kovesi_formatb (const std::string path_to_file)
 
const std::vector< Line_segment > & get_segments ()
 Returns a vector containing the fitted line segments. More...
 
unsigned int size () const
 Returns the number of segments in this set. More...
 
void add_segment (const Line_segment &isegment)
 Adds a line segment to this collection. More...
 
const Line_segmentget_segment (unsigned int i) const
 returns the ith fitted line segment 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)
 Reads this Edge_segment_set from an input stream. More...
 
void write (std::ostream &out) const
 Writes this Edge_segment_set to an output stream. More...
 
void read (const char *fname)
 Reads this Edge_segment_set from an input file. More...
 
void write (const char *fname) const
 Writes this Edge_segment_set to a file. More...
 
kjb::Edge_setconvert_to_edge_set (unsigned int num_rows, unsigned int num_cols)
 
void remove_frame_segments (unsigned int num_rows, unsigned int num_cols)
 
- 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...
 

Detailed Description

Class to manipulate a set of line segments.

Constructor & Destructor Documentation

kjb::Line_segment_set::Line_segment_set ( )
inline
kjb::Line_segment_set::Line_segment_set ( const std::vector< Line_segment > &  isegments)
inline
kjb::Line_segment_set::Line_segment_set ( std::istream &  in)
inline
kjb::Line_segment_set::Line_segment_set ( const char *  file_name)
inline
kjb::Line_segment_set::Line_segment_set ( const Line_segment_set src)
inline
kjb::Line_segment_set::~Line_segment_set ( )
inline

Member Function Documentation

void kjb::Line_segment_set::add_segment ( const Line_segment isegment)
inline

Adds a line segment to this collection.

kjb::Edge_set * Line_segment_set::convert_to_edge_set ( unsigned int  num_rows,
unsigned int  num_cols 
)
void Line_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

Parameters
imgthe image
irthe red channel
igthe green channel
ibthe blue channel
widththe width of the segment to be drawn (in pixel)
const Line_segment& kjb::Line_segment_set::get_segment ( unsigned int  i) const
inline

returns the ith fitted line segment

const std::vector<Line_segment>& kjb::Line_segment_set::get_segments ( )
inline

Returns a vector containing the fitted line segments.

Line_segment_set& kjb::Line_segment_set::operator= ( const Line_segment_set iseg)
inline
void Line_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

Parameters
imgthe image
widththe width of the segment to be drawn (in pixel)
void Line_segment_set::read ( std::istream &  in)
virtual

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

Parameters
edge_setset of edges fitted to the line segments to be read
inthe input stream to read this edge segment set from

Implements kjb::Readable.

void kjb::Line_segment_set::read ( const char *  fname)
inlinevirtual

Reads this Edge_segment_set from an input file.

Reimplemented from kjb::Readable.

void Line_segment_set::read_from_Kovesi_format ( const std::string  path_to_file)
void Line_segment_set::read_from_Kovesi_formatb ( const std::string  path_to_file)
void Line_segment_set::remove_frame_segments ( unsigned int  num_rows,
unsigned int  num_cols 
)
unsigned int kjb::Line_segment_set::size ( ) const
inline

Returns the number of segments in this set.

void Line_segment_set::write ( std::ostream &  out) const
virtual

Writes this Edge_segment_set to an output stream.

Implements kjb::Writeable.

void kjb::Line_segment_set::write ( const char *  fname) const
inlinevirtual

Writes this Edge_segment_set to a file.

Reimplemented from kjb::Writeable.


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