OpenCV 2.3和Visual Studio 2010 [英] OpenCV 2.3 and Visual Studio 2010

查看:201
本文介绍了OpenCV 2.3和Visual Studio 2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用visual studio 2010安装openCV 2.3时遇到了这么多的麻烦。崩溃后,安装后安装后崩溃了几个星期后,我没有运气。
不幸的是,对于 openCV 2.3 没有安装文档,目录结构和文件位置与openCV 2.2不同,这使得当前教程几乎无用。 (



有没有人在openCV 2.3上有任何成功?有人可以尝试它,让我知道如果它的openCV构建问题或我的设置?



或者也许有人可以建议openCV的替代品,我的最终目标是获取Pixel信息,使用inpaint函数,以及After Effects和Maya的基本图像处理。 p>

编辑:对不起我以为我提出错误!这是当我运行代码时会发生什么:

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

using namespace cv;

int main()
{

Mat image;
image = imread(c:/image1.png,1);
namedWindow(Gray image,CV_WINDOW_AUTOSIZE);
imshow(Gray image,image);

waitKey(0);
return 0;
}

运行到 imshow 。如果我注释掉imshow它运行良好没有错误
以下是我添加IMSHOW时出现的错误:



openCV_test.exe中0x76bfb727处的未处理异常:Microsoft C ++异常:cv ::存储器位置0x0015ec20处的异常。它给了我打破或继续的选择。



这是输出窗口显示的内容:



openCV_test中0x76bfb727的第一次异常。 exe:Microsoft C ++异常:cv ::内存位置的异常0x0015ec20 ..
openCV_test.exe中0x76bfb727处的未处理异常:Microsoft C ++异常:cv ::内存位置0x0015ec20的异常

>

然后打开SYSTEM.CPP并给我:



- exc {msg = ...... \modules\core\src\array.cpp:2482:error:(-206)无法识别或不支持的数组类型
code = -206 err =无法识别或不支持的数组类型...} const cv ::异常&
+ std :: exception {_Mywhat = 0x00000000 _Mydofree = false} std :: exception
+ msg...... \modules\core\src\array.cpp:2482 :error:(-206)无法识别或不支持的数组类型
std :: basic_string,std :: allocator>
code -206 int
+ err无法识别或不支持的数组类型std: :basic_string,std :: allocator>
+ funcstd :: basic_string,std :: allocator>
+ file...... \modules\core\src\ array.cppstd :: basic_string,std :: allocator>
line 2482 int



谢谢!


>你应该做什么来在所有Visual Studio版本中正确编译和运行你的项目:



项目的属性(右键点击)




  • C / C ++


    • 一般




      • 包含目录添加<您的目录> \OpenCV2.3 \include\opencv2,您的目录> \OpenCV2.3 \include\opencv和<您的目录> \OpenCV2.3\include



  • 链接器


    • 一般




      • 添加lib目录<您的目录> \OpenCV2.3 \lib




    • 输入




      • 添加所有库,如opencv_core230d.lib opencv_highgui230d.lib等...





然后不要忘记将dll添加到系统路径。
配置面板>系统>高级>环境变量>路径
您可以添加一个用户环境路径,将覆盖另一个,
只需单击新建从来没有将目录添加到您的系统路径),并编写路径例如:<您的目录> \OpenCV2.3\bin



没有更多信息,我希望它可以帮助...



Julien,


I am having so much trouble installing openCV 2.3 with visual studio 2010. Crash after crash, installation after installation and after several weeks I've had no luck. Unfortunately there are no installation documents for openCV 2.3 and the directory structure and file locations are different from openCV 2.2 which makes the current tutorials almost useless. :(

Has anyone out there had any success with openCV 2.3? Can someone please try it and let me know if its an openCV build issue or my setup?

Or maybe someone can suggest an alternative to openCV. What my end goal is, is to get Pixel info, use inpaint functions, and basic image processing for After Effects and Maya.

EDIT: Sorry I thought I posed the error! This is what happens when I run the code:

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

  using namespace cv;

  int main()
  {

Mat image;
image = imread( "c:/image1.png", 1 );
namedWindow( "Gray image", CV_WINDOW_AUTOSIZE );
imshow( "Gray image", image );

      waitKey(0);
      return 0;
  }

It runs until imshow. If I comment out imshow it runs fine with no errors. Here is the errors when I add IMSHOW:

Unhandled exception at 0x76bfb727 in openCV_test.exe: Microsoft C++ exception: cv::Exception at memory location 0x0015ec20. and it gives me the option to break or continue.

This is what the output window shows:

First-chance exception at 0x76bfb727 in openCV_test.exe: Microsoft C++ exception: cv::Exception at memory location 0x0015ec20.. Unhandled exception at 0x76bfb727 in openCV_test.exe: Microsoft C++ exception: cv::Exception at memory location 0x0015ec20..

It then goes on to open SYSTEM.CPP and give me this:

- exc {msg="......\modules\core\src\array.cpp:2482: error: (-206) Unrecognized or unsupported array type " code=-206 err="Unrecognized or unsupported array type" ...} const cv::Exception & + std::exception {_Mywhat=0x00000000 _Mydofree=false } std::exception + msg "......\modules\core\src\array.cpp:2482: error: (-206) Unrecognized or unsupported array type " std::basic_string,std::allocator > code -206 int + err "Unrecognized or unsupported array type" std::basic_string,std::allocator > + func "" std::basic_string,std::allocator > + file "......\modules\core\src\array.cpp" std::basic_string,std::allocator > line 2482 int

Thanks!

解决方案

I have OpenCV2.3 and had no problem to install it with Visual Studio v9.0.

What you should do to compile and run correctly your project in all the Visual Studio versions :

Properties of your project (right click on it)

  • C/C++
    • General
      • Include directory add the < your directory >\OpenCV2.3\include\opencv2, < your directory >\OpenCV2.3\include\opencv and < your directory >\OpenCV2.3\include
  • Linker
    • General
      • Add lib directory < your directory >\OpenCV2.3\lib
    • Input
      • Add all the libs like opencv_core230d.lib opencv_highgui230d.lib and so on...

Then don't forget to add the dll to your system path. Configuration panel > System > Advanced > Environment variables > Path you can add a user environment path which will override the other one, just click New (if you have never added directory to your system path before) and write the path eg : < your directory >\OpenCV2.3\bin

Without more information, I hope it could help...

Julien,

这篇关于OpenCV 2.3和Visual Studio 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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