Skip to content

Commit 803c1de

Browse files
committed
add set camera resolution
1 parent 2b40a65 commit 803c1de

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

DoG.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("-i", "--is_image", action='store_true',
4248
help="specify file is an image, not a video")
4349
parser.add_argument(
@@ -104,6 +110,16 @@ def nothing(x):
104110
sigmaL = 1 # greater than 7 seems to crash
105111
cv2.createTrackbar("sigma L", window_nameL, sigmaL, 15, nothing)
106112

113+
# override default camera resolution
114+
115+
if (args.set_resolution is not None):
116+
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, args.set_resolution[1])
117+
cap.set(cv2.CAP_PROP_FRAME_WIDTH, args.set_resolution[0])
118+
119+
print("INFO: input resolution : (",
120+
int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), "x",
121+
int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)), ")")
122+
107123
while (keep_processing):
108124

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

0 commit comments

Comments
 (0)