Last active
December 15, 2015 11:39
-
-
Save godspeed1989/5254926 to your computer and use it in GitHub Desktop.
printf FPS in opencv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cv::VideoCapture cap(0); // open the default camera | |
if(!cap.isOpened()) // check if we succeeded | |
{ | |
printf("Camera open error.\n"); | |
return -1; | |
} | |
char strfps[64] = "0 fps"; | |
clock_t start = clock(); | |
unsigned int fps = 0; | |
for(;;) | |
{ | |
cap >> image; | |
detect_face(image, cascade, nestedCascade, scale); | |
fps++; | |
if(clock() - start > CLOCKS_PER_SEC) | |
{ | |
sprintf(strfps, "%d fps", fps); | |
fps = 0; | |
start = clock(); | |
} | |
putText(image, strfps, cv::Point(0,20), 3, 1, CV_RGB(25,200,25)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment