Ask Your Question

msid's profile - activity

2014-07-03 08:08:23 -0600 asked a question Integration of Qt into OpenCV-2.4.3

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.

2014-06-24 08:35:12 -0600 received badge  Editor (source)
2014-06-24 06:25:58 -0600 asked a question Build a project using Automake (Make error: undefined reference to openCV functions (error: ld returned 1 exit status))

Hello,

I'm totally new to Make and Automake but I need to build a project which uses Automake. I'm using Ubuntu 12.04 and I've installed with succes the openCV library (version 2.4.3) which I had used in several small projects which I built using:

g++ sourcefile.cpp pkg-config opencv --cflags --libs . .

Now, I think that the reason why Make gives me this error is because I haven't added the instruction pkg-config opencv --cflags --libs in the proper Makefile.am .

I've tried to add that instruction to the LDFLAGS but Make keeps on giving me the same error in output.

This is the src/libcnbiVisualNavigation/Makefile.am I tried to modify:

lib_LTLIBRARIES = libnavigation.la include_HEADERS = \ some_headers.h

libnavigation_la_SOURCES = \ some_sources.cpp

libnavigation_la_LDFLAGS = -version-info $(CURRENT):$(REVISION):$(AGE) -release $(RELEASE) pkg-config opencv --cflags --libs

libnavigation_la_LIBADD = -lm $(OPENCV_LIBS) -lboost_thread-mt -lboost_signals-mt -lcnbiVisualNavigation

This is the output that make gives to me:


Making all in src/libnavigation make[1]: Entering directory /home/robotinob/mlwcp/ccp/wccontrol/build/src/libnavigation' make[1]: Nothing to be done forall'. make[1]: Leaving directory /home/robotinob/mlwcp/ccp/wccontrol/build/src/libnavigation' Making all in src/bin make[1]: Entering directory/home/robotinob/mlwcp/ccp/wccontrol/build/src/bin' make[1]: Nothing to be done for all'. make[1]: Leaving directory/home/robotinob/mlwcp/ccp/wccontrol/build/src/bin' Making all in examples make[1]: Entering directory /home/robotinob/mlwcp/ccp/wccontrol/build/examples' /bin/bash ../libtool --tag=CXX --mode=link g++ -g -O2 -L/home/robotinob/OpenRobotino//lib: -o wheelchair wheelchair.o ../src/libnavigation/libnavigation.la
libtool: link: g++ -g -O2 -o .libs/wheelchair wheelchair.o -L/home/robotinob/OpenRobotino//lib: ../src/libnavigation/.libs/libnavigation.so wheelchair.o: In function
main': /home/robotinob/mlwcp/ccp/wccontrol/build/examples/../../examples/wheelchair.cpp:391: undefined reference to cv::getTickFrequency()' /home/robotinob/mlwcp/ccp/wccontrol/build/examples/../../examples/wheelchair.cpp:397: undefined reference tocv::waitKey(int)' /home/robotinob/mlwcp/ccp/wccontrol/build/examples/../../examples/wheelchair.cpp:403: undefined reference to cv::getTickCount()' /home/robotinob/mlwcp/ccp/wccontrol/build/examples/../../examples/wheelchair.cpp:428: undefined reference tocv::getTickCount()' /usr/local/lib/libcnbiVisualNavigation-0.so.0: undefined reference to cv::VideoCapture::get(int)' ../src/libnavigation/.libs/libnavigation.so: undefined reference tocv::rectangle(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' ../src/libnavigation/.libs/libnavigation.so: undefined reference to cv::Mat::deallocate()' /usr/local/lib/libcnbiVisualNavigation-0.so.0: undefined reference tocv::VideoCapture::read(cv::Mat&)' /usr/local/lib/libcnbiVisualNavigation-0.so.0: undefined reference to typeinfo for cv::VideoCapture' /usr/local/lib/libcnbiVisualNavigation-0.so.0: undefined reference tocv::clipLine(cv::Size_<int>, cv::Point_<int>&, cv::Point_<int>&)' ../src/libnavigation/.libs/libnavigation.so: undefined reference to cv::warpAffine(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&)' /usr/local/lib/libcnbiVisualNavigation-0.so.0: undefined reference tocv::GaussianBlur(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double ... (more)