Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mat mat1, mat2, mat3, mat4;
- namedWindow("Color");
- int saturation = 0, hue = 0, value = 0;
- createTrackbar("Hue", "Color", &hue, 180);
- createTrackbar("Saturation", "Color", &saturation, 255);
- createTrackbar("Value", "Color", &value, 255);
- while (true) {
- mat1 = Mat(800, 600, CV_16UC3, Scalar(hue, saturation, value));
- mat1.convertTo(mat1, COLOR_BGR2HSV);
- imshow("Color", mat1);
- if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
- {
- cout << "esc key is pressed by user" << endl;
- break;
- }
- }
- destroyAllWindows();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement