Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ColorConversionCodes COLOR_GRAY2RGB seems to behave like BGR

This code sample will draw a red circle on a white background. using the ColorConversionCodes COLOR_GRAY2RGB marker, the color identity Scalar(0,0,255) produces red. why not blue? Does the circle function convert the color code back to BGR?

 #include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char ** argv){

    Mat md0, md1, md2;
    md0 = Mat::zeros(200,400,CV_32F);
    md1 = Mat::ones(200,400,CV_32F);

//drawing function
    Point2f p(77, 100);
    cvtColor(md1, md2, COLOR_GRAY2RGB );
    circle( md2, p,50,Scalar(0,0,255),2,8,0);

    imshow("MD2", md2);

    waitKey(0);
    return 0;
    }