aihot  2017-04-27 09:49:19  OpenCV |   查看评论   
    if (cvWaitKey(33) == 'q')  
  •         return 0;  
  •   }  
  •   //由于图像片(min_win 为15x15像素)是在bounding box中采样得到的,所以box必须比min_win要大  
  •   if (min(box.width, box.height)<(int)fs.getFirstTopLevelNode()["min_win"]){  
  •       cout << "Bounding box too small, try again." << endl;  
  •       gotBB = false;  
  •       goto GETBOUNDINGBOX;  
  •   }  
  •   // 删除回调
  •   cvSetMouseCallback( "TLD", NULL, NULL );  //如果已经获得第一帧用户框定的box了,就取消鼠标响应  
  •   printf("Initial Bounding Box = x:%d y:%d h:%d w:%d\n",box.x,box.y,box.width,box.height);  
  •   // 输出文件
  •   FILE  *bb_file = fopen("bounding_boxes.txt","w");  
  •     
  •   // TLD初始化
  •   tld.init(last_gray, box, bb_file);  
  •   
  •   ///Run-time  
  •   Mat current_gray;  
  •   BoundingBox pbox;  
  •   vector<Point2f> pts1;  
  •   vector<Point2f> pts2;  
  •   bool status=true;  //记录跟踪成功与否的状态 lastbox been found  
  •   int frames = 1;  //记录已过去帧数  
  •   int detections = 1;  //记录成功检测到的目标box数目  
  •     
  • REPEAT:  
  •   while(capture.read(frame)){  
  •     // 得到框架
  •     cvtColor(frame, current_gray, CV_RGB2GRAY);  
  •     // 过程框架
  •     tld.processFrame(last_gray, current_gray, pts1, pts2, pbox, status, tl, bb_file);  
  •     //Draw Points  
  •     if (status){  //如果跟踪成功  
  •       drawPoints(frame,pts1);  
  •  

    除特别注明外,本站所有文章均为 赢咖4注册 原创,转载请注明出处来自TLD(Tracking-Learning-Detection)学习与源码理解之(四)

    留言与评论(共有 0 条评论)
       
    验证码:
    [lianlun]1[/lianlun]