ANSI White on Timer

main
Robert 8 months ago
parent fcaa7ac765
commit 566c11af0e
  1. 9
      dedup.py
  2. 21
      delibs.py

@ -28,7 +28,7 @@ Processing time scales with area, so 4x downscale = ~16x faster initial alignmen
Memory usage significantly reduced
"""
within_one_mile_check = True
within_one_mile_check = False
too_small = 1024 # 1KB
too_large = 10 * 1024 * 1024 # 10MB
@ -46,9 +46,9 @@ def handle_GPS(location1, location2):
if point1 == point2:
print("Images are both from same exact Location")
print("✅Possible duplicate")
if make1 == make2 and model1 == model2:
print("Cameras are the same.")
print("✅Possible duplicate")
delibs.exit_timer(5)
elif coordinates.are_within_one_mile(*point1, *point2) and within_one_mile_check == True:
if make1 == make2 and model1 == model2:
@ -57,9 +57,9 @@ def handle_GPS(location1, location2):
delibs.exit_timer(6)
else:
print("Images are from different Locations")
print("👌Not a Duplicate")
if make1 != make2 or model1 != model2:
print("Different Cameras detected.")
print("👌Not a Duplicate")
delibs.exit_timer(0)
def is_module_imported(module_name):
@ -92,7 +92,6 @@ def main():
if (hash1 == hash2):
print("xxHash found duplicates")
print("❌ Perfect match - images are identical - Duplicate Found!")
print("No transformation needed")
delibs.exit_timer(1)
else:
print("Done hashing...")
@ -166,8 +165,8 @@ def main():
# Check for perfect alignment
if matrix_score == 1.0 and decomposed_score == 1.0 and combined_score == 1.0:
print("❌ Perfect match - images are identical - Duplicate Found!")
print("No transformation needed")
print("❌ Perfect match - images are identical - Duplicate Found!")
exit_code = 1
elif matrix_score > 0.9 and decomposed_score > 0.9 and combined_score > 0.7:
print("✅ Near-perfect alignment - minor differences detected")

@ -12,6 +12,12 @@ Copyright (c) 2025 by Robert Strutts
License: MIT
"""
use_ANSI_Colors = True
# ANSI escape codes for colors
WHITE = "\033[97m"
RESET = "\033[0m"
start = time.perf_counter()
def kill_all():
@ -24,9 +30,13 @@ def exit_handler(signum, frame):
signal.signal(signal.SIGINT, exit_handler)
def exit_timer(level):
end = time.perf_counter()
print(f"⏱ Execution took {end - start:.4f} seconds")
exit(level)
end = time.perf_counter()
if use_ANSI_Colors == True:
print(f"{WHITE}⏱ Execution took {end - start:.4f} seconds{RESET}")
else:
print(f"⏱ Execution took {end - start:.4f} seconds")
exit(level)
class Timer:
def __init__(self, name=None):
@ -57,7 +67,10 @@ class Timer:
def print_result(self):
elapsed = self.elapsed()
print(f"{self.name}: ⏱ {elapsed:.6f} seconds")
if use_ANSI_Colors == True:
print(f"{self.name}: {WHITE}{elapsed:.6f} seconds{RESET}")
else:
print(f"{self.name}: ⏱ {elapsed:.6f} seconds")
def align_with_downscaling(img1, img2, downscale_factor=4, try_common_rotations=True):
"""

Loading…
Cancel
Save