15 #ifndef EDGE_FEATURES_MANAGER_H
16 #define EDGE_FEATURES_MANAGER_H
25 #define FM_DEFAULT_EDGE_SIGMA 1.0
26 #define FM_DEFAULT_EDGE_BEGIN 2.55
27 #define FM_DEFAULT_EDGE_END 2.04
28 #define FM_DEFAULT_EDGE_PADDING 30
29 #define FM_DEFAULT_VP_SUCCESS_PROBABILITY 0.999
30 #define FM_DEFAULT_VP_ASSIGNMENT_THRESHOLD 0.16
64 bool idetect_edges =
true,
65 bool ifit_edge_segments =
true,
66 bool icreate_manhattan_world =
true
74 const std::string & img_path,
75 bool idetect_edges =
true,
76 bool ifit_edge_segments =
true,
77 bool icreate_manhattan_world =
true
94 float iblurring_sigma,
95 float ibegin_threshold,
97 unsigned int ipadding,
101 bool idetect_edges =
true,
102 bool ifit_edge_segments =
true,
103 bool icreate_manhattan_world =
true
108 edges(0), edge_segments(0), manhattan_world(0),
109 _edges_available(false),_edge_segments_available(false),
110 _manhattan_world_available(false)
117 edges(0), edge_segments(0), manhattan_world(0),
118 _edges_available(false),_edge_segments_available(false),
119 _manhattan_world_available(false)
126 delete manhattan_world;
127 delete edge_segments;
134 float iblurring_sigma,
135 float ibegin_threshold,
136 float iend_threshold,
137 unsigned int ipadding,
146 double ivanishing_point_detection_success_probability,
147 double ioutlier_threshold_for_vanishing_points_assignment
151 void read(std::istream& in);
159 void write(std::ostream& out)
const;
169 if(!_edges_available)
179 if(!_edge_segments_available)
183 return *edge_segments;
189 if(!_manhattan_world_available)
193 return *manhattan_world;
199 return _edges_available;
205 return _edge_segments_available;
211 return _manhattan_world_available;
220 return outlier_threshold_for_vanishing_points_assignment;
249 bool ifit_edge_segments,
250 bool icreate_manhattan_world,
258 bool ifit_edge_segments,
259 bool icreate_manhattan_world,
260 const std::string & img_path
267 void fit_edge_segments_to_edges();
271 bool create_manhattan_world(
const kjb::Image & img);
275 bool create_manhattan_world(
const std::string & img_path);
283 Edge_segment_set * edge_segments;
286 Manhattan_world * manhattan_world;
289 bool _edges_available;
292 bool _edge_segments_available;
295 bool _manhattan_world_available;
305 float blurring_sigma;
309 float begin_threshold;
319 unsigned int padding;
328 double vanishing_point_detection_success_probability;
336 double outlier_threshold_for_vanishing_points_assignment;
342 const std::string & img_path
Features_manager(std::istream &in)
Constructs a features manager by reading it from an input stream.
Definition: features_manager.h:107
Abstract class to write this object to an output stream.
Definition: l_writeable.h:41
void reset_vanishing_points(const std::vector< Vanishing_point > &vpts)
Definition: manhattan_world.h:527
Declarations for handling Manhattan world objects.
Features_manager(const char *filename)
Constructs a features manager by reading it from a file.
Definition: features_manager.h:116
void create_corners()
Creates corners by checking all possible intersections of two and three line segments.
Definition: manhattan_world.cpp:1290
Abstract class to read this object from an input stream.
Definition: l_readable.h:39
Features_manager(const kjb::Image &img, bool idetect_edges=true, bool ifit_edge_segments=true, bool icreate_manhattan_world=true)
Constructs a features manager. All options are set to default values All the requested features will ...
Definition: features_manager.cpp:43
void set_manhattan_focal_length(double ifocal)
Definition: features_manager.cpp:831
Definition: features_manager.h:55
const kjb::Edge_set & get_edges()
Returns a pointer to the edge set if available.
Definition: features_manager.h:167
void write(const char *fname) const
Writes this Writeable to a file.
Definition: features_manager.h:161
double get_outlier_threshold_for_vanishing_points_assignment()
Definition: features_manager.h:218
void set_manhattan_world_parameters(double ivanishing_point_detection_success_probability, double ioutlier_threshold_for_vanishing_points_assignment)
Sets the parameters needed to detect Manhattan world features (vanishing points for three orthogonal ...
Definition: features_manager.cpp:649
virtual void write(std::ostream &out) const =0
Writes this Writeable to an output stream.
#define FM_DEFAULT_VP_SUCCESS_PROBABILITY
Definition: features_manager.h:29
void remove_frame_segments()
Definition: features_manager.cpp:855
~Features_manager()
Definition: features_manager.h:124
bool edge_segments_available()
Returns true if edge segments are available.
Definition: features_manager.h:203
void write(std::ostream &out) const
Writes this Features_manager to an output stream.
Definition: features_manager.cpp:544
void reset_manhattan_world_vpts(const std::vector< Vanishing_point > &vpts, double focal)
Definition: features_manager.h:225
Declarations for Line segment set classes.
void set_edge_detection_parameters(float iblurring_sigma, float ibegin_threshold, float iend_threshold, unsigned int ipadding, bool iuse_fourier)
Sets the parameters needed for edge detection.
Definition: features_manager.cpp:602
Features_manager * detect_hoiem_features_manager(const std::string &img_path)
Definition: features_manager.cpp:864
void set_focal_length(double ifocal)
returns the focal length
Definition: manhattan_world.h:522
#define KJB_THROW_2(ex, msg)
Definition: l_exception.h:48
Manhattan_world & get_manhattan_world() const
Returns a pointer to Manhattan world if available.
Definition: features_manager.h:187
bool edges_available()
Returns true if edges are available.
Definition: features_manager.h:197
Exception often thrown when wrapped C functions return error codes.
Definition: l_exception.h:262
This class contains the three orthogonal vanishing points defining a Manhattan scene, where most or all planes are aligned with three main orthogonal directions. This class optionally contains a set of segments from the scene, assigned to the correct vanishing point.
Definition: manhattan_world.h:460
const Edge_segment_set & get_edge_segments()
Returns a pointer to the edge segments set if available.
Definition: features_manager.h:177
void assign_segments_to_vpts(const Edge_segment_set &, double outlier_threshold=MW_OUTLIER_THRESHOLD)
Assigns each input segment to the vanishing point it converges to, or mark it as an outlier if it doe...
Definition: manhattan_world.cpp:166
virtual void read(std::istream &in)=0
Reads this Readable from an input stream.
Class to manipulate a set of edge segments.
Definition: line_segment_set.h:128
Support for error handling exception classes in libKJB.
Wrapped version of the C struct KJB_image.
Definition: i_image.h:76
bool manhattan_world_available()
Returns true if Manhattan world is available.
Definition: features_manager.h:209
void read(std::istream &in)
Reads this Features_manager from an input stream.
Definition: features_manager.cpp:256
void set_manhattan_world(Manhattan_world *mw)
Definition: features_manager.cpp:840
#define FM_DEFAULT_VP_ASSIGNMENT_THRESHOLD
Definition: features_manager.h:30
void read(const char *fname)
Reads this Readable from a file.
Definition: features_manager.h:153