Skip to content

Commit

Permalink
added numbers to initial guess (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlib authored Nov 28, 2024
1 parent 18a5f2c commit 2178c21
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"

[project]
name = "pyptv"
version = "0.2.5"
version = "0.2.6"
description = "Python GUI for the OpenPTV library `liboptv`"
authors = [
{ name = "Alex Liberzon", email = "alex.liberzon@gmail.com" }
]
readme = "README.md"
requires-python = ">=3.6"
requires-python = ">=3.8"
keywords = ["pyptv"]
classifiers = [
"Programming Language :: Python :: 3"
Expand Down
14 changes: 8 additions & 6 deletions pyptv/calibration_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,16 @@ def handle_mapper(self):
coord_y1,
)

def plot_num_overlay(self, x, y, txt):
def plot_num_overlay(self, x, y, txt, text_color="white", border_color="red"):
for i in range(len(x)):
coord_x, coord_y = self._plot.map_screen([(x[i], y[i])])[0]
ovlay = TextBoxOverlay(
component=self._plot,
text=str(txt[i]),
alternate_position=(coord_x, coord_y),
real_position=(x[i], y[i]),
text_color="white",
border_color="red",
text_color=text_color,
border_color=border_color,
)
self._plot.overlays.append(ovlay)

Expand Down Expand Up @@ -708,7 +708,7 @@ def _button_init_guess_fired(self):
self._project_cal_points(i_cam)

def _project_cal_points(self, i_cam, color="orange"):
x, y = [], []
x, y, pnr = [], [], []
for row in self.cal_points:
projected = image_coordinates(
np.atleast_2d(row["pos"]),
Expand All @@ -719,10 +719,13 @@ def _project_cal_points(self, i_cam, color="orange"):

x.append(pos[0][0])
y.append(pos[0][1])
pnr.append(row["id"])

# x.append(x1)
# y.append(y1)
self.drawcross("init_x", "init_y", x, y, color, 3, i_cam=i_cam)
self.camera[i_cam].plot_num_overlay(x, y, pnr)

self.status_text = "Initial guess finished."

def _button_sort_grid_fired(self):
Expand Down Expand Up @@ -1368,8 +1371,7 @@ def _read_cal_points(self):
import sys

if len(sys.argv) == 1:
# active_path = Path("../test_cavity/parametersRun1")
active_path = Path("/home/user/Documents/repos/multiplane_example_2/parametersmultiplane")
active_path = Path("../test_cavity/parametersRun1")
else:
active_path = Path(sys.argv[0])

Expand Down
6 changes: 3 additions & 3 deletions pyptv/detection_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ def handle_mapper(self):
self._plot.overlays[i].alternate_position = (
coord_x1, coord_y1)

def plot_num_overlay(self, x, y, txt):
def plot_num_overlay(self, x, y, txt, text_color="white", border_color="red"):
for i in range(0, len(x)):
coord_x, coord_y = self._plot.map_screen([(x[i], y[i])])[0]
ovlay = TextBoxOverlay(component=self._plot,
text=str(txt[i]), alternate_position=(coord_x, coord_y),
real_position=(x[i], y[i]),
text_color="white",
border_color="red"
text_color=text_color,
border_color=border_color,
)
self._plot.overlays.append(ovlay)

Expand Down

0 comments on commit 2178c21

Please sign in to comment.