Skip to content

Commit

Permalink
MAINT: Improve color checker finder strategy.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwboth committed Apr 17, 2024
1 parent 11d39ab commit 821fd9d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/darsia/corrections/color/colorcheckerfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ def detect_colorchecker(arr):

# Iterate by decreasing a window for searching the colorchecker
success = False
current = 1
refinement_counter: int = 1
current = 1.0 - update**refinement_counter
while not success:
current_corner = (
current * start_corner + (1 - current) * target_corner
Expand All @@ -217,8 +218,9 @@ def detect_colorchecker(arr):
success, _, local_voxels = detect_colorchecker(arr[roi])
if success:
break
current *= update
if current < update**20:
refinement_counter += 1
current = 1.0 - update**refinement_counter
if current > 1.0 - update**20:
assert False, "No color checker found."

# Extract the color checker directly from the image (more robust than colour).
Expand Down

0 comments on commit 821fd9d

Please sign in to comment.