OpenCV 2.4.5,蚀CDT Juno,MinGW错误0xc0000005 [英] OpenCV 2.4.5, eclipse CDT Juno, MinGW error 0xc0000005

查看:124
本文介绍了OpenCV 2.4.5,蚀CDT Juno,MinGW错误0xc0000005的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 7 64位AMD处理器上,我安装了带有Eclipse CDT Juno和MinGW的OpenCV 2.4.5,所有内容均为最新更新.以前,eclipse CDT和MinGW编译了100多个源文件,没有问题.他们甚至编译了这个小的OpenCV源文件,

On Windows 7 64 bit, AMD processor, I installed OpenCV 2.4.5, with eclipse CDT Juno and MinGW, everything to the latest update. Previously eclipse CDT and MinGW compiled 100+ source files without problems. They even compile this small OpenCV source file,

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>

using namespace std;

int main()
{
    IplImage* img1 = cvLoadImage("lenna.png");
    cvShowImage("MyWindow1", img1);

    cv::Mat img2;
    img2 = cv::imread("lenna.png", CV_LOAD_IMAGE_COLOR);

    cv::namedWindow("MyWindow2", CV_WINDOW_AUTOSIZE);
    cv::imshow("MyWindow2", img2);

    cvWaitKey(0);
    return 0;
}

但是当我尝试运行它时,它会臭名昭著

but when I try to Run it then it breaks with notorious

该应用程序无法正确启动(0xc0000005).单击确定". 关闭应用程序."

"The application was unable to start correctly (0xc0000005). Click OK to close the application."

什么可能是错误的,什么是解决该问题的方法?

What might be wrong and what would be solution to this problem?

  1. OpenCV(预编译)已解压缩到"C:\ OpenCV245PC \(所有子文件夹均包含自述文件,index.rst和CMakeLists.txt)
  2. Windows系统路径设置为C:\ OpenCV245PC \ build \ x86 \ mingw \ bin
  3. Eclipse GCC C ++编译器,包含路径(-I)设置为"C:\ OpenCV245PC \ build \ include"
  4. Eclipse MinGW C ++链接器,库搜索路径(-L)设置为:"C:\ OpenCV245PC \ build \ x86 \ mingw \ lib"
  5. Eclipse MinGW C ++链接器,库(-l)设置为:

opencv_calib3d245 opencv_contrib245 opencv_core245 opencv_features2d245 opencv_flann245 opencv_gpu245 opencv_highgui245 opencv_imgproc245 opencv_legacy245 opencv_ml245 opencv_nonfree245 opencv_objdetect245 opencv_photo245 opencv_stitching245 opencv_video245 opencv_videostab245

opencv_calib3d245 opencv_contrib245 opencv_core245 opencv_features2d245 opencv_flann245 opencv_gpu245 opencv_highgui245 opencv_imgproc245 opencv_legacy245 opencv_ml245 opencv_nonfree245 opencv_objdetect245 opencv_photo245 opencv_stitching245 opencv_video245 opencv_videostab245

推荐答案

经过多次试验和错误,我决定遵循

After many trials and errors I decided to follow this tutorial and to compile my own binaries as it seems that too many people are complaining that precompiled binaries are NOT working for them. Eclipse CDT Juno was already installed.

