Ask Your Question
0

opencv trackbar not showing at all

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

Allaye gravatar image

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

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 -0500

LBerger gravatar image

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

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 31 times

Last updated: Aug 13 '18