加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
thread.h 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
丁坤 提交于 2021-02-03 22:59 . 123
#ifndef THREAD_H
#define THREAD_H
#include <QThread>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv.hpp"
#include <QMutex>
#include <Python.h>
#include <arrayobject.h>
#include <QVector>
#include <modbus-tcp.h>
#include <modbus.h>
extern PyObject* pFun;
typedef struct
{
int pointA_x;
int pointA_y;
int pointB_x;
int pointB_y;
}bad_candy_box;
class PyThreadStateLock
{
public:
PyThreadStateLock(void)
{
state = PyGILState_Ensure( );
}
~PyThreadStateLock(void)
{
PyGILState_Release( state );
}
private:
PyGILState_STATE state;
};
class QThreadDeal: public QThread
{ Q_OBJECT
private:
QMutex stop_mutex;
bool m_stop;
protected:
void run();
public:
explicit QThreadDeal(QObject *parent = NULL);
void exitThread();
PyObject* call_python_file(npy_intp* diminfo,unsigned char* buff);
void deal_ret_from_python(PyObject* ret);
signals:
void send_image(cv::Mat);
void send_res(QVector<bad_candy_box>);
};
class QThreadModbus: public QThread
{ Q_OBJECT
private:
QMutex stop_mutex;
bool m_stop;
protected:
void run();
public:
explicit QThreadModbus(QObject *parent = NULL);
void exitThread();
signals:
void stop_all_thread();
};
class QThreadDebug: public QThread
{ Q_OBJECT
private:
QMutex stop_mutex;
bool m_stop;
bool correct_flag;
QMutex correct_mutex;
protected:
void run();
public:
explicit QThreadDebug(QObject *parent = NULL);
void exitThread();
public slots:
void get_correct_siganl();
signals:
void send_image_debug(cv::Mat);
};
class QThreadValveTest: public QThread
{ Q_OBJECT
private:
protected:
void run();
public:
explicit QThreadValveTest(QObject *parent = NULL);
void exitThread();
};
#endif // THREAD_H
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化