From c2788fcaabe1732170b9f4e001891d3ba92922c1 Mon Sep 17 00:00:00 2001 From: Braden Date: Fri, 13 Dec 2024 13:56:26 -0700 Subject: [PATCH] Added AbstractPlotHandler to BlobIndex. --- opencsp/app/sofast/lib/BlobIndex.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/opencsp/app/sofast/lib/BlobIndex.py b/opencsp/app/sofast/lib/BlobIndex.py index f409f43e..d465873f 100644 --- a/opencsp/app/sofast/lib/BlobIndex.py +++ b/opencsp/app/sofast/lib/BlobIndex.py @@ -6,6 +6,7 @@ from opencsp.common.lib.geometry.Vxy import Vxy from opencsp.common.lib.geometry.LoopXY import LoopXY +from opencsp.common.lib.render.lib.AbstractPlotHandler import AbstractPlotHandler from opencsp.common.lib.tool import log_tools as lt @@ -42,7 +43,7 @@ def __init__(self): self.name: str = '' -class BlobIndex: +class BlobIndex(AbstractPlotHandler): """Class containing blob indexing algorithms to assign indices to blobs in a rough grid pattern. X/Y axes correspond to image axes; +x is to right, +y is down. Class takes in points (in units of pixels) that have been previously found with a blob detector and attempts to assign all found @@ -74,6 +75,8 @@ def __init__(self, points: Vxy, x_min: int, x_max: int, y_min: int, y_max: int) x_min/x_max/y_min/y_max : int Expected min/max of blob indices in x/y directions """ + super().__init__() + self._points = points self._num_pts = len(points) @@ -435,6 +438,7 @@ def run(self, pt_known: Vxy, x_known: int, y_known: int) -> None: # Plot all input blobs if self.debug.debug_active: fig = plt.figure() + self._register_plot(fig) if self.debug.bg_image is not None: plt.imshow(self.debug.bg_image) self.plot_all_points() @@ -447,6 +451,7 @@ def run(self, pt_known: Vxy, x_known: int, y_known: int) -> None: # Plot assigned known center point if self.debug.debug_active: fig = plt.figure() + self._register_plot(fig) if self.debug.bg_image is not None: plt.imshow(self.debug.bg_image) self.plot_assigned_points_labels(labels=True) @@ -459,6 +464,7 @@ def run(self, pt_known: Vxy, x_known: int, y_known: int) -> None: # Plot 3x3 core block if self.debug.debug_active: fig = plt.figure() + self._register_plot(fig) if self.debug.bg_image is not None: plt.imshow(self.debug.bg_image) self.plot_assigned_points_labels(labels=True) @@ -487,6 +493,7 @@ def run(self, pt_known: Vxy, x_known: int, y_known: int) -> None: # Plot all found points if self.debug.debug_active: fig = plt.figure() + self._register_plot(fig) if self.debug.bg_image is not None: plt.imshow(self.debug.bg_image) self.plot_points_connections()