Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to print a text to a frame in opencv-python

I am using opencv-python for my face detection experiment. I am also to do a cv.drawRect function. I tried with cv.putText but it is not supported in python. Is there other functions other than cv.putText which can write text to an image frame

like image 294
slaveCoder Avatar asked Feb 13 '23 00:02

slaveCoder


1 Answers

Got it. In the older version of python-opencv use PutText instead of putText

font = cv.InitFont(cv.CV_FONT_HERSHEY_SIMPLEX, 1, 1, 0, 3, 8) #Creates a font
x = 10 #position of text
y = 20 #position of text
cv.PutText(image,"Hello World!!!", (x,y),font, 255) #Draw the text
like image 189
slaveCoder Avatar answered Feb 14 '23 12:02

slaveCoder