C++: int createTrackbar(const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0) In above mention function what is the userdata how it will used in the callback function
that param is useful together with a callback function, which looks like this:
void onChange (int trackpos , void *userdata);
you can e.g pass (the address of) an image to it:
Mat img; // e.g from a webcam
int b=3; // blur value
namedWindow("win");
createTrackBar("blur","win", &b, 100, onChange, (void*)(&img) );
and use it inside the callback:
void onChange (int trackpos , void *userdata)
{
Mat img = *((Mat*)userdata); // 1st cast, then deref
Mat b2;
blur( img,b2, Size(trackpos,trackpos));
imshow("win",b2);
waitKey(10);
}