35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <opencv2/core/core.hpp>
|
|
#include <opencv2/highgui/highgui.hpp>
|
|
#include <opencv2/imgproc/imgproc.hpp>
|
|
#include "net.h"
|
|
#include <vector>
|
|
#include <stdio.h>
|
|
#include "config.h"
|
|
|
|
using namespace cv;
|
|
using namespace std;
|
|
|
|
class CropPlate {
|
|
public:
|
|
CropPlate();
|
|
vector<cv::Mat> 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<DLable> &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<DLable> nms(std::vector<DLable> dLables, float iou_threshold=.5, float prob_threshold=.5);
|
|
float length(cv::Point2f p1, cv::Point2f p2);
|
|
vector<cv::Mat> reconstruct(cv::Mat img, ncnn::Mat out_probs, ncnn::Mat out_box, float threshold = 0.7, string mode = "");
|
|
}; |