Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1.     Mat mat1, mat2, mat3, mat4;
  2.     namedWindow("Color");
  3.  
  4.     int saturation = 0, hue = 0, value = 0;
  5.  
  6.     createTrackbar("Hue", "Color", &hue, 180);
  7.     createTrackbar("Saturation", "Color", &saturation, 255);
  8.     createTrackbar("Value", "Color", &value, 255);
  9.  
  10.     while (true) {
  11.         mat1 = Mat(800, 600, CV_16UC3, Scalar(hue, saturation, value));
  12.         mat1.convertTo(mat1, COLOR_BGR2HSV);
  13.         imshow("Color", mat1);
  14.         if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
  15.         {
  16.             cout << "esc key is pressed by user" << endl;
  17.             break;
  18.         }
  19.     }
  20.     destroyAllWindows();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement