Skip to content

Commit 6a040f5

Browse files
committed
add set resolution options
1 parent 803c1de commit 6a040f5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

calibrate_camera.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
type=float,
4545
help="rescale image by this factor",
4646
default=1.0)
47+
parser.add_argument(
48+
"-s",
49+
"--set_resolution",
50+
type=int,
51+
nargs=2,
52+
help='override default camera resolution as H W')
4753
parser.add_argument(
4854
"-cbx",
4955
"--chessboardx",
@@ -142,6 +148,16 @@
142148

143149
if cap.open(args.camera_to_use):
144150

151+
# override default camera resolution
152+
153+
if (args.set_resolution is not None):
154+
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, args.set_resolution[1])
155+
cap.set(cv2.CAP_PROP_FRAME_WIDTH, args.set_resolution[0])
156+
157+
print("INFO: input resolution : (",
158+
int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), "x",
159+
int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)), ")")
160+
145161
while (not (do_calibration)):
146162

147163
# grab frames from camera

0 commit comments

Comments
 (0)