2024-09-27 15:54:45 +08:00
|
|
|
#ifndef Hd_CameraModule_readImage_H
|
2024-09-27 14:31:22 +08:00
|
|
|
#define Hd_CameraModule_readImage_H
|
|
|
|
|
|
|
|
|
|
#include <QtCore/qglobal.h>
|
|
|
|
|
|
|
|
|
|
#include<opencv2/opencv.hpp>
|
|
|
|
|
#include <opencv.hpp>
|
|
|
|
|
#include <QByteArray>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include<iostream>
|
|
|
|
|
#include <Windows.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <QScopedPointer>
|
|
|
|
|
#include <QThread>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "base.h"
|
|
|
|
|
|
|
|
|
|
using namespace cv;
|
|
|
|
|
|
|
|
|
|
#pragma comment(lib, "winmm.lib")
|
|
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
|
|
|
|
|
|
////static cv::Mat srcImage;
|
|
|
|
|
//static vector<cv::Mat> srcmat;
|
|
|
|
|
//static int index=0; //相机序号
|
|
|
|
|
//static void* handle;
|
|
|
|
|
//static bool m_flag = false;
|
|
|
|
|
|
|
|
|
|
static bool moduleStatus = true;
|
|
|
|
|
|
|
|
|
|
class Hd_CameraModule_readImage :public Base
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Hd_CameraModule_readImage();
|
|
|
|
|
virtual ~Hd_CameraModule_readImage();
|
|
|
|
|
//从类中读数据到实例对象。
|
|
|
|
|
bool readData(std::vector<cv::Mat>&,QByteArray&);
|
|
|
|
|
// 实例对象把数据写入到类。
|
|
|
|
|
bool writeData(std::vector<cv::Mat>&,QByteArray&);
|
|
|
|
|
//初始化
|
|
|
|
|
bool initParas(QByteArray&);
|
|
|
|
|
bool run();
|
2024-09-30 15:36:39 +08:00
|
|
|
bool decodeInitData(QByteArray byteArray, QVector<QByteArray>& vector_data);
|
2024-09-27 14:31:22 +08:00
|
|
|
bool checkStatus();
|
|
|
|
|
private:
|
|
|
|
|
int timeout_ms = 5000;
|
|
|
|
|
|
|
|
|
|
//计算读图CT
|
|
|
|
|
DWORD startmain=0;
|
|
|
|
|
//最大读图时间
|
|
|
|
|
int maxStartmain=0;
|
|
|
|
|
//是否为第一个
|
|
|
|
|
bool ifFirst=false;
|
|
|
|
|
//睡眠时间
|
|
|
|
|
int sleeptime=0;
|
|
|
|
|
//文件夹读到的所有图片
|
|
|
|
|
QStringList localSourceImgsName;
|
|
|
|
|
int imgIndex=0;
|
|
|
|
|
DWORD start, stop;
|
|
|
|
|
int allTime=0;
|
|
|
|
|
//图片文件夹路径
|
|
|
|
|
QString DirPath = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
Q_DECL_EXPORT Hd_CameraModule_readImage * create();
|
|
|
|
|
Q_DECL_EXPORT void destory(Hd_CameraModule_readImage * ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // Hd_readImage_module_H
|