|
49 | 49 | "--fullscreen", |
50 | 50 | action='store_true', |
51 | 51 | help="run in full screen mode") |
| 52 | +parser.add_argument( |
| 53 | + "-nc", |
| 54 | + "--nocontrols", |
| 55 | + action='store_true', |
| 56 | + help="no onscreen controls") |
52 | 57 | parser.add_argument( |
53 | 58 | 'video_file', |
54 | 59 | metavar='video_file', |
@@ -107,18 +112,19 @@ def nothing(x): |
107 | 112 | # add some track bar controllers for settings |
108 | 113 |
|
109 | 114 | lower_threshold = 25 |
110 | | - cv2.createTrackbar("lower", window_name2, lower_threshold, 255, nothing) |
111 | 115 | upper_threshold = 120 |
112 | | - cv2.createTrackbar("upper", window_name2, upper_threshold, 255, nothing) |
113 | 116 | smoothing_neighbourhood = 3 |
114 | | - cv2.createTrackbar( |
115 | | - "smoothing", |
116 | | - window_name2, |
117 | | - smoothing_neighbourhood, |
118 | | - 15, |
119 | | - nothing) |
120 | 117 | sobel_size = 3 # greater than 7 seems to crash |
121 | | - cv2.createTrackbar("sobel size", window_name2, sobel_size, 7, nothing) |
| 118 | + |
| 119 | + if (not (args.nocontrols)): |
| 120 | + cv2.createTrackbar("lower", window_name2, lower_threshold, |
| 121 | + 255, nothing) |
| 122 | + cv2.createTrackbar("upper", window_name2, upper_threshold, |
| 123 | + 255, nothing) |
| 124 | + cv2.createTrackbar("smoothing", window_name2, smoothing_neighbourhood, |
| 125 | + 15, nothing) |
| 126 | + cv2.createTrackbar("sobel size", window_name2, sobel_size, |
| 127 | + 7, nothing) |
122 | 128 |
|
123 | 129 | # override default camera resolution |
124 | 130 |
|
@@ -151,10 +157,12 @@ def nothing(x): |
151 | 157 |
|
152 | 158 | # get parameters from track bars |
153 | 159 |
|
154 | | - lower_threshold = cv2.getTrackbarPos("lower", window_name2) |
155 | | - upper_threshold = cv2.getTrackbarPos("upper", window_name2) |
156 | | - smoothing_neighbourhood = cv2.getTrackbarPos("smoothing", window_name2) |
157 | | - sobel_size = cv2.getTrackbarPos("sobel size", window_name2) |
| 160 | + if (not (args.nocontrols)): |
| 161 | + lower_threshold = cv2.getTrackbarPos("lower", window_name2) |
| 162 | + upper_threshold = cv2.getTrackbarPos("upper", window_name2) |
| 163 | + smoothing_neighbourhood = cv2.getTrackbarPos("smoothing", |
| 164 | + window_name2) |
| 165 | + sobel_size = cv2.getTrackbarPos("sobel size", window_name2) |
158 | 166 |
|
159 | 167 | # check neighbourhood is greater than 3 and odd |
160 | 168 |
|
|
0 commit comments