I am using a Scalar to define the color of a rectangle I am drawing with OpenCV:
Scalar
OpenCV
rectangle(imgOriginal, Point(0, 0), Point(25, 50),
OpenCV 3.2.0. Note: h is in range [0,360] and l and s is in [0,1]
Mat hls(1, 1, CV_32FC3, Scalar(h, l, s)); Mat rgb; cvtColor(hls, rgb, COLOR_HLS2RGB); Scalar c = Scalar(255*rgb.at(0,0), 255*rgb.at(0,1), 255*rgb.at(0,2));