Integration of Qt into OpenCV-2.4.3

asked 2014-07-03 08:08:23 -0500

msid gravatar image

updated 2014-07-03 12:30:45 -0500

Hello,

I've built Opencv with the Qt flag checked but now, I think that qt is not working properly. Indeed when I run createButton() or cvCreateButton() the big program I need to execute (which has not been made by me and was working correctly on another machine) just terminates its execution without reporting any kind of errors, just like a normal return() was called!!

Here is the portion of code with problems:

 // GUI Setup
 char *btn1 = (char*)"Original",
         *btn2 =(char*) "Edges",
         *btn3 =(char*) "Color Segmentation",
         *btn4 =(char*) "Obstacles",
         *btn5 =(char*) "Occupancy Grid",
         *btn6 =(char*) "Distance Lines",
         *btn7 =(char*) "Save Active Windows";
int value;
cout<<"d32"<<endl;

createButton(btn1,display,btn1,CV_CHECKBOX,0);

cout<<"d322"<<endl;

createButton(btn2,display,btn2,CV_CHECKBOX,0);
createButton(btn3,display,btn3,CV_CHECKBOX,0);
createButton(btn4,display,btn4,CV_CHECKBOX,1);
createButton(btn5,display,btn5,CV_CHECKBOX,1);
createButton(btn6,display,btn6,CV_CHECKBOX,0);
cout<<"d33"<<endl;

cvCreateTrackbar("Nothing",NULL,&value,1,NULL);
cvCreateButton(btn7,display,btn7,CV_CHECKBOX,0);
cout<<"d4"<<endl;

and here is the display function:

void display(int state, void* userdata){
string type((char*)userdata);

if (type.compare("Original") == 0)
    if (state == 0)
        wc.Hide("All",DRAW_ORIGINAL);
    else
        wc.Show("All",DRAW_ORIGINAL);

if (type.compare("Edges") == 0)
    if (state == 0)
        wc.Hide("All",DRAW_EDGES);
    else
        wc.Show("All",DRAW_EDGES);

if (type.compare("Color Segmentation") == 0)
    if (state == 0)
        wc.Hide("All",DRAW_AVERAGECOLOR);
    else
        wc.Show("All",DRAW_AVERAGECOLOR);

if (type.compare("Obstacles") == 0)
    if (state == 0)
        wc.Hide("All",DRAW_OBSTACLE);
    else
        wc.Show("All",DRAW_OBSTACLE);

if (type.compare("Occupancy Grid") == 0)
    if (state == 0)
        wc.Hide("None",DRAW_OCCUPANCYGRID);
    else
        wc.Show("None",DRAW_OCCUPANCYGRID);

if (type.compare("Distance Lines") == 0)
    if (state == 0)
        wc.Hide("All",DRAW_PARAMETERS);
    else
        wc.Show("All",DRAW_PARAMETERS);

if (type.compare("Save Active Windows") == 0)
    wc.SaveActiveWindows("../extra/sshot/");

}

On standard output I just have the output of the first cout (d32) and then the prompt!

I can run correctly createButton() and cvCreateTrackbar() in others projects, so maybe the problem is not in the way I built OpenCV;

I can run correctly other OpenCV function in this project (e.g. imread(), namedWindow(), imshow()), so I'm asking whether the problem could be in the way the Makefile.am and configure.ac are written: I just "ignored" Qt adding OpenCV flags where necessary. Do I have to explicitly add also the Qt library to my files? And if so, how should I do this?

Thanks for your help.

edit retag flag offensive close merge delete