0
votes

I would like to use opencv callback in more details than described in OpenCV documentation.

For example, createTrackbar(const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0)

here I hardly know more information about TrackbarCallback. It's arguments input/output or whether I can modify this interface.

Could I have some support or reference with more details?

Thank you!

Edit 01:

I've tested this code:

int arr[3] = {3,2,1};
    int *iptr = arr;
createTrackbar( "trackbar value:", "window", &val, max_val, thresh_callback, (void*)iptr); 

and

void thresh_callback(int num, void* data)
{
    cout << num << endl;
    cout << *((int*)data) << endl;

}

I'm trying to add more data and change original interface of callback i.e. callback(int,void*) there's no compile error but the call back evokes "Access violation reading location"

1

1 Answers

1
votes

If you need to pass more data maybe you could pack that data into a struct and pass a pointer to that into the callback rather than trying to change the original interface? :)