Advertisement
Guest User

Tp3-Contours

a guest
Feb 25th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include "opencv2/opencv.hpp"
  2.  
  3. using namespace cv;
  4.  
  5. int main(int, char**)
  6. {
  7.     /* Ouvrir la caméra */  
  8.     VideoCapture cap(0);
  9.     if(!cap.isOpened())
  10.         return -1;
  11.  
  12.     Mat contours;
  13.     namedWindow("contours",1);
  14.     Mat frame;
  15.     for(;;)
  16.     {  
  17.         cap >> frame;
  18.         cvtColor(frame, contours, COLOR_BGR2GRAY);
  19.         GaussianBlur(contours, contours, Size(7,7), 1.5, 1.5);
  20.         Canny(contours, contours, 0, 30, 3);
  21.         imshow("contours", contours);
  22.  
  23.         if(waitKey(30) >= 0)
  24.             break;
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement