OpenCV: convert Scalar to different color space

前端 未结 4 1570
刺人心
刺人心 2021-01-17 21:28

I am using a Scalar to define the color of a rectangle I am drawing with OpenCV:

rectangle(imgOriginal, Point(0, 0), Point(25, 50),         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-01-17 22:06

    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));
    

提交回复
热议问题