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.

32 lines
850 B

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