29 #ifndef SEGMENT_EXPANDER_H 30 #define SEGMENT_EXPANDER_H 38 #include <opencv/cv.hpp> 54 void Initialize(cv::Mat &_map, cv::Mat &_distField, cv::Mat &_voronoiPath);
60 std::vector<std::vector<Eigen::Vector2d>>
calcEndpoints(
float *_potential);
71 std::vector< Segment >
getGraph(
const std::vector<std::vector<Eigen::Vector2d>> &_endPoints,
float *_potential,
const float _min_length,
float _optimizePixelsCrossing,
const float _optimizePixelsEndSegments);
80 template <
class T,
class S,
class C>
83 q = std::priority_queue<T, S, C>();
88 Index(
int index,
float c,
float d,
float p)
95 Index(
int x_val,
int y_val,
int nx,
float c,
float d,
float p)
97 i = x_val + y_val * nx;
104 int x_val = (
i % nx) + dist_x;
105 int y_val = (
i / nx) + dist_y;
107 if(x_val < 0 || x_val > nx || y_val < 0 || y_val > ny)
108 return Index(-1, -1, -1, -1);
110 return Index(x_val, y_val, nx, 0, 0, 0);
136 const std::vector<tuw_graph::Segment>
splitPath(
const std::vector<Eigen::Vector2d> &_path,
const float _minimum_length);
145 Eigen::Vector2d
expandSegment(
Index start,
float* _potential,
const std::vector<std::vector<Eigen::Vector2d>> &_endpoints);
148 std::vector<Eigen::Vector2d>
getPath(
const Index &start,
float* _potential,
const std::vector<std::vector<Eigen::Vector2d>> &_endpoints);
160 bool isEndpoint(
Index &_current,
const std::vector<std::vector<Eigen::Vector2d>> &_endpoints);
163 void removeEndpoint(
const Index &_current, std::vector<std::vector<Eigen::Vector2d>> &_endpoints);
167 void optimizeSegments(std::vector<Segment> &_segments,
float _maxPixelsCrossing,
float _maxPixelsEndSeg);
174 #endif // VORONOI_EXPANDER_H void addExpansionCandidate(const Index ¤t, const Index &next, float *potential)
void optimizeSegments(std::vector< Segment > &_segments, float _maxPixelsCrossing, float _maxPixelsEndSeg)
std::unique_ptr< float[]> distance_field_
Index(int index, float c, float d, float p)
Index(int x_val, int y_val, int nx, float c, float d, float p)
std::priority_queue< Index, std::vector< Index >, greater1 > queue_
std::unique_ptr< int8_t[]> voronoi_graph_
std::vector< Eigen::Vector2d > getPath(const Index &start, float *_potential, const std::vector< std::vector< Eigen::Vector2d >> &_endpoints)
std::vector< Eigen::Vector2d > expandCrossing(const Index &i, float *_potential)
void Initialize(cv::Mat &_map, cv::Mat &_distField, cv::Mat &_voronoiPath)
initializes the expander by setting the voronoi path map and distancefield
Index offsetDist(int dist_x, int dist_y, int nx, int ny) const
std::vector< std::vector< Eigen::Vector2d > > calcEndpoints(float *_potential)
looks for crossings and saves all segment endpoints of it
Eigen::Vector2d expandSegment(Index start, float *_potential, const std::vector< std::vector< Eigen::Vector2d >> &_endpoints)
void optimizeSegmentsAroundPoint(std::vector< Segment > &_segments, const Eigen::Vector2d &pt, float maxPixels, int startIndex)
bool operator()(const Index &a, const Index &b) const
float getMinSegmentWidth(const std::vector< Eigen::Vector2d > &_path)
void removeSegmentFromList(const uint32_t _id, std::vector< Segment > &_segments)
void removeEndpoint(const Index &_current, std::vector< std::vector< Eigen::Vector2d >> &_endpoints)
bool checkSegmentPoint(const Index &_point)
std::vector< Segment > getGraph(const std::vector< std::vector< Eigen::Vector2d >> &_endPoints, float *_potential, const float _min_length, float _optimizePixelsCrossing, const float _optimizePixelsEndSegments)
returns a list of segments, which represent the found search graph
const std::vector< tuw_graph::Segment > splitPath(const std::vector< Eigen::Vector2d > &_path, const float _minimum_length)
void clearpq(std::priority_queue< T, S, C > &q)
uint32_t nrOfNeighbours(uint32_t i) const
bool isEndpoint(Index &_current, const std::vector< std::vector< Eigen::Vector2d >> &_endpoints)
std::unique_ptr< int8_t[]> global_map_