用OPENCV在視頻幀中顯示幀數


  1. #include <opencv2/core/core.hpp>
  2. #include <opencv2/highgui/highgui.hpp>
  3. #include <iostream>
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. using namespace cv;
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.     void draw_framecount(Mat Frame,int framecount);
  13.     namedWindow("text");
  14.     for (int count=1;count<=6000;count++)
  15.     {   
  16.         char img_str[200];
  17.         sprintf(img_str,"D:\\image\\UMN\\Crowd-Activity-%04d.jpg",count);
  18.         Mat img=imread(img_str);    
  19.         draw_framecount(img,count);
  20.         imshow("text",img);
  21.         waitKey(100);
  22.     }
  23. }
  24.  
  25.  
  26. void draw_framecount(Mat Frame,int framecount)//Frameframecount
  27. {
  28.     char strFrame[10];
  29.     sprintf(strFrame, "#%0d ",framecount);
  30.     putText(Frame,strFrame,cvPoint(0,20),2,1,CV_RGB(25,200,25));
  31. }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM