puttext with black background
I want to write value
on picture using puttext
with black background. Code:
rectangle(frame, Rect(
Point(50,50) + Point(0,-height),
Point(50,50) + Point(width,0)),
Scalar(0,0,0),-1);
putText(frame, Tostr(value), Point(50,50),1,1,Scalar(255,255,255),2);
But change of capacity value
leads change of required width
.
How this width
is determined, or did I miss some params of putText, which resolve my issue?
Actually your question is quite unclear to me. You are drawing a rectangle based on the width of the text that will be displayed on it. The width of putText is determined by the amount of characters that need to be displayed. Take a standard distance for each character (just do some tests to get a good guess) and use that as size? How are you calculating width and heigth for the moment?