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.

31 lines
804 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "video_proc_index.h"
  2. _VP_indexer::_VP_indexer()
  3. {
  4. m_llFrameCounter = 0;
  5. }
  6. _VP_indexer::~_VP_indexer() {}
  7. void _VP_indexer::process(cv::Mat * Frame)
  8. {
  9. char IndexStr[20];
  10. m_llFrameCounter++;
  11. snprintf(IndexStr, 20, "%lld", m_llFrameCounter);
  12. int baseline = 0;
  13. int fontFace = CV_FONT_HERSHEY_PLAIN;
  14. double fontScale = 1;
  15. int thickness = 1;
  16. cv::Size textSize = cv::getTextSize(IndexStr, fontFace, fontScale, thickness, &baseline);
  17. baseline += thickness;
  18. int W = Frame->cols;
  19. int H = Frame->rows;
  20. rectangle(*Frame, cv::Point(W - textSize.width - 6, 3), cv::Point(W - 3, textSize.height + 6), cv::Scalar(0, 0, 0), CV_FILLED);
  21. putText(*Frame, IndexStr, cv::Point(W - textSize.width - 3, textSize.height + 3), fontFace, fontScale, cv::Scalar(0, 255, 255), thickness);
  22. }