标签:code sprintf write als rop print number bool ret
int main(void) { VideoCapture capture("F:\\1.avi");//在嵌入式设备中这一句执行错误,挪到电脑上用VS没有错误, if (!capture.isOpened()) { printf("fail to open 1.avi\n"); }
long totalFrameNumber = capture.get(CV_CAP_PROP_FRAME_COUNT); printf("total frame number is:%f\n", totalFrameNumber); long frameToStart = 1; capture.set(CV_CAP_PROP_POS_FRAMES, frameToStart); long frameToStop = 1000; double rate = capture.get(CV_CAP_PROP_FPS); printf("rate is :%d\n", rate); bool stop = false; Mat frame; int delay = 1000 / rate; long currentFrame = frameToStart; char path[20] = {}; int imageNum = 0; while (!stop) { if (!capture.read(frame)) { printf("get frame fail!\n"); return -1; } sprintf(path, "F:\\%d.jpg", imageNum); imageNum++; //保存获取到的帧数据 imwrite(path, frame);
if (currentFrame > frameToStop) { stop = true; } currentFrame++; } capture.release(); return 0; }
标签:code sprintf write als rop print number bool ret
原文地址:https://www.cnblogs.com/cumtchw/p/11956844.html