Here is my code I am running. I'm using Ubuntu trusty with g++ in Emacs. I'm getting the errors at the bottom of page but I could use help to figure them out. The program works, it uses the C wrappers for imread and imshow above the main in the code. The picture comes up but right after window opens i get long string of code as below...It must be my wrappers because the C++ imread and imshow work perfect..The wrappers were written by a software analyst though they are up for inclusion in OpenCv so I'm not sure what the issue is. Googling brings up VLC, Ubuntu, and qt bugs but none for OpenCV. The wrappers are made for other languages to wrap around and cv_imread isn't working. That is the reason I decided to debug by running them. Then I discovered this. I rebuilt and reinstalled opencv as one of my steps but got the same message. Any help is appreciated.
#include "opencv2/highgui/highgui.hpp" #include "opencv2/highgui/highgui_c.h" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgproc/imgproc_c.h" #include <iostream> using namespace cv; using namespace std; Mat* cv_imread(String* filename, int flags) { return new Mat(imread(*filename, flags)); } void cv_imshow(String* winname, Mat* mat) { cv::imshow(*winname, *mat); } int main( ) { const char* a = "/home/w/100_0229.JPG"; const char* c = "String"; Mat* b = cv_imread(new String (a), 1); cv_imshow(new String (c), b); waitKey(0); //wait infinite time for a keypress destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow" return 0; }
Errors:
(b:19717): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks", init done opengl support available QNativeImage: Unable to attach to shared memory segment. X Error: BadDrawable (invalid Pixmap or Window parameter) 9 Major opcode: 62 (X_CopyArea) Resource id: 0x0 X Error: BadDrawable (invalid Pixmap or Window parameter) 9 Major opcode: 62 (X_CopyArea) Resource id: 0x0 X Error: BadDrawable (invalid Pixmap or Window parameter) 9 Major opcode: 62 (X_CopyArea) Resource id: 0x0 X Error: BadDrawable (invalid Pixmap or Window parameter) 9 Major opcode: 62 (X_CopyArea) Resource id: 0x0 X Error: BadDrawable (invalid Pixmap or Window parameter) 9 Major opcode: 62 (X_CopyArea) Resource id: 0x0 X Error: BadDrawable (invalid Pixmap or Window parameter) 9 Major opcode: 62 (X_CopyArea) Resource id: 0x0 X Error: BadDrawable (invalid Pixmap or Window parameter) 9 Major opcode: 62 (X_CopyArea) Resource id: 0x0 X Error: BadDrawable (invalid Pixmap or Window parameter) 9 Major opcode: 62 (X_CopyArea) Resource id: 0x0 1uuuuuuu Compilation finished at Mon Mar 24 02:46:13