diff --git a/canny.py b/canny.py index afb9755..c3f8b08 100644 --- a/canny.py +++ b/canny.py @@ -38,6 +38,12 @@ type=float, help="rescale image by this factor", default=1.0) +parser.add_argument( + "-s", + "--set_resolution", + type=int, + nargs=2, + help='override default camera resolution as H W') parser.add_argument( 'video_file', metavar='video_file', @@ -107,6 +113,12 @@ def nothing(x): sobel_size = 3 # greater than 7 seems to crash cv2.createTrackbar("sobel size", window_name2, sobel_size, 7, nothing) + # override default camera resolution + + if not(args.set_resolution is None): + cap.set(cv2.CAP_PROP_FRAME_HEIGHT, args.set_resolution[1]) + cap.set(cv2.CAP_PROP_FRAME_WIDTH, args.set_resolution[0]) + while (keep_processing): # if video file successfully open then read frame from video