Skip to content

Commit 5aea005

Browse files
committed
add option to force resolution from camera
1 parent 5200a36 commit 5aea005

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

yolo.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555
type=float,
5656
help="rescale image by this factor",
5757
default=1.0)
58+
parser.add_argument(
59+
"-s",
60+
"--set_resolution",
61+
type=int,
62+
nargs=2,
63+
help='override default camera resolution as H W')
5864
parser.add_argument(
5965
"-fs",
6066
"--fullscreen",
@@ -281,6 +287,12 @@ def getOutputsNames(net):
281287
# create window by name (as resizable)
282288
cv2.namedWindow(window_name, cv2.WINDOW_NORMAL)
283289

290+
# override default camera resolution
291+
292+
if (args.set_resolution is not None):
293+
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, args.set_resolution[1])
294+
cap.set(cv2.CAP_PROP_FRAME_WIDTH, args.set_resolution[0])
295+
284296
while (keep_processing):
285297

286298
# start a timer (to see how long processing and display takes)

0 commit comments

Comments
 (0)