OpenCV: convert Scalar to different color space

前端 未结 4 1622
刺人心
刺人心 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 21:57

    This worked for me,

    Mat rgb;
    Mat hsv(1, 1, CV_8UC3, Scalar(224, 224, 160));
    
    cvtColor(hsv, rgb, CV_HSV2BGR);
    Scalar rgb = Scalar((int)rgb.at(0, 0)[0],(int)rgb.at(0, 0)[0],(int)rgb.at(0, 0)[0])
    

提交回复
热议问题