RMVL  1.3.0
Robotic Manipulation and Vision Library
载入中...
搜索中...
未找到
samples/camera/mv/sample_mv_writer.cpp

迈德威视相机录屏例程

#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
using namespace rm;
using namespace std;
using namespace cv;
int main()
{
Mat tmp;
while (!capture.read(tmp))
ERROR_("fail to read the image.");
VideoWriter writer("ts.avi", VideoWriter::fourcc('F', 'L', 'V', '1'), 40, tmp.size());
int exposure = 1000;
int gain = 64;
int r_gain = 100;
int g_gain = 100;
int b_gain = 100;
// Load the last parameters
FileStorage fs("out_para.yml", FileStorage::READ);
if (fs.isOpened())
{
fs["exposure"].isNone() ? void(0) : (fs["exposure"] >> exposure);
fs["gain"].isNone() ? void(0) : (fs["gain"] >> gain);
fs["r_gain"].isNone() ? void(0) : (fs["r_gain"] >> r_gain);
fs["g_gain"].isNone() ? void(0) : (fs["g_gain"] >> g_gain);
fs["b_gain"].isNone() ? void(0) : (fs["b_gain"] >> b_gain);
}
capture.set(CAMERA_MANUAL_EXPOSURE);
capture.set(CAMERA_EXPOSURE, exposure);
capture.set(CAMERA_GAIN, gain);
capture.set(CAMERA_MANUAL_WB);
capture.set(CAMERA_WB_RGAIN, r_gain);
capture.set(CAMERA_WB_GGAIN, g_gain);
capture.set(CAMERA_WB_BGAIN, b_gain);
Mat frame;
while (capture.read(frame))
{
imshow("frame", frame);
writer.write(frame);
if (waitKey(1) == 27)
if (waitKey(0) == 27)
break;
}
}
迈德威视相机库
迈德威视相机库
定义 mv_camera.h:36
bool read(cv::OutputArray image)
从相机设备中读取图像
bool set(int propId, double value=0.0)
设置相机参数/事件
@ Continuous
连续采样
#define ERROR_(...)
定义 util.hpp:50
定义 math.hpp:69
定义 camutils.hpp:17
static CameraConfig create(Args &&...modes)
创建相机初始化配置模式
定义 camutils.hpp:70