使用 putText() 函数在 OpenCV 窗口显示文本
在本教程中,我们将使用 opencv 函数 putText() 在图像上书写文字。此函数带入图像、字体、文本位置坐标、颜色、粗细等。
原始图像

算法
Step 1: Import cv2 Step 2: Define the parameters for the puttext( ) function. Step 3: Pass the parameters in to the puttext() function. Step 4: Display the image.
代码示例
import cv2
image = cv2.imread("testimage.jpg")
text = "TutorialsPoint"
coordinates = (100,100)
font = cv2.FONT_HERSHEY_SIMPLEX
fontScale = 1
color = (255,0,255)
thickness = 2
image = cv2.putText(image, text, coordinates, font, fontScale, color, thickness, cv2.LINE_AA)
cv2.imshow("Text", image)输出

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP