Monday, 15 April 2013

c++ - Simple OpenCV Program crashes -


I currently have a problem in OpenCV (2.4.10-1) to create a simple image display program in this book Following the instructions in "OpenCV2 Computer Vision Applications Programming Cookbook", QT (5.4), Quiet Seater Ubuntu 14.04 use.

The code is as follows:

  #include & lt; Opencv2 / core / core.hpp & gt; #include & lt; Opencv2 / highgui / highgui.hpp & gt; # Include & lt; Iostream & gt; Int main () {// read an image cv :: Mat image = cv :: imread ("$ {PATH_TO_HOME} / picture / bottle_label.jpg"); If (image.data == faucet) {std :: cout & lt; & Lt; "No data loaded" & lt; & Lt; Std :: endl; Return -1; } Else {// "My image" cv :: nameWindow create an image window ("My image", 1); // show the image in the window std :: cout & lt; & Lt; "Image load" & lt; & Lt; Std :: endl; Cv :: imshow ("My image", Image); // 5000 ms waiting for cv key: wait (5000); Return 0; }}  

and .pro file contents

  # .pro content for # QT console applications # include + = / usr / local / code Compiles, but when I crash the program to run it / libas + = -l / usr / local / library / lopencv_imgproc -lopencv_features2d -lopencv_calib3d  

debugger points Generates a SIGSEGV in 17: cv :: nameWindow ("My image", 1) I do not know what to do. I have other programs that use Qt and OpenCV library in the same computer but they use cmake (qt4 macros) to create them and they go well. I used CMakeList.txt file in CMake and new qt5 macros Another similar test program is also written using. The program has a main window that has two buttons: First, a file opens an image selected from the Open Dialogue and flips to another image. Both images should be displayed using the CV :: imshow () function. The program compiles, when I run it, it crashes instantly. Debugger does not point to a particular line in my code that the output in the console is:

  *** $ Error in $ {PATH_TO_EXEC_FILE} / myGUIApp ': realloc (): Invalid Pointer: 0x00007ffff6d840e0 ***  

The same console output is distributed with the above code, no one can tell that where is the problem?

Thank you in advance


No comments:

Post a Comment