#pragma once #include #include #include #include #include "net.h" #include #include #include "config.h" using namespace cv; using namespace std; class CropPlate { public: CropPlate(); vector cropFormFrame(cv::Mat frame, string mode); private: ncnn::Net net; int size_input; float detect_threshold; float img_size = 272.0; float wh_ratio = 2.0; private: void sort(std::vector &dLables); cv::Mat cropImage4Point(cv::Point2f rect_points[], cv::Mat img, cv::Size size); void memcpy_array(float dir[][4], float src[][4]); float IOU(DLable label1, DLable label2); std::vector nms(std::vector dLables, float iou_threshold=.5, float prob_threshold=.5); float length(cv::Point2f p1, cv::Point2f p2); vector reconstruct(cv::Mat img, ncnn::Mat out_probs, ncnn::Mat out_box, float threshold = 0.7, string mode = ""); };