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.
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#ifndef CAMERA_H
|
|
#define CAMERA_H
|
|
|
|
#include <QObject>
|
|
#include <QImage>
|
|
#include <QTimer>
|
|
#include <QMutex>
|
|
|
|
#include <opencv2/core.hpp>
|
|
|
|
enum CameraType {
|
|
Virtual = 100, // 虚拟相机
|
|
Hik = 140,
|
|
Basler = 190, // 巴斯勒相机
|
|
LXTof = 210 //蓝芯tof相机
|
|
};
|
|
|
|
enum CameraTriggerMode {
|
|
AUTO_CONTINUOUS = 0, //内触发(自动连续触发)
|
|
SOFTWARE //软触发
|
|
};
|
|
|
|
class Camera : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
virtual bool initCamera(const QString& serialNumber) = 0; // 初始化相机
|
|
virtual void destroyCamera() = 0; // 销毁相机
|
|
virtual bool openCamera() = 0; // 打开相机
|
|
virtual bool closeCamera() = 0; // 关闭相机
|
|
virtual bool startCamera() = 0; // 开始工作
|
|
virtual bool stopCamera() = 0; // 停止工作
|
|
virtual bool setTriggerSource(int) = 0; //设置触发源
|
|
virtual bool setExposure(int exposure) =0; //设置曝光时间
|
|
virtual bool setGain(double gain) = 0; //设置增益
|
|
virtual bool takeAPic(cv::Mat& imgMat, cv::Mat&imgMat3D, int location) = 0; // 获取当前图像
|
|
|
|
void start() { m_timer->start(); }
|
|
void stop() { m_timer->stop(); }
|
|
void setInterval(int time) { m_timer->setInterval(time); }
|
|
|
|
signals:
|
|
void updateImage(QImage image);
|
|
|
|
protected:
|
|
QMutex m_mutex;
|
|
QTimer* m_timer;
|
|
};
|
|
|
|
#endif // CAMERA_H
|