Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to create Trackbars which do not call any function? OpenCV 3.1 with Python 2.7

Hi there!
I'm trying to threshold an image. I have used the cv2.createTrackbar function as-
cv2.createTrackbar('High H','image',0,179, None).
Now the last part is what I'm having trouble with. Further in my code, I use highH = cv2.getTrackbarPos('High H','image') to get my trackbar value and use it in the cv2.inRange function. So it becomes pretty obvious that I do not need to call a function as the last argument of the function. Now the problem is I can't seem to type in the function. I tried removing the last part, I got an error-

cv2.createTrackbar only works with 5 arguements. Only 4 given.
Hmm, okay seems like I can't skip a part.

Next I tried callback and nothing. I got this error:-
When used nothing:- NameError: name 'nothing' is not defined
When used callback:- NameError: name 'callback' is not defined

Okay after a while I tried using None. Got this error:- TypeError: on_change must be callable
So how do I use the cv2.createTrackbar function without calling a function?

Thanks!