2、设置光谱仪帧率、曝光时间、gain; 3、在页面中嵌入了rgb相机图传(通过opencv实现); 4、平台的相机位置模拟、x/y马达的分别控制、x/y马达的量程检测; 5、轨迹规划; 6、加入了张卓的自动调焦模块; 7、加入了自动电源控制;
69 lines
1.2 KiB
C++
69 lines
1.2 KiB
C++
#include "stdafx.h"
|
|
#include "RgbCameraOperation.h"
|
|
|
|
RgbCameraOperation::RgbCameraOperation()
|
|
{
|
|
cam = nullptr;
|
|
m_ImageProcessor = new ImageProcessor();
|
|
m_func = nullptr;
|
|
}
|
|
|
|
RgbCameraOperation::~RgbCameraOperation()
|
|
{
|
|
}
|
|
|
|
void RgbCameraOperation::OpenCamera()
|
|
{
|
|
std::cout << "打开摄像头+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
|
cam = new cv::VideoCapture(0);
|
|
|
|
record = true;
|
|
|
|
while (record)
|
|
{
|
|
//std::cout << "采集影像+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
|
cam->read(frame);
|
|
m_qImage = m_ImageProcessor->Mat2QImage(frame);
|
|
|
|
emit PlotSignal();
|
|
}
|
|
|
|
cam->release();
|
|
|
|
emit CamClosed();
|
|
|
|
}
|
|
|
|
void RgbCameraOperation::OpenCamera_callback()
|
|
{
|
|
std::cout << "打开摄像头+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
|
cam = new cv::VideoCapture(0);
|
|
|
|
record = true;
|
|
|
|
while (record)
|
|
{
|
|
//std::cout << "采集影像+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
|
cam->read(frame);
|
|
m_qImage = m_ImageProcessor->Mat2QImage(frame);
|
|
|
|
if(m_func)
|
|
m_func();
|
|
}
|
|
|
|
cam->release();
|
|
}
|
|
|
|
|
|
void RgbCameraOperation::setCallback(void(*func)())
|
|
{
|
|
m_func = func;
|
|
}
|
|
|
|
void RgbCameraOperation::CloseCamera()
|
|
{
|
|
std::cout << "关闭摄像头+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
|
|
|
record = false;
|
|
}
|