map.hh 691 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef MAP_HH
  2. #define MAP_HH
  3. #include <iostream>
  4. #include <vector>
  5. #include <opencv4/opencv2/opencv.hpp>
  6. #include "still2d.hh"
  7. #include "Tools.hpp"
  8. #include "files.hh"
  9. struct dot{
  10. int x;
  11. int y;
  12. };
  13. struct block{
  14. std::vector<dot> dots;
  15. bool treat=false;
  16. };
  17. struct mat{
  18. unsigned char*data;
  19. unsigned int cols;
  20. unsigned int rows;
  21. };
  22. class map{
  23. private:
  24. cv::Mat image;
  25. mat matrice;
  26. std::vector<block> blocks;
  27. int find_block(std::vector<block> blocks,int x,int y);
  28. void defineMatrice();
  29. public:
  30. int loadMapFromTxt(std::string path);
  31. int loadMapFromImage(std::string path);
  32. void defineBlocks();
  33. std::vector<block> getBlocks();
  34. mat getMat();
  35. };
  36. #endif // MAP_HH