2022-11-08 06:39:35 +00:00
|
|
|
import cv2
|
|
|
|
import fire
|
|
|
|
from imwatermark import WatermarkDecoder
|
|
|
|
|
|
|
|
|
|
|
|
def testit(img_path):
|
|
|
|
bgr = cv2.imread(img_path)
|
2023-09-19 06:20:26 +00:00
|
|
|
decoder = WatermarkDecoder("bytes", 136)
|
|
|
|
watermark = decoder.decode(bgr, "dwtDct")
|
2022-11-08 06:39:35 +00:00
|
|
|
try:
|
2023-09-19 06:20:26 +00:00
|
|
|
dec = watermark.decode("utf-8")
|
2022-11-08 06:39:35 +00:00
|
|
|
except:
|
|
|
|
dec = "null"
|
|
|
|
print(dec)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-09-19 06:20:26 +00:00
|
|
|
fire.Fire(testit)
|