You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Cigarette/Cigarette/alg_jd.h

36 lines
1.5 KiB
C++

#ifndef _CIGARETTE_JD
#define _CIGARETTE_JD
#include <opencv2/opencv.hpp>
#include <opencv2/dnn.hpp>
#include <opencv2/dnn/shape_utils.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <fstream>
#include "common.h"
class AlgJd
{
public:
bool init(QString model_path, QString model_name);
bool test_detect();
bool test_detect_batcht(int shoot);
int detect(cv::Mat& in, cv::Mat &out, std::vector<std::pair<int, cv::Rect> > &results);
// Remove the bounding boxes with low confidence using non-maxima suppression
void post_process(cv::Mat& frame, std::vector<cv::Mat>& outs, std::vector<std::pair<int, cv::Rect> > &results);
void CircleImagePro(cv::Mat src, cv::Mat dst, std::vector<float> radius);
void detect_batch(std::vector<cv::Mat>& vec_in, std::vector<cv::Mat> &vec_out, std::vector<std::vector<std::pair<int, cv::Rect> > > &vec_results);
// Remove the bounding boxes with low confidence using non-maxima suppression
void post_process_batch(std::vector<cv::Mat>& vec_frame, std::vector<cv::Mat>& outs, std::vector<std::vector<std::pair<int, cv::Rect> > > &vec_results);
void analyse(cv::Mat vec_in, std::vector<std::pair<int, cv::Rect> > & vec_results);
// Get the names of the output layers
std::vector<cv::String> getOutputsNames(const cv::dnn::Net& net);
// Draw the predicted bounding box
void drawPred(int classId, float conf, int left, int top, int right, int bottom, cv::Mat& frame);
private:
cv::dnn::Net net;
std::vector<std::string> classes;
};
#endif //end of _CIGARETTE_JD