Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image quality degradation #36

Open
tengshaofeng opened this issue Jun 18, 2024 · 0 comments
Open

image quality degradation #36

tengshaofeng opened this issue Jun 18, 2024 · 0 comments

Comments

@tengshaofeng
Copy link

Dears, thanks for you great job first. When I try add watermask of image, the output image quality degradation. But when I use watermask of text, the output is good, but text version is not robut for crop operation. Some code like following:
"import time

加水印

import cv2
from imwatermark import WatermarkEncoder
tic = time.time()
bgr = cv2.imread('pic/ori_senwang.png')
wm = '@guofei9987威尼斯'
encoder = WatermarkEncoder()
encoder.set_watermark('bytes', wm.encode('utf-8'))
bgr_encoded = encoder.encode(bgr, 'dwtDctSvd') # dwtDct
print('take time:', time.time()-tic)
cv2.imwrite('output/test_wm.png', bgr_encoded)

解水印

import cv2
from imwatermark import WatermarkDecoder

bgr1 = cv2.imread('output/test_wm.png')
bgr1 = bgr1#[:1200, :800, ...]
decoder = WatermarkDecoder('bytes', 8*len(wm.encode('utf-8')))
watermark = decoder.decode(bgr1, 'dwtDctSvd')
print(watermark.decode('utf-8', 'replace'))"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant