Advertisement
ma_mehralian

Python3 C-API test

Feb 6th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. void  pyTest(){
  2.     PyAdapter ka_;
  3.  
  4.     String inp_vid = "m.mp4";
  5.     int* vs;
  6.     int w, h, f_n;
  7.     uint64_t ts;
  8.     VideoSourceCreate(&vs, inp_vid.c_str(), video_source::FFMPEG);
  9.     VideoSourceGetWidth(vs, &w);
  10.     VideoSourceGetHeight(vs, &h);
  11.     Mat3b frame(h, w), frame_s;
  12.     while (VideoSourceReadFrameBGR(vs, frame.data) == 0) {
  13.         resize(frame, frame_s, Size(), 0.5, 0.5);
  14.         if (ka_.Detect(frame_s) < 0)
  15.             break;
  16.  
  17.         vector<pair<char, Rect>> &lbls = ka_.GetLabels();
  18.         for (int i = 0; i < lbls.size(); i++) {
  19.             rectangle(frame_s, lbls.at(i).second, CV_RGB(10, 20, 30));
  20.         }
  21.  
  22.         imshow("out", frame_s);
  23.         cvWaitKey(10);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement