#include <gevd_clean_edgels.h>
Public Member Functions | |
gevd_clean_edgels () | |
Default Constructor. | |
~gevd_clean_edgels () | |
Default Destructor. | |
void | DoCleanEdgelChains (vcl_vector< vtol_edge_2d_sptr > &in_edgels, vcl_vector< vtol_edge_2d_sptr > &out_edgels, int steps=10) |
The main process method. The input edgel group is filtered to remove bridges and short edges. | |
void | JumpGaps () |
Jump gaps by finding the nearest edge to a vertex which is not incident on the vertex. | |
void | RemoveBridges () |
A bridge is an edge or a sequence of edges which is not closed. | |
void | DeleteShortEdges () |
Remove all edges which are shorter than two pixels. | |
void | FixDefficientEdgels () |
Check if the number of edgels is <=2. | |
void | RemoveJaggies () |
The VD edgedetector produces wild jaggies in the contour from time to time. | |
void | RemoveLoops () |
Removal of edges can also produce loops. Short loops should be removed. | |
Protected Member Functions | |
void | print_protection () |
void | detect_similar_edges (vcl_vector< vtol_edge_2d_sptr > &common_edges, float tolerance, vcl_vector< vtol_edge_2d_sptr > &deleted_edges) |
Merge edges which have all edgels within a given tolerance. | |
void | remove_similar_edges (vtol_vertex_2d *&v1, vcl_vector< vtol_edge_2d_sptr > &deleted_edges) |
Find similar edges between v1 and some other vertex v and remove them. | |
bool | edge_exists (vtol_vertex_2d_sptr v1, vtol_vertex_2d_sptr v2, vcl_vector< vtol_edge_2d_sptr > &intersection) |
Find if an edge already exists between the given vertices. | |
void | remove_connected_edges (vtol_vertex_2d *v, vcl_vector< vtol_edge_2d_sptr > &edges) |
Remove edges which are already connected to the given vertex. | |
bool | closest_vertex (vtol_edge_2d_sptr e, vsol_point_2d_sptr p, float radius, vtol_vertex_2d_sptr &v) |
Find the closest vertex within a given radius on a given edge. | |
bool | split_edge (vtol_edge_2d_sptr e, vtol_vertex_2d_sptr v, vtol_edge_2d_sptr &e1, vtol_edge_2d_sptr &e2) |
Split an edge at a vertex which is assumed geometrically to lie on the edge. | |
Protected Attributes | |
vcl_vector< vtol_edge_2d_sptr > * | out_edgels_ |
Definition at line 46 of file gevd_clean_edgels.h.
gevd_clean_edgels::gevd_clean_edgels | ( | ) |
Default Constructor.
Definition at line 71 of file gevd_clean_edgels.cxx.
gevd_clean_edgels::~gevd_clean_edgels | ( | ) |
Default Destructor.
Definition at line 78 of file gevd_clean_edgels.cxx.
bool gevd_clean_edgels::closest_vertex | ( | vtol_edge_2d_sptr | e, |
vsol_point_2d_sptr | p, | ||
float | radius, | ||
vtol_vertex_2d_sptr & | v | ||
) | [protected] |
Find the closest vertex within a given radius on a given edge.
If one of the edge vertices is within the radius, then choose it. Otherwise return a vertex which lies on, and interior to, the edge. Original compared end vertex distances to radius, now with actual jump span - JLM Sept. 99
Definition at line 219 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::DeleteShortEdges | ( | ) |
Remove all edges which are shorter than two pixels.
That is, e.V1() and e.v2().ptr() are closer than three pixels along both image axes, and no edgel in the vtol_edge_2d is farther than two pixels from vertices. The edge is removed and replaced by a single vertex at the average location.
Definition at line 438 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::detect_similar_edges | ( | vcl_vector< vtol_edge_2d_sptr > & | common_edges, |
float | tolerance, | ||
vcl_vector< vtol_edge_2d_sptr > & | deleted_edges | ||
) | [protected] |
Merge edges which have all edgels within a given tolerance.
Definition at line 112 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::DoCleanEdgelChains | ( | vcl_vector< vtol_edge_2d_sptr > & | in_edgels, |
vcl_vector< vtol_edge_2d_sptr > & | out_edgels, | ||
int | steps = 10 |
||
) |
The main process method. The input edgel group is filtered to remove bridges and short edges.
Definition at line 84 of file gevd_clean_edgels.cxx.
bool gevd_clean_edgels::edge_exists | ( | vtol_vertex_2d_sptr | v1, |
vtol_vertex_2d_sptr | v2, | ||
vcl_vector< vtol_edge_2d_sptr > & | intersection | ||
) | [protected] |
Find if an edge already exists between the given vertices.
Definition at line 176 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::FixDefficientEdgels | ( | ) |
Check if the number of edgels is <=2.
If so, replace the vdgl_digital_curve_sptr with one formed from a straight line between the endpoints.
Definition at line 600 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::JumpGaps | ( | ) |
Jump gaps by finding the nearest edge to a vertex which is not incident on the vertex.
If some point on the digital curve of edge is within a radius of the vertex, then jump across.
nnn=0;
Definition at line 340 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::print_protection | ( | ) | [protected] |
Definition at line 58 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::remove_connected_edges | ( | vtol_vertex_2d * | v, |
vcl_vector< vtol_edge_2d_sptr > & | edges | ||
) | [protected] |
Remove edges which are already connected to the given vertex.
Definition at line 200 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::remove_similar_edges | ( | vtol_vertex_2d *& | v1, |
vcl_vector< vtol_edge_2d_sptr > & | deleted_edges | ||
) | [protected] |
Find similar edges between v1 and some other vertex v and remove them.
In this case, similar means all edgels of the similar edges lie within a given pixel tolerance from each other.
Definition at line 145 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::RemoveBridges | ( | ) |
A bridge is an edge or a sequence of edges which is not closed.
In this approach, a set of vertices with order one (one incident edge) is found and the associated edges are deleted. The process is repeated until no more vertices of order one are found.
Definition at line 519 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::RemoveJaggies | ( | ) |
The VD edgedetector produces wild jaggies in the contour from time to time.
This function "smooths' the digital chains by removing sharp adjacent excursions.
Definition at line 636 of file gevd_clean_edgels.cxx.
void gevd_clean_edgels::RemoveLoops | ( | ) |
Removal of edges can also produce loops. Short loops should be removed.
Definition at line 681 of file gevd_clean_edgels.cxx.
bool gevd_clean_edgels::split_edge | ( | vtol_edge_2d_sptr | e, |
vtol_vertex_2d_sptr | v, | ||
vtol_edge_2d_sptr & | e1, | ||
vtol_edge_2d_sptr & | e2 | ||
) | [protected] |
Split an edge at a vertex which is assumed geometrically to lie on the edge.
Definition at line 255 of file gevd_clean_edgels.cxx.
vcl_vector<vtol_edge_2d_sptr>* gevd_clean_edgels::out_edgels_ [protected] |
Definition at line 67 of file gevd_clean_edgels.h.