debug lines as param
This commit is contained in:
parent
1f07974466
commit
e24e270a42
2 changed files with 18 additions and 7 deletions
|
@ -57,6 +57,9 @@ class CvRenderer(Node):
|
|||
self.tracks: Dict[str, Track] = {}
|
||||
self.predictions: Dict[str, Track] = {}
|
||||
|
||||
self.scale = 100
|
||||
self.debug_lines = debug_lines = load_lines_from_svg(self.config.debug_map, self.scale, '') if self.config.debug_map else []
|
||||
|
||||
|
||||
def refresh_labels(self, dt: float):
|
||||
"""Every frame"""
|
||||
|
@ -185,7 +188,7 @@ class CvRenderer(Node):
|
|||
# img = frame.camera.img_to_world(frame.img, 100)
|
||||
# cv2.imwrite(save_file, img)
|
||||
|
||||
img = decorate_frame(frame, tracker_frame, prediction_frame, first_time, self.config, self.tracks, self.predictions, self.detections, self.config.render_clusters)
|
||||
img = decorate_frame(frame, tracker_frame, prediction_frame, first_time, self.config, self.tracks, self.predictions, self.detections, self.config.render_clusters, self.debug_lines, self.scale)
|
||||
|
||||
logger.debug(f"write frame {frame.time - first_time:.3f}s")
|
||||
if self.out_writer:
|
||||
|
@ -266,7 +269,10 @@ class CvRenderer(Node):
|
|||
""",
|
||||
type=str,
|
||||
default=None)
|
||||
|
||||
render_parser.add_argument('--debug-map',
|
||||
help='specify a map (svg-file) from which to load lines which will be overlayed',
|
||||
type=str,
|
||||
default="../DATASETS/hof3/map_hof.svg")
|
||||
return render_parser
|
||||
|
||||
# colorset = itertools.product([0,255], repeat=3) # but remove white
|
||||
|
@ -298,8 +304,8 @@ def get_animation_position(track: Track, current_frame: Frame):
|
|||
|
||||
|
||||
|
||||
def decorate_frame(frame: Frame, tracker_frame: Frame, prediction_frame: Frame, first_time: float, config: Namespace, tracks: Dict[str, Track], predictions: Dict[str, Track], detections: Optional[List[Detection]], as_clusters = True) -> np.array:
|
||||
scale = 100
|
||||
def decorate_frame(frame: Frame, tracker_frame: Frame, prediction_frame: Frame, first_time: float, config: Namespace, tracks: Dict[str, Track], predictions: Dict[str, Track], detections: Optional[List[Detection]], as_clusters = True, debug_lines = [], scale: float = 100) -> np.array:
|
||||
|
||||
# TODO: replace opencv with QPainter to support alpha? https://doc.qt.io/qtforpython-5/PySide2/QtGui/QPainter.html#PySide2.QtGui.PySide2.QtGui.QPainter.drawImage
|
||||
# or https://github.com/pygobject/pycairo?tab=readme-ov-file
|
||||
# or https://pyglet.readthedocs.io/en/latest/programming_guide/shapes.html
|
||||
|
@ -359,7 +365,6 @@ def decorate_frame(frame: Frame, tracker_frame: Frame, prediction_frame: Frame,
|
|||
inv_H = np.linalg.pinv(tracker_frame.H)
|
||||
draw_track_projected(img, track, int(track_id), frame.camera, conversion)
|
||||
|
||||
debug_lines = load_lines_from_svg("../DATASETS/hof3/map_hof.svg", scale, '')
|
||||
for line in debug_lines:
|
||||
for rp1, rp2 in zip(line.points, line.points[1:]):
|
||||
p1 = (
|
||||
|
|
|
@ -961,8 +961,10 @@ class Stage(Node):
|
|||
self.counter = CounterSender()
|
||||
self.frame: Optional[Frame] = None
|
||||
|
||||
|
||||
if self.config.debug_map:
|
||||
debug_color = SrgbaColor(0.,0.,1.,1.)
|
||||
self.debug_lines = RenderableLines(load_lines_from_svg("../DATASETS/hof3/map_hof.svg", 100, debug_color))
|
||||
self.debug_lines = RenderableLines(load_lines_from_svg(self.config.debug_map, 100, debug_color))
|
||||
|
||||
|
||||
def run(self):
|
||||
|
@ -1092,6 +1094,10 @@ class Stage(Node):
|
|||
help='Manually specity communication addr for the stage messages (the rendered lines)',
|
||||
type=str,
|
||||
default="tcp://0.0.0.0:99174")
|
||||
argparser.add_argument('--debug-map',
|
||||
help='specify a map (svg-file) from which to load lines which will be overlayed',
|
||||
type=str,
|
||||
default="../DATASETS/hof3/map_hof.svg")
|
||||
return argparser
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue