OpenCv错误在C包装为imread: QNativeImage:无法连接到共享内存段
OpenCv Error in C Wrapper for imread: QNativeImage: Unable to attach to shared memory segment
这是我正在运行的代码。我正在使用Ubuntu,在Emacs中使用g++。我在这一页的底部看到了错误,但我可以借助帮助找出它们。该程序工作,它使用C包装为imread和imshow上面的主代码。图片出现,但窗口打开后,我得到长串代码如下…这一定是我的包装器,因为c++ imread和imshow工作得很完美…包装器是由软件分析师编写的,尽管它们被包含在OpenCv中,所以我不确定问题是什么。谷歌搜出了VLC、Ubuntu和qt的bug,但没有OpenCV的。包装器是为其他语言设计的,cv_imread不起作用。这就是我决定通过运行它们来进行调试的原因。然后我发现了这个。我重建并重新安装了opencv作为我的步骤之一,但得到了相同的信息。任何帮助都是感激的。
#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;
}
错误:
(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++是大小写敏感的,opencv使用string作为参数,但是你使用string。我认为string和string是不同的东西。参考下面的函数原型:
static void*
imread_( const string& filename, int flags, int hdrtype, Mat* mat=0 )
Mat imread( const string& filename, int flags )
相关文章:
- 将成员变量添加到共享库中的类中,不会破坏二进制兼容性吗
- 是否可以通过C++扩展强制多个python进程共享同一内存
- 在cuda线程之间共享大量常量数据
- 当套接字连接断开时检测C/C++Unix
- 如何从具有移动语义的类对象中生成共享指针
- 在c代码之间共享数据的最佳方式
- 在两个类中共享相同的函数调用,并在不需要时避免空实例化
- 将静态库链接到不带-fPIC的共享库中
- 为什么std::互斥需要很长的、非常不规则的时间来共享
- 无法在windows上使用mingw将sqlite3与c连接
- 使用Boost Interprocess创建托管共享内存需要很长时间
- 到连接组件算法的问题(递归)
- 无法在Ubuntu上将共享库与Eclipse链接
- 是否有 Windows 用户空间函数来枚举连接的网络共享?
- 在QT中的两个窗口之间共享websocket连接
- 如何从连接到共享打印对象的客户端的服务器获取所有IP(或用户名)
- 具有共享边界的最小连接区域的图论算法
- 线程上的共享指针在连接后计数为1
- 两个对象内部的共享指针相互连接
- OpenCv错误在C包装为imread: QNativeImage:无法连接到共享内存段