| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- #ifndef _MAP_H_
- #define _MAP_H_
- #include <Eigen/Core>
- #include <Eigen/Geometry>
- #include <memory>
- #include <map>
- #include <string>
- #include "common/common.h"
- namespace hlzn_slam {
-
- class Map
- {
- public:
-
- Map(float length, float width, float resolution);
-
- Map(Eigen::MatrixXf& map, float resolution, float x_origin, float y_origin);
- ~Map(){};
-
-
- void pixelValuePlus(const std::vector<Eigen::Vector3f>& pinot_cloud, const float& probablity, const float& upper);
- void pixelValuePlus2(const std::vector<Eigen::Vector3f>& pinot_cloud, const float& probablity, const float& upper);
- void pixelValuePlus3(const std::vector<Eigen::Vector3f>& pinot_cloud, const float& probablity, const float& upper);
- void pixelValuePlusShadow(const std::vector<Eigen::Vector3f>& pinot_cloud, const float& probablity, const float& upper);
- void pixelValuePlusShadow2(const std::vector<Eigen::Vector3f>& pinot_cloud, const float& probablity, const float& upper);
- void out(std::string path);
-
- void mapAttenuate(const float& attenuate_value);
- void mapShadowAttenuate(const float& attenuate_value);
-
-
-
- void clearMap();
- void clearShadowMap();
-
- void useShadow(bool ok);
- void word2Map(float x, float y, int& row, int& col);
-
- bool empty();
-
- int getRows();
- int getCols();
- float getLength();
- float getWidth();
- float getResolution();
- const float& getXorigin();
- const float& getYorigin();
- const float& getReciprocalResolution();
-
-
- float getCost(const common::PointCloud& point_cloud);
- float getPixelProbablity(const int row, const int col);
-
-
- Eigen::MatrixXf& getMapCite();
- Eigen::MatrixXf& getInverseMapCite();
-
-
- Eigen::MatrixXf* getMapPtr();
- void __sharpenMap(Eigen::MatrixXf& map);
- void weakenPixel(float x, float y, float value);
- private:
- void __increaseProbablity(int& row, int& col, const float& probablity, const float& upper);
- void __increaseProbablity2(int& row, int& col, const float& probablity, const float& upper);
- void __gaussianIncrease(int& row, int& col, const float& probablity, const float& upper);
- void __increaseProbablityShadow(int& row, int& col, const float& probablity, const float& upper);
- void __increaseProbablityShadow2(int& row, int& col, const float& probablity, const float& upper);
- void __world2Map(float x, float y, int& row, int& col);
- void __writeMap(int row, int col, float value);
- void __normProbablity(const float& upper);
- void __clearMap();
- bool __outBound(int row, int col);
- bool __outBound(Eigen::MatrixXf& map, int row, int col);
- float& __read(int row, int col);
- float& __read(Eigen::MatrixXf& map, int row, int col);
- float __readShadow(int row, int col);
- Eigen::MatrixXf map_;
- Eigen::MatrixXf shadow_map_;
-
- std::map<const std::tuple<int /*row*/, int /*col*/>,
- float* > index_table_;
- std::map<const std::tuple<int /*row*/, int /*col*/>,
- float* > shadow_;
-
- bool use_shadow_;
- int rows_, cols_;
- float width_, length_, resolution_, reciprocal_resolution_;
- float x_origin_, y_origin_;
- };
- }
- #endif
|