Skip to content

Commit

Permalink
Added AbstractPlotHandler to BlobIndex.
Browse files Browse the repository at this point in the history
  • Loading branch information
braden6521 committed Dec 13, 2024
1 parent 7ed0195 commit c2788fc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion opencsp/app/sofast/lib/BlobIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit c2788fc

Please sign in to comment.