Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2016-03-31 04:27:08 -0600

Nbb gravatar image

Trackbar pass variable

Hello,

How do I pass a variable using a trackbar ? I do not want it to be a global variable like http://docs.opencv.org/2.4/doc/tutorials/highgui/trackbar/trackbar.html Id like it to be something like below

createTrackbar( TrackbarName, "Linear  Blend", &alpha_slider, alpha_slider_max, on_trackbar(alpha_slider) );

void on_trackbar(int alpha_slider) {
cout << alpha_slider 
}

Trackbar pass variable

Hello,

How do I pass a variable using a trackbar ? I do not want it to be a global variable like http://docs.opencv.org/2.4/doc/tutorials/highgui/trackbar/trackbar.html Id like it to be something like below

createTrackbar( TrackbarName, "Linear  Blend", &alpha_slider, alpha_slider_max, on_trackbar(alpha_slider) );
on_trackbar);
createTrackbar( TrackbarName, "Linear  Blend", &beta_slider, alpha_slider_max, on_trackbar);


void on_trackbar(int alpha_slider) alpha_slider, int beta_slider) {
cout << alpha_slider 
}

Trackbar pass variable

Hello,

How do I pass a variable using a trackbar ? I do not want it to be a global variable like http://docs.opencv.org/2.4/doc/tutorials/highgui/trackbar/trackbar.html Id like it to be something like below

createTrackbar( TrackbarName, "Linear  Blend", &alpha_slider, alpha_slider_max, on_trackbar);
createTrackbar( TrackbarName, "Linear  Blend", &beta_slider, alpha_slider_max, on_trackbar);


void on_trackbar(int alpha_slider, int beta_slider) {
cout << alpha_slider 
cout << beta_slider
}

Trackbar pass variable

Hello,

How do I pass a variable using a trackbar ? I do not want it to be a global variable like http://docs.opencv.org/2.4/doc/tutorials/highgui/trackbar/trackbar.html Id like it to be something like below

createTrackbar( TrackbarName, "Linear  Blend", &alpha_slider, alpha_slider_max, on_trackbar);
createTrackbar( TrackbarName, "Linear  Blend", &beta_slider, alpha_slider_max, on_trackbar);


void on_trackbar(int alpha_slider, in, void*) {

int beta_slider) {
cout slider_val= *((int*)&in);

//How do I print the current slider value of alpha and beta ?
//cout << alpha_slider 
cout //cout << beta_slider
}