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

#include <edge.h>

Public Member Functions

 Edge_set ()
 
 Edge_set (kjb_c::Edge_set *in)
 Constructs an Edge_set by reading it from an input stream. More...
 
 Edge_set (const char *fname)
 Constructs an Edge_set by reading it from an input file. More...
 
 Edge_set (const std::string &fname)
 Constructs an Edge_set by reading it from an input file. More...
 
 Edge_set (const Edge_set &edge_in)
 
 Edge_set (const std::vector< kjb_c::Edge_point > &edge_pts, int num_rows_in, int num_cols_in)
 
 ~Edge_set ()
 
Edge_setoperator= (const Edge_set &other)
 
kjb_c::Edge_point & operator() (size_t edge_num, size_t point_num)
 
const kjb_c::Edge_point & operator() (size_t edge_num, size_t point_num) const
 
void swap (Edge_set &other)
 Swaps the content of this edgeset with the edgeset provided in input. More...
 
kjb_c::Edge_point & operator[] (size_t i)
 
const kjb_c::Edge_point & operator[] (size_t i) const
 
size_t num_edges () const
 
size_t size () const
 
Edge get_edge (unsigned int i) const
 returns the ith edge More...
 
void set_edge_set (kjb_c::Edge_set *iedge_set)
 clear the previous edge set and makes this class point to the input c edge set More...
 
size_t num_rows () const
 returns the number of rows in the image the edges were detected from More...
 
size_t get_num_rows () const
 alias of num_rows() to comply with other KJB dimensioned objects. More...
 
size_t num_cols () const
 returns the number of columns in the image the edges were detected from More...
 
size_t get_num_cols () const
 alias of num_cols() to comply with other KJB dimensioned objects. More...
 
size_t edge_length (size_t i_edge) const
 
size_t get_total_edge_points () const
 
void remove_short_edges (uint32_t min_length)
 Removes from the edge set all the edges whose length is shorter than min_length. More...
 
unsigned int find_index (const kjb::Edge &iedge) const
 Finds the index where the Edge pointed by iedge is stored in the edge_set. Notice that this is based on pointers (the pointer address is compared, not the edge content) More...
 
void remove_edge (unsigned int iindex)
 Removes the edge at index edge_id. More...
 
void break_edges_at_corners (float thresh, uint32_t num_avg)
 For each edge, it finds the edge point with the largest gradient difference on either side, breaks the edge, and recurses on the two newly created edges. More...
 
void sample_edge_set (float p)
 Randomly samples a subset of edge points from this set. More...
 
void draw_edge (Image &img, float r, float g, float b, unsigned int edge_index) const
 draws the edge with index edge_index onto the input image, using color (r,g,b). This function expects color values between 0 and 255 More...
 
void randomly_color_edge (Image &img, unsigned int edge_index) const
 draws the edge with index edge_index onto the input image, using a random color More...
 
void draw (Image &img, float r, float g, float b) const
 draws all the edges onto the input image, using color (r,g,b). This function expects color values between 0 and 255 More...
 
void randomly_color (Image &img)
 draws all the edges onto the input image, using color (r,g,b). Each edge is drawn using a different random color More...
 
void save (const char *fname) const
 saves this edge set on a file More...
 
void load (const char *fname)
 loads this edge set from a file More...
 
void write (const char *fname) const
 writes this edge set to a file More...
 
void read (const char *fname)
 reads this edge set from a file More...
 
bool is_edge_set_consistenct ()
 For debug purposes, checks that all the c++ wrappers are consistent with the underlying c structures. More...
 
const kjb_c::Edge_set * c_ptr () const
 Returns a const pointer to the underlying c structure. More...
 

Detailed Description

wraps the c structure Edge_set. The class will clean up the memory allocated for the underlying c structure upon destruction

Constructor & Destructor Documentation

kjb::Edge_set::Edge_set ( )
inline
kjb::Edge_set::Edge_set ( kjb_c::Edge_set *  in)
inline

Constructs an Edge_set by reading it from an input stream.

kjb::Edge_set::Edge_set ( const char *  fname)
inline

Constructs an Edge_set by reading it from an input file.

kjb::Edge_set::Edge_set ( const std::string &  fname)
inline

Constructs an Edge_set by reading it from an input file.

kjb::Edge_set::Edge_set ( const Edge_set edge_in)
inline
kjb::Edge_set::Edge_set ( const std::vector< kjb_c::Edge_point > &  edge_pts,
int  num_rows_in,
int  num_cols_in 
)
inline

Construct an edge set from a vector of independent edge points. The result will be an edge set with a single edge, containing all the edge points.

kjb::Edge_set::~Edge_set ( )
inline

Member Function Documentation

