Skip to content

image quality degradation #36

@tengshaofeng

Description

@tengshaofeng

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions