I'm trying to draw gradient lines on an image. I want my lines to be green colored and I use Scalar(0,255,0). Still, I'm getting only black color. For Scalar(0,0,0) also I'm getting black. For Scalar(255,255,255) I get white, but no other color for any combination. Part of the code is given below:
line(visual_image,
Point(x1*scaleFactor, y1*scaleFactor),
Point(x2*scaleFactor, y2*scaleFactor),
Scalar(0,255,0),
1,8,0);
since you can't draw coloured lines,circles,etc into a grayscale image, you have to convert it to 3 channels first :
Mat rgb;
cvtColor(visual_image, rgb, CV_GRAY2BGR);
// now draw your lines:
line( rgb,
Point(x1*scaleFactor, y1*scaleFactor),
Point(x2*scaleFactor, y2*scaleFactor),
Scalar(0,255,0),
1,8,0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With