Skip to content

Commit

Permalink
Introduce flag for toggling info box rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
DarwinsBuddy committed Jan 18, 2024
1 parent f1b0d98 commit 1e7b56c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions foosball/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def get_argparse():
ap.add_argument("-s", "--scale", type=float, default=0.4, help="Scale stream")
ap.add_argument("-cap", "--capture", choices=['cv', 'gear'], default='gear', help="capture backend")
ap.add_argument("-d", "--display", choices=['cv', 'gear'], default='cv', help="display backend cv=direct display, gear=stream")
ap.add_argument("-i", "--info", action='store_true', help="Render gui info box")
ap.add_argument("-g", "--gpu", choices=['preprocess', 'tracker', 'render'], nargs='+', default=["render"],
help="use GPU")
ap.add_argument("-A", "--audio", action='store_true', help="Enable audio")
Expand Down
4 changes: 3 additions & 1 deletion foosball/tracking/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def __init__(self, dims: FrameDimensions, headless=False, useGPU: bool = False,
self.dims = dims
self.headless = headless
self.kwargs = kwargs
self.show_info = kwargs.get('info')
[self.proc, self.iproc] = generate_processor_switches(useGPU)

def process(self, msg: Msg) -> Msg:
Expand All @@ -129,7 +130,8 @@ def process(self, msg: Msg) -> Msg:
r_goal(f, goals.right)
r_track(f, track, self.dims.scale)
r_score(f, score, text_scale=1, thickness=4)
r_info(f, shape, info, text_scale=0.5, thickness=1)
if self.show_info:
r_info(f, shape, info, text_scale=0.5, thickness=1)
return Msg(kwargs={"result": self.iproc(f)})
else:
return Msg(kwargs={"result": " - ".join([f"{label}: {text}" for label, text in info])})
Expand Down

0 comments on commit 1e7b56c

Please sign in to comment.