Skip to content

Commit a24581c

Browse files
committed
add -s option to override default camera resolution
1 parent 39c6c69 commit a24581c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

canny.py

+12
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
type=float,
3939
help="rescale image by this factor",
4040
default=1.0)
41+
parser.add_argument(
42+
"-s",
43+
"--set_resolution",
44+
type=int,
45+
nargs=2,
46+
help='override default camera resolution as H W')
4147
parser.add_argument(
4248
'video_file',
4349
metavar='video_file',
@@ -107,6 +113,12 @@ def nothing(x):
107113
sobel_size = 3 # greater than 7 seems to crash
108114
cv2.createTrackbar("sobel size", window_name2, sobel_size, 7, nothing)
109115

116+
# override default camera resolution
117+
118+
if not(args.set_resolution is None):
119+
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, args.set_resolution[1])
120+
cap.set(cv2.CAP_PROP_FRAME_WIDTH, args.set_resolution[0])
121+
110122
while (keep_processing):
111123

112124
# if video file successfully open then read frame from video

0 commit comments

Comments
 (0)