noobie
noobie

Reputation: 361

NULL guiReceiver 'cvCreateTrackbar2' Error on OpenCV (c++)

int LOW_H = 0;
int HIGH_H = 255;
createTrackbar("Low Hue", "Trackbar", &LOW_H, HIGH_H);

I am getting error: (-27:Null pointer) NULL guiReceiver (please create a window) in function 'cvCreateTrackbar2'

But I already created a window by using those 2 strings, didn't I?

Upvotes: 1

Views: 525

Answers (1)

Yunus Temurlenk
Yunus Temurlenk

Reputation: 4367

According to the documentation and error message, you should create the window with namedWindow before using the createTrackbar function. So your code should become as follows:

int LOW_H = 0;
int HIGH_H = 255;
cv::namedWindow("Trackbar",0);
createTrackbar("Low Hue", "Trackbar", &LOW_H, HIGH_H);

Upvotes: 1

Related Questions