Spaces:
Running
Running
File size: 1,268 Bytes
8924524 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import cv2
import sys
import os
#sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
def reveal_watermark(input_path, output_path):
try:
# 1. පින්තූරය කියවගන්නවා
img = cv2.imread(input_path)
if img is None:
print("Error: Image not found.")
return
# 2. රහස් හොයන ෆිල්ටර් එක (Laplacian)
laplacian = cv2.Laplacian(img, cv2.CV_64F)
# 3. අහුවුණු දේවල් තදින් පෙන්නනවා (Amplify x20)
revealed = cv2.convertScaleAbs(laplacian, alpha=20)
# 4. Save කරනවා (Window එකේ පෙන්නන්නේ නැතුව)
cv2.imwrite(output_path, revealed)
print("Success")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
# බොට් එකෙන් එවන නම් දෙක මෙතනින් ගන්නවා (Input & Output)
if len(sys.argv) > 2:
input_file = sys.argv[1]
output_file = sys.argv[2]
reveal_watermark(input_file, output_file)
else:
print("Error: Arguments missing")
|