I want to make a MENU trackbar which change the parameter that the user want to change. So if it is set on "1" the BLUR trackbar appears and we can blur the picture, if "2" the ALPHA and BETA trackbars appear and we can change brightness and contrast but the BLUR trackbar is still visible and we can change blur as well and I want it to be seen only when the MENU trackbar's value is 1. I've tried to do it with 'if', 'switch' and even 'while' but they don't work. It may be possible with erasing other trackbars in exact condition but I haven't found function that do it. Or any ideas how to show just precise trackbar?
Here is a part of the code (.cpp):
#include <opencv2\opencv.hpp>
#include <iostream>
using namespace cv;
const int slider_max = 100, slider2_max = 100, slider3_max = 100, slider5_max = 2;
int slider = 0, slider2 = 0, slider3 = 0, slider5 = 0;
(...)
void transf(int, void*)
{
(...)
if (slider5 == 0)
{
setTrackbarPos(ALPHA, name3, 0);
setTrackbarPos(BETA, name3, 0);
setTrackbarPos(BLUR, name3, 0);
imshow(name, before);
}
if (slider5 == 1)
{
setTrackbarPos(ALPHA, name3, 0);
setTrackbarPos(BETA, name3, 0);
createTrackbar(BLUR, name3, &slider, slider_max, blur);
blur(0,0);
}
if (slider5 == 2)
{
setTrackbarPos(BLUR, name3, 0);
createTrackbar(ALPHA, name3, &slider2, slider2_max+100, contrBright);
createTrackbar(BETA, name3, &slider3, slider3_max, contrBright);
contrBright(0,0);
}
}
int main()
{
(...)
createTrackbar(MENU, name, &slider5, slider5_max, transf);
transf(0,0);
waitKey(0);
return 0;
}