Usage of createTrackbar for QT control panel possible?
Hello,
I would like to use the function "createTrackbar" for creating a trackbar on the QT control panel.
The info about this feature you can find here: http://docs.opencv.org/modules/highgui/doc/qt_new_functions.html
If I use "cvCreateTrackbar" with NULL as window everything works fine but with createTrackbar it ist not working.
Has anybody an idea how to fix this?
This is a working minimal:
#include "opencv2/core/core.hpp"
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
const int slider_1_max = 255;
int slider_1 = 0;
const int slider_2_max = 255;
int slider_2 = 0;
Mat test;
void on_trackbar_1(int pos)
{
pos=slider_1;
}
void on_trackbar_2(int pos, void*)
{
}
int main ()
{
namedWindow("Test");
cvCreateTrackbar("One",NULL, &slider_1,slider_1_max, on_trackbar_1);
//Not working:
//createTrackbar("Two",NULL, &slider_2,slider_2_max, on_trackbar_2);
while (char(waitKey(1)) != 'q'){}
return 0;
}
Thank you very much :-)
damn, that tutorial needs an overhaul...
are you on win ? usually, when you can use a cv* function, but not the cv:: equivalent, it is a linker problem(due to std::string)
No, I am using Ubuntu.
The error is: "terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid"
If it is really a linker problem, how can I solve it? I use OpenCV a lot with the C++ functions and there are no other errors.