Ask Your Question
0

opencv trackbar not showing at all

asked 2018-08-13 10:39:30 -0600

Allaye gravatar image

updated 2018-08-13 17:27:07 -0600

Example:

#include <opencv2/opencv.hpp>
#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 any help pls .. Thanks in advance

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2018-08-13 11:24:31 -0600

LBerger gravatar image

Please read doc . Second parameter is window name and window name is "girl"

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-08-13 10:39:30 -0600

Seen: 1,178 times

Last updated: Aug 13 '18