Spaces:
Running
Running
| 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") | |