Skip to content

Commit 74f8db6

Browse files
committed
add set resolution
1 parent 4b3d859 commit 74f8db6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

contour_edges.py

Lines changed: 16 additions & 0 deletions
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,16 @@ 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 (args.set_resolution is not 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+
122+
print("INFO: input resolution : (",
123+
int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), "x",
124+
int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)), ")")
125+
110126
while (keep_processing):
111127

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

0 commit comments

Comments
 (0)