Skip to content

Commit

Permalink
MAINT: Add interactive mode for calibration of illumination correctio…
Browse files Browse the repository at this point in the history
…n in SimpleFluidFlower
  • Loading branch information
jwboth committed Apr 17, 2024
1 parent 821fd9d commit 0fba2d8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/darsia/presets/fluidflower/simplefluidflower.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ def setup(
self.labels = self.setup_segmentation(segmentation)

# ! ---- SETUP COLOR CORRECTION ----
illumination_mode = kwargs.get("illumination_mode", "automatic")
if self.active_illumination_correction or self.active_color_correction:
self.illumination_correction, self.color_correction = (
self.setup_color_correction(color_checker_position)
self.setup_color_correction(color_checker_position, illumination_mode)
)
if self.active_illumination_correction:
self.corrections.append(self.illumination_correction)
Expand Down Expand Up @@ -222,6 +223,7 @@ def set_corrections(self) -> None:
def setup_color_correction(
self,
color_checker_position: darsia.ColorCheckerPosition,
illumination_mode: Literal["automatic", "interactive"] = "automatic",
) -> tuple:
"""Setup color correction based on color checker.
Expand All @@ -240,8 +242,12 @@ def setup_color_correction(

# Find random patches, restricted to the masked regions
width = 50
num_patches = 10
samples = darsia.random_patches(mask, width=width, num_patches=num_patches)
if illumination_mode == "interactive":
sample_assistant = darsia.BoxSelectionAssistant(self.baseline, width=width)
samples = sample_assistant()
else:
num_patches = 10
samples = darsia.random_patches(mask, width=width, num_patches=num_patches)

# Find sample in the center
# TODO
Expand Down

0 comments on commit 0fba2d8

Please sign in to comment.