Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

java - How to add invisible marking in the image using openCV?

I am studying referring to this post. How to remove hidden marks from images using python opencv?

Unlike the content of the post... On the contrary, I'd like to know how to write that hidden K2222xxxxxxxxxx in that HSV SPACE. Using the following source code, I changed the zkLdo.png image to cv2.cvtColor(copy, cv2.COLOR_BGR2HSV), and then separated it into channels, and inserted the hidden watermarking "K2222xxxxxxxxxx" like the captures image above, but the result did not come out the same as like that(The typed text in the image is not clearly visible, but you can see them when you look closely anyway...) Is there anyone who can advise on this matter? :)

added text in the HSV channel Checking the result

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')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...