void kjb::Edge_set::break_edges_at_corners ( float  thresh,
uint32_t  num_avg 
)
inline

For each edge, it finds the edge point with the largest gradient difference on either side, breaks the edge, and recurses on the two newly created edges.

Parameters
edgesEdge set to break apart.
iThe index in the edge set to recurse on.
threshIf the dot product of the averaged vectors is less than this threshold, the edge is broken.
num_avgNumber of gradient vectors to average into one when computing the dot product.
const kjb_c::Edge_set* kjb::Edge_set::c_ptr ( ) const
inline

Returns a const pointer to the underlying c structure.

void kjb::Edge_set::draw ( Image img,
float  r,
float  g,
float  b 
) const
inline

draws all the edges onto the input image, using color (r,g,b). This function expects color values between 0 and 255

void kjb::Edge_set::draw_edge ( Image img,
float  r,
float  g,
float  b,
unsigned int  edge_index 
) const
inline

draws the edge with index edge_index onto the input image, using color (r,g,b). This function expects color values between 0 and 255

size_t kjb::Edge_set::edge_length ( size_t  i_edge) const
inline

number of edge points in edge i

unsigned int kjb::Edge_set::find_index ( const kjb::Edge iedge) const
inline

Finds the index where the Edge pointed by iedge is stored in the edge_set. Notice that this is based on pointers (the pointer address is compared, not the edge content)

Parameters
iedgethe edge to find in the edge_set
Edge kjb::Edge_set::get_edge ( unsigned int  i) const
inline

returns the ith edge

size_t kjb::Edge_set::get_num_cols ( ) const
inline

alias of num_cols() to comply with other KJB dimensioned objects.

size_t kjb::Edge_set::get_num_rows ( ) const
inline

alias of num_rows() to comply with other KJB dimensioned objects.

size_t kjb::Edge_set::get_total_edge_points ( ) const
inline

total number of edge points over all edges in set

bool kjb::Edge_set::is_edge_set_consistenct ( )

For debug purposes, checks that all the c++ wrappers are consistent with the underlying c structures.

For debug purposes, checks that all the c++ wrappers are consistent with the underlying c structures

void kjb::Edge_set::load ( const char *  fname)
inline

loads this edge set from a file

size_t kjb::Edge_set::num_cols ( ) const
inline

returns the number of columns in the image the edges were detected from

size_t kjb::Edge_set::num_edges ( ) const
inline

number of edges in set

size_t kjb::Edge_set::num_rows ( ) const
inline

returns the number of rows in the image the edges were detected from

kjb_c::Edge_point& kjb::Edge_set::operator() ( size_t  edge_num,
size_t  point_num 
)
inline

Access edge points by edge index

const kjb_c::Edge_point& kjb::Edge_set::operator() ( size_t  edge_num,
size_t  point_num 
) const
inline

Access edge points by edge index

Edge_set& kjb::Edge_set::operator= ( const Edge_set other)
inline
kjb_c::Edge_point& kjb::Edge_set::operator[] ( size_t  i)
inline

Access edge points sequentially, with index 0 being the first point of the first edge

const kjb_c::Edge_point& kjb::Edge_set::operator[] ( size_t  i) const
inline

Access edge points sequentially, with index 0 being the first point of the first edge

void kjb::Edge_set::randomly_color ( Image img)
inline

draws all the edges onto the input image, using color (r,g,b). Each edge is drawn using a different random color

void kjb::Edge_set::randomly_color_edge ( Image img,
unsigned int  edge_index 
) const
inline

draws the edge with index edge_index onto the input image, using a random color

void kjb::Edge_set::read ( const char *  fname)
inline

reads this edge set from a file

void kjb::Edge_set::remove_edge ( unsigned int  iindex)
inline

Removes the edge at index edge_id.

Parameters
iindexthe index of the edge to remove
void kjb::Edge_set::remove_short_edges ( uint32_t  min_length)
inline

Removes from the edge set all the edges whose length is shorter than min_length.

void kjb::Edge_set::sample_edge_set ( float  p)
inline

Randomly samples a subset of edge points from this set.

void kjb::Edge_set::save ( const char *  fname) const
inline

saves this edge set on a file

void kjb::Edge_set::set_edge_set ( kjb_c::Edge_set *  iedge_set)
inline

clear the previous edge set and makes this class point to the input c edge set

size_t kjb::Edge_set::size ( ) const
inline

Alias of num_edges() to help comply with a random-access container concept

void kjb::Edge_set::swap ( Edge_set other)
inline

Swaps the content of this edgeset with the edgeset provided in input.

void kjb::Edge_set::write ( const char *  fname) const
inline

writes this edge set to a file


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