【发布时间】:2014-07-28 11:15:31
【问题描述】:
您好,我有一个 while(1) 执行无限循环,有没有办法忽略前 2 帧?
while(1)
{
bool bSuccess = capture.read(fullimage); // read a new frame from video
if (!bSuccess) //if not success, break loop
{
cout << "End of video" << endl;
destroyWindow("Original Video");
destroyWindow("dctBlockImage");
break;
}
imshow("Original Video", fullimage); //show the frame in "Original Video" window
FrameTo8by8(myinput,3.0); //Proccess and algorithm
oVideoWriter.write(dctImage); //write video to file
namedWindow("dctBlockImage");
imshow("dctBlockImage", dctImage); //display watermarked image
if(waitKey(30) == 27) //wait for 'esc' key press for 30 ms. If 'esc' key is pressed, break loop
{
cout << "esc key is pressed by user" << endl;
break;
}
}
有没有办法跳过前两帧?
【问题讨论】:
-
capture.read(blah); capture.read(blah); while(true) { ... }? -
@BoBTFish 感谢您的评论。所以我需要重复 capture.read() 两次并将 while(1) 更改为 while(true)?