17 #ifndef KJB_EDGE_CPP_EDGE_SEGMENT_H
18 #define KJB_EDGE_CPP_EDGE_SEGMENT_H
20 #include "edge/edge_base.h"
47 bool use_num_pts_as_length =
true
52 fit_to_edge_points_with_least_squares(iedge, use_num_pts_as_length);
62 least_squares_fitting_error = 0.0;
77 least_squares_fitting_error(src.least_squares_fitting_error),
78 strength(src.strength),
79 edge_pts(src.edge_pts)
85 least_squares_fitting_error = src.least_squares_fitting_error;
86 strength = src.strength;
87 edge_pts = src.edge_pts;
95 if(!Line_segment::operator==(edg))
99 if(fabs(strength - edg.strength) > FLT_EPSILON)
103 if( fabs(least_squares_fitting_error - edg.least_squares_fitting_error)
131 return least_squares_fitting_error;
141 void read(std::istream& in);
144 void write(std::ostream& out)
const;
154 double collinear_threshold = 0.12,
155 double overlapping_threshold = 10
164 edge_pts = iedge_pts;
174 void fit_to_edge_points_with_least_squares(
176 bool use_num_pts_as_length =
true
182 double least_squares_fitting_error;
191 std::ostream&
operator<<(std::ostream& out,
const Edge_segment& es);
Line_segment & operator=(const Line_segment &ls)
Assignment operator.
Definition: gr_line_segment.cpp:115
Definition: edge_segment.h:36
double get_strength() const
returns the average gradient magnitude of this edge
Definition: edge_segment.h:135
Edge_segment(const Edge_segment &src)
Definition: edge_segment.h:75
const kjb::Edge & get_edge()
returns the set of edge points this line segment was fit to
Definition: edge_segment.h:114
Edge_segment(const kjb::Edge &iedge, bool use_num_pts_as_length=true)
Definition: edge_segment.h:45
~Edge_segment()
Definition: edge_segment.h:91
kjb::Edge_point get_edge_point(unsigned int i)
Definition: edge_segment.h:120
friend std::ostream & operator<<(std::ostream &out, const Edge_segment &es)
Edge_segment & operator=(const Edge_segment &src)
Definition: edge_segment.h:82
double get_least_squares_fitting_error() const
returns the sum of square residuals between the edge points and the fitted line segment.
Definition: edge_segment.h:129
void read(std::istream &in)
Reads this Edge_segment from an input stream.
Definition: edge_segment.cpp:194
bool operator==(const Edge_segment &edg)
Definition: edge_segment.h:93
std::ofstream & operator<<(std::ofstream &out, const Quaternion &q)
Definition: turntable_camera.cpp:77
Edge_point get_edge_point(unsigned int i) const
returns the ith edge point of this edge
Definition: edge.h:184
Edge_segment(const kjb::Edge &iedge, const kjb::Line_segment &ls)
Definition: edge_segment.h:55
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
Declarations for Line segment class.
void set_edge(const kjb::Edge &iedge_pts)
Sets the pointer to the edge points this edge_segment was fit to.
Definition: edge_segment.h:162
Class to manipulate a line segment The class is parametrized in terms the position of the centre...
Definition: gr_line_segment.h:62
void write(std::ostream &out) const
Writes this Edge_segment to an output stream.
Definition: edge_segment.cpp:232
bool is_overlapping(const Edge_segment &es, double collinear_threshold=0.12, double overlapping_threshold=10) const
Returns true if the edge_segments are overlapping, ie one is mostly contained in the other...
Definition: edge_segment.cpp:250