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

asked 2016-06-07 13:12:52 -0600

pmh4514 gravatar image

updated 2016-06-09 07:58:10 -0600


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


edit retag flag offensive reopen merge delete

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


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

LorenaGdL gravatar imageLorenaGdL ( 2016-06-07 13:16:26 -0600 )edit

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

pmh4514 gravatar imagepmh4514 ( 2016-06-07 14:52:03 -0600 )edit

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

berak gravatar imageberak ( 2016-06-07 21:42:34 -0600 )edit

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

pmh4514 gravatar imagepmh4514 ( 2016-06-09 07:45:28 -0600 )edit