[英]Can't show the image with white text, opencv
The original image is原图是
font = cv2.FONT_HERSHEY_SIMPLEX
bottomLeftCornerOfText = (10,150)
fontScale = 1
fontColor = (255,255,255)
cv2.putText(img=img,text='Hello World!',
org = bottomLeftCornerOfText,
fontFace=font,
fontScale=fontScale,
color=fontColor,
lineType=cv2.LINE_AA,
thickness=1)
After running the code above, I got image like this运行上面的代码后,我得到了这样的图像
Only text showed and the background image disappeared.只显示文本,背景图像消失。 I also tried other colors like blue and green, they all worked fine, both image and text were kept.
我还尝试了其他颜色,如蓝色和绿色,它们都很好用,图像和文字都保留了下来。 I wonder why white text doesn't work here and how can I fix it.
我想知道为什么白色文本在这里不起作用,我该如何解决。
Is the image type float from 0.0 to 1.0?图像类型是否从 0.0 浮动到 1.0? Is it one channel grayscale?
是单通道灰度吗? You are assigning text color with 3 channels and 255 valued... Probably you're having trouble because of one of those.
您正在分配具有 3 个通道和 255 个值的文本颜色……您可能因为其中一个而遇到问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.