我的程序如下:

  1. 下载并安装MinGW并使用以下命令添加到系统PATH c:/mingw/bin
  2. http://www.cmake.org 下载cmake并安装
  3. 下载OpenCV2.4.5 Windows版本
  4. 将Opencv安装/解压缩到C:\ OpenCV245PC \(所有子文件夹均包含README,index.rst和CMakeLists.txt)
  5. 运行CMake GUI工具,然后
  6. 选择C:\ OpenCV245PC \作为来源
  7. 选择目标位置C:\ OpenCV245MinGW \ x86,在其中构建二进制文件
  8. 按配置"按钮,选择MinGW Makefiles作为生成器.窗口中有一些红色的高光,请根据需要选择选项.
  9. 再次点击配置按钮 .配置已完成.
  10. 按下生成"按钮.
  11. 完成生成后退出程序.
  12. 退出Cmake程序.
  13. 运行命令行模式(cmd.exe)并转到目标 目录C:\ OpenCV245MinGW \ x86
  14. 键入"mingw32-make".您会看到建筑的进度 二进制文件.如果找不到该命令,则必须确保 系统路径添加了c:/mingw/bin.构建继续 根据选择的选项完成操作.
  15. 在Windows系统路径中(我的电脑>右键单击> 属性>高级>环境变量>路径)添加 目的地的bin目录C:\ OpenCV245MinGW \ x86 \ bin
  16. 重新启动计算机
  17. 转到Eclipse CDT IDE,使用示例OpenCV代码创建C ++程序(您可以使用本主题顶部的代码).
  18. 转到项目">属性">"C/C ++构建">设置">"GCC C ++编译器">包含"并添加 源OpenCV文件夹"C:\ OpenCV245PC \ build \ include"
  19. 转到项目">属性">"C/C ++构建">设置">"MinGW C ++链接器">库",然后逐个添加到库(-l)(这可能因项目而异,您可以根据需要添加所有这些对象,也可以仅添加一些项目所需的对象):
  20. 将构建的OpenCV库文件夹"C:\ OpenCV245MinGW \ x86 \ lib"添加到库搜索路径(-L).
  1. Download and install MinGW and add to the system PATH with c:/mingw/bin
  2. Download cmake from http://www.cmake.org and install it
  3. Download OpenCV2.4.5 Windows version
  4. Install/unzip Opencv to C:\OpenCV245PC\ (README,index.rst and CMakeLists.txt are there with all subfolders)
  5. Run CMake GUI tool, then
  6. Choose C:\OpenCV245PC\ as source
  7. Choose the destination, C:\OpenCV245MinGW\x86 where to build the binaries
  8. Press Configure button, choose MinGW Makefiles as the generator. There are some red highlights in the window, choose options as you need.
  9. Press the Configure button again. Configuring is now done.
  10. Press the Generate button.
  11. Exit the program when the generating is done.
  12. Exit the Cmake program.
  13. Run the command line mode (cmd.exe) and go to the destination directory C:\OpenCV245MinGW\x86
  14. Type "mingw32-make". You will see a progress of building binaries. If the command is not found, you must make sure that the system PATH is added with c:/mingw/bin. The build continues according the chosen options to a completion.
  15. In Windows system PATH (My Computer > Right button click > Properties > Advanced > Environment Variables > Path) add the destination's bin directory, C:\OpenCV245MinGW\x86\bin
  16. RESTART COMPUTER
  17. Go to the Eclipse CDT IDE, create a C++ program using the sample OpenCV code (You can use code from top of this topic).
  18. Go to Project > Properties > C/C++ Build > Settings > GCC C++ Compiler > Includes, and add the source OpenCV folder "C:\OpenCV245PC\build\include"
  19. Go to Project > Properties > C/C++ Build > Settings > MinGW C++ Linker > Libraries, and add to the Libraries (-l) ONE BY ONE (this could vary from project to project, you can add all of them if you like or some of them just the ones that you need for your project): opencv_calib3d245 opencv_contrib245 opencv_core245 opencv_features2d245 opencv_flann245 opencv_gpu245 opencv_highgui245 opencv_imgproc245 opencv_legacy245 opencv_ml245 opencv_nonfree245 opencv_objdetect245 opencv_photo245 opencv_stitching245 opencv_video245 opencv_videostab245
  20. Add the built OpenCV library folder, "C:\OpenCV245MinGW\x86\lib" to Library search path (-L).

您可以使用以下代码来测试您的设置:

You can use this code to test your setup:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>

using namespace std;
using namespace cv;

int main()
{

Mat img = imread("c:/lenna.png", CV_LOAD_IMAGE_COLOR);

namedWindow("MyWindow", CV_WINDOW_AUTOSIZE);
imshow("MyWindow", img);

waitKey(0);
return 0;
}

别忘了将图像放在C:/(或在您认为合适的任何地方,只需确保Eclipse已读取访问点即可.

Don't forget to put image to the C:/ (or wherever you might find suitable, just be sure that eclipse have read acess.

这篇关于OpenCV 2.4.5,蚀CDT Juno,MinGW错误0xc0000005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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