int createtrackbar(const string& trackbarname, const string& winname, int * value, int count, trackbarcallbackonChange=0, void* userdata=0)
Parameters:
- Trackbarname –name of the created TrackBar. Slide Bar Name
- Winname –name of the window that would be used as a parent of the created TrackBar. Add the window name of the slider bar
- value –optional pointer to an integer variable whose value reflects the position of the slider. Upon creation, the slider position is defined by this variable. slider position, usually defined as global variable ~
- Count –maximal position of the slider. The minimal position is always 0. Maximum slider position
- OnChange –pointer to the function to be called every time the slider changes position. This function should was prototyped as void Foo (int,void*); where the first parameter is the trackbar position a nd the second parameter is the user data (see the next parameter). If The callback is the NULL pointer, no callbacks was called, but only value is updated. Pointer to the callback function (called each time the slider position changes)
- userdata –user data, is passed as was to the callback. It can be used to handle TrackBar events without using global variables. Parameters passed to the callback function
Code
#include "stdafx.h" #include <cv.h> #include
OpenCV tutorials--adding A Trackbar to our applications