May-24-2020, 10:22 PM
I am tinkering with cv2 Trackbars and would like to use one to configure an image capture system. I have a trackbar function that works, but I cannot get it to return the value outside the function. I have returned values before in other functions with the "return" syntax, but the "threshold_value" and "threshold_type" are not visible outside the function.
I have no doubt I am missing something obvious, but I cannot see it. Any help is appreciated.
I have no doubt I am missing something obvious, but I cannot see it. Any help is appreciated.
1 2 3 4 5 6 7 8 |
def Threshold(val): threshold_type = cv.getTrackbarPos(trackbar_type, window_name) threshold_value = cv.getTrackbarPos(trackbar_value, window_name) _, dst = cv.threshold(src_gray, threshold_value, max_binary_value, threshold_type ) cv.imshow(window_name, dst) print (threshold_value) print (threshold_type) |