![](/img/trans.png)
[英]How to change logitech c920 webcam settings using c++ on osx?
[英]How to get frames from c920 camera using OpenCV4 C++
我正在尝试从Logitec c920相机中获取帧并进行显示。 相机似乎正在工作,但是显示窗口上没有任何显示。
我尝试配置所有相机设置,但没有进行任何配置。 我在想什么???
#include "pch.h"
#include <iostream>
#include "opencv2\imgcodecs.hpp"
#include "opencv2\core.hpp"
#include "opencv2\highgui.hpp"
#include "opencv2\videoio.hpp"
using namespace std;
using namespace cv;
int main()
{
VideoCapture camera(CAP_ANY);
Mat frame;
namedWindow("x", WINDOW_AUTOSIZE);
camera.set(CAP_PROP_FOURCC, VideoWriter::fourcc('M', 'J', 'P', 'G'));
camera.set(CAP_PROP_FRAME_WIDTH, 1920);
camera.set(CAP_PROP_FRAME_HEIGHT, 1080);
while (1)
{
camera.read(frame);
imshow("x", frame);
}
waitKey(0);
return 0;
}
您必须在每帧之后放置waitKey(int delay)
。 您的while
循环应如下所示:
while (1)
{
camera.read(frame);
imshow("x", frame);
waitKey(1);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.