[SOLVED] putText - result is always black text [closed]

asked Jun 7 '16

pmh4514 gravatar image

updated Jun 9 '16

Hello,

I have a Matrix of type CV_16UC1 which holds 16bit grayscale pixel data from an external camera.

I want to use putText to draw WHITE text over the image.

But regardless which of the following two lines I try, the text is displayed, but it is always black.

What am I doing wrong?

cv::putText(target_mat, strStatus, Point2f(50,100), FONT_HERSHEY_PLAIN, 3, cv::Scalar(255,255,255),2); cv::putText(target_mat, strStatus, Point2f(50,100), FONT_HERSHEY_PLAIN, 3, cv::Scalar(0,0,0),2);

Thanks!

Preview: (hide)

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2017-09-26 07:29:56.633461

Comments

If you have an image of just one channel (C1), you just need cv::Scalar(255)

LorenaGdL gravatar imageLorenaGdL (Jun 7 '16)edit

Thank you for your kind reply. cv::Scalar(255) and cv::Scalar(0) still both produce only black text.

pmh4514 gravatar imagepmh4514 (Jun 7 '16)edit
1

0xff is white for a 8bit image, 0xffff is white for 16bit

berak gravatar imageberak (Jun 8 '16)edit

Thank you. using 0xffff instead of cv::scalar(255) solved the problem.

pmh4514 gravatar imagepmh4514 (Jun 9 '16)edit