[英]OpenCv Error in C Wrapper for imread: QNativeImage: Unable to attach to shared memory segment
Here is my code I am running. 这是我正在运行的代码。 I'm using Ubuntu trusty with g++ in Emacs.
我在Emacs中使用Ubuntu可靠的g ++。 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.
该程序工作,它使用C包装器imread和imshow在代码中的主要上面。 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.
图片出现但是在窗口打开后我得到了如下所示的长串代码...它必须是我的包装器,因为C ++ imread和imshow工作完美。包装器是由软件分析师编写的,尽管它们包含在OpenCv所以我不确定是什么问题。 Googling brings up VLC, Ubuntu, and qt bugs but none for OpenCV.
谷歌搜索引发了VLC,Ubuntu和qt错误,但OpenCV没有。 The wrappers are made for other languages to wrap around and cv_imread isn't working.
包装器是为其他语言包装而cv_imread不起作用的。 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.
我重建并重新安装opencv作为我的一个步骤,但得到了同样的信息。 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
C++ is capital sensitive, opencv use string as its parameter, but you use String. C ++是大写敏感的,opencv使用字符串作为参数,但是你使用String。 I think string and String are different thing.
我认为字符串和字符串是不同的东西。 Refer function prototype below:
参考下面的功能原型:
static void*
imread_( const string& filename, int flags, int hdrtype, Mat* mat=0 )
Mat imread( const string& filename, int flags )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.