data_def.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #pragma once
  2. namespace graft_cv{
  3. extern char *g_version_str;
  4. //enum camera {rs_clamp_rad, rs_clamp_tan, rs_cut_rad, rs_cut_tan, sc_clamp_rad, sc_clamp_tan, sc_cut_rad, sc_cut_tan};
  5. enum img_type {oa,rs,rs_reid,sc };
  6. template<class T>
  7. class roi_box{
  8. public:
  9. roi_box(T x_, T y_, T width_, T height_){
  10. this->x = x_;
  11. this->y = y_;
  12. this->width = width_;
  13. this->height = height_;
  14. }
  15. roi_box(){
  16. this->x = T(0);
  17. this->y = T(0);
  18. this->width = T(0);
  19. this->height = T(0);
  20. }
  21. ~roi_box(){}
  22. bool isInBox(T pt_x, T pt_y){
  23. if (pt_x>=this->x && pt_x <=(this->x+this->width) &&
  24. pt_y >= this->y && pt_y <= (this->y + this->height)){
  25. return true;
  26. }
  27. else{
  28. return false;
  29. }
  30. }
  31. private:
  32. T x;
  33. T y;
  34. T width;
  35. T height;
  36. };
  37. template<class T>
  38. class gcv_point{
  39. public:
  40. gcv_point(T x_, T y_){
  41. this->x = x_;
  42. this->y = y_;
  43. }
  44. gcv_point(){
  45. this->x = T(0);
  46. this->y = T(0);
  47. }
  48. gcv_point(const gcv_point<T>&pt){
  49. this->x = pt.x;
  50. this->y = pt.y;
  51. }
  52. ~gcv_point(){}
  53. double distance(const gcv_point<T>& pt)const
  54. {
  55. return sqrt((double)(this->x - pt.x)*(this->x - pt.x) +
  56. (double)(this->y - pt.y)*(this->y - pt.y));
  57. }
  58. gcv_point<T>& operator=(const gcv_point<T>& pt)
  59. {
  60. if(this !=&pt){
  61. this->x=pt.x;
  62. this->y=pt.y;
  63. }
  64. return *this;
  65. }
  66. bool operator==(const gcv_point<T>& pt)const
  67. {
  68. if(this->x==pt.x && this->y==pt.y){
  69. return true;
  70. }
  71. return false;
  72. }
  73. public:
  74. T x;
  75. T y;
  76. };
  77. };