namedWindow()导致在opencv 2.3.1中崩溃? (Eclipse + MinGW XP,C ++) [英] namedWindow() causes crash in opencv 2.3.1? (Eclipse+MinGW on XP, C++)

查看:360
本文介绍了namedWindow()导致在opencv 2.3.1中崩溃? (Eclipse + MinGW XP,C ++)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我终于设法使opencv 2.3.1与eclipse,mingw和32位XP一起使用。当我找不到这个工具链时,我会提出一个工作方法。



麻烦的是,任何在窗口中显示结果的尝试都会导致未处理的异常。图像保存不错,我能够在其上运行一个Sobel内核,所以其他一切似乎都很好。调用namedWindow时,似乎崩溃了。



我将包含libopencv_core231,libopencv_highgui231,libopencv_imgproc231和libopencv_legacy231与链接器。



这是代码:

  #include< cv.h> 
#include< highgui.h>
#include< iostream>

使用命名空间cv;

int main(int argc,char ** argv)
{
std :: cout<"Hello<< std :: endl;

//创建图像
Mat lena,lenasobel;

//加载lena图像
lena = imread(C:\\lena.jpeg);

if(lena.data)
std :: cout<File has< lena.cols<<rows and< lena.rows< ;<列。<< lena.channels()<"channels。< std :: endl;

if(!lena.data)
std :: cout<File Not Read。<< std :: endl;

lenasobel = lena.clone();
Sobel(lena,lenasobel,lenasobel.depth(),1,1,3);

std :: vector< int> jpg_type;
jpg_type.push_back(100);
jpg_type.push_back(CV_IMWRITE_JPEG_QUALITY);

imwrite(C:\\lenaout.jpeg,lenasobel,jpg_type);

//保存作品!

namedWindow(lena,CV_WINDOW_AUTOSIZE);
imshow(lena,lena);

return 0;
}

有没有人有任何想法?我不知道下一步该怎么办?

解决方案

这可能是由于这个 bug 。我实际上必须设置 BUILD_TYPE = Debug ,并禁用所有SSE优化,使OpenCV能够与Eclipse + MinGW一起使用。


I've finally managed to get opencv 2.3.1 to work with eclipse, mingw and 32 bit XP. I'll put up a howto when everzthing works, as I couldn't find one for this toolchain.

The trouble is that any attempt to show the results in a window causes an unhandled exception. The images save fine, and I was able to run an Sobel kernel on them so everything else seems fine. It seems to crash when namedWindow is called.

I'm including libopencv_core231, libopencv_highgui231, libopencv_imgproc231 and libopencv_legacy231 with the linker.

Here is the code:

            #include <cv.h>
            #include <highgui.h>
            #include <iostream>

            using namespace cv;

            int main(int argc, char **argv)
            {
                std::cout<<"Hello"<<std::endl;

                //Create image
                Mat lena, lenasobel;

                //Load lena image
                lena = imread("C:\\lena.jpeg");

                if(lena.data)
                std::cout<<"File has "<<lena.cols<<" rows and "<<lena.rows<<" columns. "<<lena.channels()<<" channels."<<std::endl;

                if(!lena.data)
                std::cout<<"File Not Read."<<std::endl;

                lenasobel=lena.clone();
                Sobel(lena,lenasobel,lenasobel.depth(),1,1,3);

                std::vector<int> jpg_type;
                jpg_type.push_back(100);
                jpg_type.push_back(CV_IMWRITE_JPEG_QUALITY);

                imwrite("C:\\lenaout.jpeg",lenasobel,jpg_type);

                //Save works!

                namedWindow( "lena" , CV_WINDOW_AUTOSIZE);
                imshow( "lena" ,lena);

                return 0;
            }

Does anyone have any ideas? I'm not sure what to do next!

解决方案

This is probably due to this bug that has been hanging around. I actually had to set BUILD_TYPE=Debug and disable all SSE optimizations to get OpenCV to work with Eclipse + MinGW.

这篇关于namedWindow()导致在opencv 2.3.1中崩溃? (Eclipse + MinGW XP,C ++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