我正在学习参考这篇文章。如何使用python opencv删除图像中的隐藏标记?
不像帖子的内容。。。相反,我想知道如何在hsv空间中写下隐藏的k222。使用下面的源代码,我将zkldo.png图像更改为cv2.cvtcolor(copy,cv2.color\u bgr2hsv),然后将其分为多个通道,并像上面捕获的图像一样插入隐藏的水印“k222”,但结果与之不同(图像中键入的文本不清晰可见,但是当你仔细看的时候,你可以看到它们……)有人能就这件事提出建议吗?:)
在hsv频道中添加文本检查结果
import numpy as np
img = cv2.imread("D:\\DOWN\\zkLdo.png")
b, g, r = cv2.split(img) # split into B,G,R spaces
# b = cv2.GaussianBlur(b, None, 8)
copy = img.copy()
hsv_image = cv2.cvtColor(copy, cv2.COLOR_BGR2HSV)
out = cv2.cvtColor(hsv_image, cv2.COLOR_HSV2BGR)
bb, gg, rr = cv2.split(out) # split into B,G,R spaces
position = (10,100)
COLRED = (90,94,105) # RGB RED
COLCBLUE = (255, 0, 0) # RGC Blue
COLXXX = (35, 135, 141)
COLCRAY = (139, 160, 160)
COLTEST = (125, 50, 50)
HSV = cv2.putText(
bb, #numpy array on which text is written
"1234567890", #text
position, #position at which writing has to start
cv2.FONT_HERSHEY_SIMPLEX, #font family
2, #font size
COLTEST, #font color
2) #font stroke
cv2.imwrite('D:\\DOWN\\outputttt.png', cv2.merge((r,g,bb)))
plt.imshow(cv2.merge((r,g,bb)), cmap='gray')
暂无答案!
目前还没有任何答案,快来回答吧!