You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
611 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "video_proc_ts.h"
  2. _VP_timestamp::_VP_timestamp() {}
  3. _VP_timestamp::~_VP_timestamp() {}
  4. void _VP_timestamp::process(cv::Mat * Frame)
  5. {
  6. char DateStr[200];
  7. time_t t;
  8. struct tm * tmp;
  9. t = time(NULL);
  10. tmp = gmtime(&t);
  11. if (tmp == NULL)
  12. {
  13. perror("localtime");
  14. return;
  15. };
  16. if (strftime(DateStr, sizeof(DateStr), "%F %T GMT", tmp) == 0)
  17. {
  18. fprintf(stderr, "strftime returned 0");
  19. return;
  20. };
  21. rectangle(*Frame, cv::Point(10, 10), cv::Point(490, 60), cv::Scalar(0, 0, 0), CV_FILLED);
  22. putText(*Frame, DateStr, cv::Point(30, 45), cv::FONT_HERSHEY_SIMPLEX, 1, cv::Scalar(0, 255, 255), 3);
  23. }