天宫鹤

Qt应用程序使用OpenCV库测试视频捕捉实例程序源码

int main() {
VideoCapture cap(0);
if (!cap.isOpened()) {
return -1;
}

while (1) {
Mat frame;
cap >> frame;

if (frame.empty())
break;

imshow("Frame", frame);

char c = (char)waitKey(25);// wait up to 25 milliseconds
if (c == 27)
break;
} // while
cap.release();
destroyAllWindows();

return 0;
}

 

posted on 2023-01-30 14:43  GoGrid  阅读(54)  评论(0编辑  收藏  举报

导航