I'm trying to display the webcam feed with a timer but it doesn't render smoothly. Here is the code :
int timer = 10;
VideoCapture cap(0);
Mat img;
while (true) {
cap.read(img);
if (timer == 0) {
cout << "TIME'S UP !!!" << endl;
}
else if (timer <= 20) {
imshow("Image", img);
waitKey(1);
}
system("cls");
cout << timer-- << " seconds left" << endl;
Sleep(1000);
https://www.imessageapp.org/
}
}
Last edited on