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.

34 lines
954 B
C++

#ifndef _QALGDETECT_H_
#define _QALGDETECT_H_
#include <QObject>
#include <opencv.hpp>
#include <QImage>
#include <QVariantMap>
#include "IWheelModel.h"
#include "ThreadPool.hpp"
#include "threadsafe_list.hpp"
using namespace cv;
typedef std::function<void(QVariantMap)> AlgResultCallBack;
typedef std::function<void(QImage)> AlgCallBack;
class QAlgDetect : public QObject
{
Q_OBJECT
public:
QAlgDetect(QObject *parent = nullptr);
~QAlgDetect();
virtual bool detect(QImage img, QVariantMap param, AlgResultCallBack func);
protected:
cv::Mat findCircle(cv::Mat srcImg, QVariantMap param);
Mat DetectCircle(Mat img, QPointF center, double radius, bool bEqual);
QString matchTemplate(const QMap<QString, IWheelModel*>* modelMap, cv::Mat detectImg, double* pMinDis /*= NULL*/, int minDisNum /*= -1*/) const;
void taskFunc(cv::Mat srcImg, QVariantMap param, AlgResultCallBack func);
private:
std::shared_ptr<ThreadPool> m_pThreadPool;
};
#endif