CFindTemplate.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef __CFINDTEMPLATE_CLASS
  2. #define __CFINDTEMPLATE_CLASS
  3. #include "CImageBasis.h"
  4. struct RefInfo {
  5. std::string image_file;
  6. int target_x = 0;
  7. int target_y = 0;
  8. int width = 0;
  9. int height = 0;
  10. int found_x;
  11. int found_y;
  12. int search_x;
  13. int search_y;
  14. int fastalg_x = -1;
  15. int fastalg_y = -1;
  16. int fastalg_min = -256;
  17. float fastalg_avg = -1;
  18. int fastalg_max = -1;
  19. float fastalg_SAD = -1;
  20. float fastalg_SAD_criteria = -1;
  21. int alignment_algo = 0; // 0 = "Default" (nur R-Kanal), 1 = "HighAccurity" (RGB-Kanal), 2 = "Fast" (1.x RGB, dann isSimilar)
  22. };
  23. class CFindTemplate : public CImageBasis
  24. {
  25. public:
  26. int tpl_width, tpl_height, tpl_bpp;
  27. CFindTemplate(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channels, _width, _height, _bpp) {};
  28. bool FindTemplate(RefInfo *_ref);
  29. bool CalculateSimularities(uint8_t* _rgb_tmpl, int _startx, int _starty, int _sizex, int _sizey, int &min, float &avg, int &max, float &SAD, float _SADold, float _SADcrit);
  30. };
  31. #endif