From 9483fc3654a6faffd2ea5706a284a2a48420d9ab Mon Sep 17 00:00:00 2001 From: charlesbvll Date: Tue, 4 May 2021 12:27:58 +0200 Subject: [PATCH] Multi webcam support --- monoloco/run.py | 1 + monoloco/visuals/printer.py | 1 + monoloco/visuals/webcam.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/monoloco/run.py b/monoloco/run.py index 358c350..45fdf0d 100644 --- a/monoloco/run.py +++ b/monoloco/run.py @@ -62,6 +62,7 @@ def cli(): predict_parser.add_argument('--dropout', type=float, help='dropout parameter', default=0.2) predict_parser.add_argument('--show_all', help='only predict ground-truth matches or all', action='store_true') predict_parser.add_argument('--webcam', help='monstereo streaming', action='store_true') + predict_parser.add_argument('--camera', help='device to use for webcam streaming', type=int, default=0) predict_parser.add_argument('--focal', help='focal length in mm for a sensor size of 7.2x5.4 mm. (nuScenes)', type=float, default=5.7) diff --git a/monoloco/visuals/printer.py b/monoloco/visuals/printer.py index 06c82ff..71af832 100644 --- a/monoloco/visuals/printer.py +++ b/monoloco/visuals/printer.py @@ -437,6 +437,7 @@ class Printer: ax.set_ylim(0, self.z_max + 1) ax.set_xlabel("X [m]") ax.set_box_aspect(.8) + plt.xlim((-x_max, x_max)) plt.xticks(fontsize=self.attr['fontsize_ax']) plt.yticks(fontsize=self.attr['fontsize_ax']) return ax diff --git a/monoloco/visuals/webcam.py b/monoloco/visuals/webcam.py index 6aa9489..45264c5 100644 --- a/monoloco/visuals/webcam.py +++ b/monoloco/visuals/webcam.py @@ -84,7 +84,7 @@ def webcam(args): preprocess = preprocess_factory(args) # Start recording - cam = cv2.VideoCapture(0) + cam = cv2.VideoCapture(args.camera) visualizer_mono = None while True: