aihot  2017-04-27 09:27:31  OpenCV |   查看评论   
  •         cout<<"No camera or video input!\n"<<endl;  
  •         return -1;  
  •     }  
  •   
  •     ViBe_BGS Vibe_Bgs;  
  •     int count = 0;  
  •   
  •     while (1)  
  •     {  
  •         count++;  
  •         capture >> frame;  
  •         if (frame.empty())  
  •             break;  
  •         cvtColor(frame, gray, CV_RGB2GRAY);  
  •       
  •         if (count == 1)  
  •         {  
  •             Vibe_Bgs.init(gray);  
  •             Vibe_Bgs.processFirstFrame(gray);  
  •             cout<<" Training GMM complete!"<<endl;  
  •         }  
  •         else  
  •         {  
  •             Vibe_Bgs.testAndUpdate(gray);  
  •             mask = Vibe_Bgs.getMask();  
  •             morphologyEx(mask, mask, MORPH_OPEN, Mat());  
  •             imshow("mask", mask);  
  •         }  
  •   
  •         imshow("input", frame);   
  •   
  •         if ( cvWaitKey(10) == 'q' )  
  •             break;  
  •     }  
  •   
  •     return 0;  
  •  

    除特别注明外,本站所有文章均为 赢咖4注册 原创,转载请注明出处来自运动检测(前景检测)之(一)ViBe

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