File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939 type = float ,
4040 help = "rescale image by this factor" ,
4141 default = 1.0 )
42+ parser .add_argument (
43+ "-s" ,
44+ "--set_resolution" ,
45+ type = int ,
46+ nargs = 2 ,
47+ help = 'override default camera resolution as H W' )
4248parser .add_argument (
4349 "-ocl" ,
4450 "--opencl" ,
@@ -112,6 +118,16 @@ def nothing(x):
112118 250 ,
113119 nothing )
114120
121+ # override default camera resolution
122+
123+ if (args .set_resolution is not None ):
124+ cap .set (cv2 .CAP_PROP_FRAME_HEIGHT , args .set_resolution [1 ])
125+ cap .set (cv2 .CAP_PROP_FRAME_WIDTH , args .set_resolution [0 ])
126+
127+ print ("INFO: input resolution : (" ,
128+ int (cap .get (cv2 .CAP_PROP_FRAME_WIDTH )), "x" ,
129+ int (cap .get (cv2 .CAP_PROP_FRAME_HEIGHT )), ")" )
130+
115131 while (keep_processing ):
116132
117133 # start a timer (to see how long processing and display takes)
You can’t perform that action at this time.
0 commit comments