#include "pch.h"
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char *argv[])
{
int d=8;
char ad[300]={0};
char name;
//从电脑摄像头读入
VideoCapture capture(0);
Mat edges;
waitKey(2000);
//循环显示每一帧
Mat frame;
while(1)
{
capture>>frame;//读取当前帧
imshow("读取视频",frame);
int k=waitKey(30);//延时30ms
if(k=='e'||cvGetWindowHandle("读取视频")==nullptr)
break;
else if(k=='c')
{
sprintf_s(ad, "E:\\tb\\project\\tb2\\face_tb\\face_tb\\face_tb\\face_tb\\output_face\\%d.jpg", ++d);
imwrite(ad, frame );
cout<<"get "<<d<<" picture "<<endl;
}
}
C++(opencv)读取图片序列及保存图片到指定文件夹
最新推荐文章于 2025-02-11 17:00:48 发布