.. _program_listing_file_include_tuw_geometry_linesegment2d_detector.hpp: Program Listing for File linesegment2d_detector.hpp =================================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/tuw_geometry/linesegment2d_detector.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef TUW_GEOMETRY__LINEFILTER_HPP #define TUW_GEOMETRY__LINEFILTER_HPP #include #include "tuw_geometry/linesegment2d.hpp" namespace tuw { class LineSegment2DDetectorParameter; using LineSegment2DDetectorParameterPtr = std::shared_ptr; using LineSegment2DDetectorParameterConstPtr = std::shared_ptr; class LineSegment2DDetectorParameter { public: LineSegment2DDetectorParameter() : threshold_split_neighbor(true), threshold_split(.05), min_length(.1), min_points_per_line(20), min_points_per_unit(10) { } bool threshold_split_neighbor; double threshold_split; double min_length; int min_points_per_line; int min_points_per_unit; }; class LineSegment2DDetector; using LineSegment2DDetectorPtr = std::shared_ptr; using LineSegment2DDetectorConstPtr = std::shared_ptr; class LineSegment2DDetector { public: class LineSegment : public LineSegment2D { public: LineSegment() : LineSegment2D(), id_(0) {} void set(unsigned int idx0, unsigned int idx1, const std::vector & points); void updatePoints(const std::vector & points); bool isSupportPoint(int idx); unsigned int nrSupportPoint(); unsigned int id_; unsigned int idx0_, idx1_; std::vector points_; }; LineSegment2DDetector(); void start(const std::vector & points); std::vector & start( const std::vector & points, std::vector & detected_segments); const std::vector & result(); LineSegment2DDetectorParameter config_; private: void split(LineSegment & line, const std::vector & points); std::vector> connected_measurments_; std::vector segments_; }; } // namespace tuw #endif // TUW_GEOMETRY__LINE2DFILTER_HPP