#pragma once namespace graft_cv{ extern char *g_version_str; //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}; enum img_type {oa,rs,rs_reid,sc,sola_rs_reid, sola_sc_reid, sola_rs_pcd, sola_sc_pcd, tea_grab,tea_cut}; template class roi_box{ public: roi_box(T x_, T y_, T width_, T height_){ this->x = x_; this->y = y_; this->width = width_; this->height = height_; } roi_box(){ this->x = T(0); this->y = T(0); this->width = T(0); this->height = T(0); } ~roi_box(){} bool isInBox(T pt_x, T pt_y){ if (pt_x>=this->x && pt_x <=(this->x+this->width) && pt_y >= this->y && pt_y <= (this->y + this->height)){ return true; } else{ return false; } } private: T x; T y; T width; T height; }; template class gcv_point{ public: gcv_point(T x_, T y_){ this->x = x_; this->y = y_; } gcv_point(){ this->x = T(0); this->y = T(0); } gcv_point(const gcv_point&pt){ this->x = pt.x; this->y = pt.y; } ~gcv_point(){} double distance(const gcv_point& pt)const { return sqrt((double)(this->x - pt.x)*(this->x - pt.x) + (double)(this->y - pt.y)*(this->y - pt.y)); } gcv_point& operator=(const gcv_point& pt) { if(this !=&pt){ this->x=pt.x; this->y=pt.y; } return *this; } bool operator==(const gcv_point& pt)const { if(this->x==pt.x && this->y==pt.y){ return true; } return false; } public: T x; T y; }; struct Bbox //drop box with confidence and center keypoint { Bbox() { this->score = 0.0; this->score_overall = 0.0; this->x1 = 0; this->y1 = 0; this->x2 = 0; this->y2 = 0; for (int i = 0; i < 10; ++i) { this->ppoint[i] = 0.0; } for (int i = 0; i < 2; ++i) { this->operate_point[i] = 0.0; } this->operate_angle = 0.0; this->area = 0.0; this->status = 0; } Bbox(const Bbox& another) { this->score = another.score; this->score_overall = another.score_overall; this->x1 = another.x1; this->y1 = another.y1; this->x2 = another.x2; this->y2 = another.y2; for (int i = 0; i < 10; ++i) { this->ppoint[i] = another.ppoint[i]; } for (int i = 0; i < 2; ++i) { this->operate_point[i] = another.operate_point[i]; } this->operate_angle = another.operate_angle; this->area = another.area; this->status = another.status; } float score;//目标识别得分 float score_overall;//识别成功后,优先抓取得分,综合得分 int x1; int y1; int x2; int y2; float ppoint[10]; //(x,y) 5 key points float operate_point[2]; //(x,y) 1 operate point, 操作点 float operate_angle; //angle of operate point, 操作点的角度方向 float area; //像素面积 int status; // 状态:未选中=0;被选中=1; }; };