AutoCar  v1.0.0
rune_detect.h
1 #ifndef RUNEDETECT_H
2 #define RUNEDETECT_H
3 
4 #include <opencv2/opencv.hpp>
5 #include <unordered_map>
6 
7 class RuneDetect
8 {
9 public:
10  RuneDetect();
11  void initialTmpList();
12  void templetContour(cv::Mat tmp);
13  void findContour(cv::Mat img);
14  void recogHandWriteNum();
15  void setImagePoints(std::vector<cv::Point2f> armor_points);
16  void clearImgVector();
17  void findDigitalNum(cv::Mat img, std::vector<cv::RotatedRect> num_rects);
18  void numDecode(std::vector<std::vector<cv::Point>> contours);
19  void getNumOrder(std::vector<unsigned int> &list);
20  std::vector<std::pair<cv::Mat, cv::Point2f>> img_vector;
21 private:
22  std::vector<std::vector<cv::Point>> tmps_contour;
23  std::unordered_map<unsigned int, unsigned int> num_code;
24  std::vector<unsigned int> num_order;
25  cv::Mat img_rec;
26  std::vector<cv::Point> tmp_contour;
27  std::vector<cv::Point2f> obj_p;
28  // cv::Point2f img_p[];
29  std::vector<cv::Point2f> img_p;
30  std::vector<cv::Point2f> digital_img_p;
31  std::vector<cv::Point2f> digital_obj_p;
32 
33  cv::Mat rvec;
34  cv::Mat tvec;
35  cv::Mat region;
36 
37  cv::Mat camera_matrix;
38  cv::Mat dist_coeffs;
39  double cam[9] = {839.923052, 0.0, 340.780730,
40  0.0, 837.671081, 261.766523,
41  0.0, 0.0, 1.0 };
42 
43  double dist_c[5] = {0.082613, 0.043275, 0.002486, -0.000823, 0.0};
44 
45  int offset, height_offset, width_offset;
46  int x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6, num, a, b;
47 };
48 
49 #endif // RUNEDETECT_H
Definition: rune_detect.h:7