include
#include <opencv/highgui.h>
#include <iostream>
using namespace std;
using namespace cv;
Mat srimg, deimg;
int max_brightness = 100;
int slider_b = (max_brightness / 2);
void on_change_brightness(int, void*)
{
int brightness = slider_b - (max_brightness / 2);
deimg = srimg + Scalar::all(brightness);
imshow("Girl", deimg);
}
int main()
{
srimg = imread("lenna.PNG");
imshow("girl", srimg);
createTrackbar("Track", "Window", &slider_b, max_brightness,on_change_brightness);
waitKey();
return EXIT_SUCCESS;
}
Note:: when I run the code it works well no error, but the track bar does not show up, and to my knowledge everything should be fine.