OpenCV 2.3和Visual Studio 2010。

时间:2022-09-01 16:32:19

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. :(

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

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?

有谁在openCV 2.3中有过成功吗?是否有人可以尝试一下,如果是openCV的构建版本或者我的设置,请告诉我。

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.

或者有人可以建议选择openCV。我的最终目标是获得像素信息,使用inpaint函数,以及对After Effects和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:

直到imshow它运行。如果我注释掉imshow,它运行良好,没有错误。以下是我添加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.

未处理的异常在openCV_test中的0x76bfb727。exe: Microsoft c++异常:cv::内存位置0x0015ec20异常。它让我可以选择中断或继续。

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..

在openCV_test中,第一次机会异常是0x76bfb727。exe: Microsoft c++异常:cv::内存位置0x0015ec20的异常。未处理的异常在openCV_test中的0x76bfb727。exe: Microsoft c++异常:cv::内存位置0x0015ec20的异常。

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

然后继续开放系统。CPP,给我这个:

- 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

- exc {味精= "……\ \核心模块\ src \数组。cpp:2482:错误:(-206)未识别或不支持的数组类型" code=-206 err="未识别或不支持的数组类型"……例外+ std::例外{_Mywhat=0x00000000 _Mydofree=false} std:: Exception + msg“……\模块\core\src\array”。cpp:2482:错误:(-206)未识别或不支持的数组类型std::allocator > code -206 int + err“未识别或不支持的数组类型”std::basic_string,std::allocator > + func“std::basic_string,std::allocator > + file”…\模块\core\src\array。std::basic_string,std::allocator > line 2482 int。

Thanks!

谢谢!

6 个解决方案

#1


2  

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

我有OpenCV2.3,没有问题,安装Visual Studio v9.0。

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

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

Properties of your project (right click on it)

项目属性(右键单击)

  • C/C++
  • 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
      • 包括目录添加 <你的目录> \OpenCV2.3\包括\opencv2, <你的目录> \OpenCV2.3\包括\opencv和 <你的目录> \OpenCV2.3\包括。
    • 包括目录添加 <你的目录> \OpenCV2.3\包括\opencv2, <你的目录> \OpenCV2.3\包括\opencv和 <你的目录> \OpenCV2.3\包括。
  • 包括目录添加 <你的目录> \OpenCV2.3\包括\opencv2, <你的目录> \OpenCV2.3\包括\opencv和 <你的目录> \OpenCV2.3\包括。
  • Linker
  • 链接器
    • General
    • 一般
  • 一般
      • Add lib directory < your directory >\OpenCV2.3\lib
      • 添加lib目录 <您的目录> \OpenCV2.3\lib。
    • 添加lib目录 <您的目录> \OpenCV2.3\lib。
  • 添加lib目录 <您的目录> \OpenCV2.3\lib。
    • Input
    • 输入
  • 输入
      • Add all the libs like opencv_core230d.lib opencv_highgui230d.lib and so on...
      • 添加所有像opencv_core230d这样的libs。*opencv_highgui230d。*等等……
    • 添加所有像opencv_core230d这样的libs。*opencv_highgui230d。*等等……
  • 添加所有像opencv_core230d这样的libs。*opencv_highgui230d。*等等……

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

然后不要忘记将dll添加到系统路径中。配置面板>系统>高级>环境变量>路径您可以添加一个用户环境路径,该路径将覆盖另一个用户环境路径,只需单击New(如果您之前从未添加目录到您的系统路径),并写入路径eg: <您的目录> \OpenCV2.3\bin。

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

如果没有更多的信息,我希望它能帮助……

Julien,

朱利安,

#2


1  

Sometimes, the compiler cannot find the dll even if you have the correct path settings. At that point try copying the dll files from the openCV folder to ur current project (not solution) folder.

有时,即使您有正确的路径设置,编译器也无法找到dll。在那个时候,尝试从openCV文件夹复制dll文件到ur当前项目(不是解决方案)文件夹。

#3


0  

Rather than copy pasting I'll just link: http://theroundedengineer.blogspot.com/2011/07/opencv-23-for-vs-2008-from-source.html

而不是复制粘贴,我将只链接:http://theroundedengineer.blogspot.com/2011/07/opencv-23-for- 2008-from-source.html。

Hopefully that helps. Granted I'm far from an expert on the differences between VS 2008 and VS 2010.

希望有帮助。当然,我对VS 2008和VS 2010的区别还远远不够。

#4


0  

I got exactly the same problem. I couldn't read any image. I checked the data flag and image size. The flag indicated error and the size was always (0, 0). Although I do not know the actual cause, I somehow could avoid the problem and run my program fine.

我也有同样的问题。我看不懂任何图片。我检查了数据标志和图像大小。虽然我不知道实际的原因,但是我可以避免这个问题并运行我的程序。

At first, I compiled OpenCV myself. Even though all the dlls seemed to be created correctly and there was no build error, I noticed that the header folders are not correctly organized. Therefore, I switched to the superpack binary and tried static linking. There were a lot of undefined symbols at the beginning, so I basically just put everything into VS link options. The number of libraries I had to input to VS was quite absurd, but it is a good way to test if the superpack works.

一开始,我自己编译OpenCV。尽管所有的dll似乎都被正确地创建了,并且没有生成错误,但是我注意到标题文件夹没有被正确地组织起来。因此,我切换到superpack二进制文件并尝试了静态链接。一开始有很多未定义的符号,所以我基本上把所有东西都放到VS链接选项中。我必须输入VS的库的数量是相当荒谬的,但是这是一个测试超级包是否有效的好方法。

These are what I use. opencv_core230d.lib;opencv_calib3d230d.lib;opencv_contrib230d.lib;opencv_features2d230d.lib;opencv_highgui230d.lib;opencv_legacy230d.lib;opencv_ml230d.lib;opencv_imgproc230d.lib;opencv_video230d.lib;libjasperd.lib;libjpegd.lib;libpngd.lib;libtiffd.lib;zlibd.lib;

这些是我用的。opencv_core230d.lib;opencv_calib3d230d.lib opencv_contrib230d.lib;opencv_features2d230d.lib;opencv_highgui230d.lib opencv_legacy230d.lib;opencv_ml230d.lib;opencv_imgproc230d.lib;opencv_video230d.lib;libjasperd.lib;libjpegd.lib;libpngd.lib;libtiffd.lib;zlibd.lib;

I also need to input Comctl32.lib to resolve linking error.

我还需要输入Comctl32。lib来解决链接错误。

I tested my program with static libraries of superpack. Things work fine now. The headers I used are

我用超级包的静态库测试了我的程序。事情好了。我使用的标题是。

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

I do not try using dlls yet, but I can confirm that VS 2010 + OpenCV 2.3 64 bit from the superpack work. I hope you will have some luck with the superpack too.

我还没有尝试使用dlls,但是我可以确认VS 2010 + OpenCV 2.3 64位的超包工作。我希望你也能幸运地拥有超级包。

(Hmm, I can't remember if I put opencv.hpp in the opencv2 folder myself, or if it was there right from the beginning. I did a lot of things to make it work and was a bit confused. But, I believe you can figure this out yourself if there is anything wrong about the header.)

(嗯,我不记得我放了opencv。hpp在opencv2文件夹中,或者从一开始就在那里。我做了很多事情让它工作,有点困惑。但是,我相信如果标题有问题的话,你可以自己解决这个问题。

Hope this helps, Pinyo

希望这有助于,Pinyo

#5


0  

You should try making a cycle structure:

你应该尝试做一个循环结构:

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

using namespace cv;

int main(){

  Mat image;
  namedWindow( "Gray image", 2 );

    while(1){
       image = imread( "d://Gaa6P.png", 1 );
       imshow( "Gray image", image );
       waitKey(0);

    }

return 0;

}

#6


-1  

Check your firewall. turn off firewall totally. Your antivirus may block the process too. I had the same problem: cv::exception for memory and this was it's cause.

检查你的防火墙。关闭防火墙完全。你的反病毒也可能会阻止这个过程。我遇到了同样的问题:简历:对记忆的例外,这就是原因。

#1


2  

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

我有OpenCV2.3,没有问题,安装Visual Studio v9.0。

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

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

Properties of your project (right click on it)

项目属性(右键单击)

  • C/C++
  • 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
      • 包括目录添加 <你的目录> \OpenCV2.3\包括\opencv2, <你的目录> \OpenCV2.3\包括\opencv和 <你的目录> \OpenCV2.3\包括。
    • 包括目录添加 <你的目录> \OpenCV2.3\包括\opencv2, <你的目录> \OpenCV2.3\包括\opencv和 <你的目录> \OpenCV2.3\包括。
  • 包括目录添加 <你的目录> \OpenCV2.3\包括\opencv2, <你的目录> \OpenCV2.3\包括\opencv和 <你的目录> \OpenCV2.3\包括。
  • Linker
  • 链接器
    • General
    • 一般
  • 一般
      • Add lib directory < your directory >\OpenCV2.3\lib
      • 添加lib目录 <您的目录> \OpenCV2.3\lib。
    • 添加lib目录 <您的目录> \OpenCV2.3\lib。
  • 添加lib目录 <您的目录> \OpenCV2.3\lib。
    • Input
    • 输入
  • 输入
      • Add all the libs like opencv_core230d.lib opencv_highgui230d.lib and so on...
      • 添加所有像opencv_core230d这样的libs。*opencv_highgui230d。*等等……
    • 添加所有像opencv_core230d这样的libs。*opencv_highgui230d。*等等……
  • 添加所有像opencv_core230d这样的libs。*opencv_highgui230d。*等等……

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

然后不要忘记将dll添加到系统路径中。配置面板>系统>高级>环境变量>路径您可以添加一个用户环境路径,该路径将覆盖另一个用户环境路径,只需单击New(如果您之前从未添加目录到您的系统路径),并写入路径eg: <您的目录> \OpenCV2.3\bin。

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

如果没有更多的信息,我希望它能帮助……

Julien,

朱利安,

#2


1  

Sometimes, the compiler cannot find the dll even if you have the correct path settings. At that point try copying the dll files from the openCV folder to ur current project (not solution) folder.

有时,即使您有正确的路径设置,编译器也无法找到dll。在那个时候,尝试从openCV文件夹复制dll文件到ur当前项目(不是解决方案)文件夹。

#3


0  

Rather than copy pasting I'll just link: http://theroundedengineer.blogspot.com/2011/07/opencv-23-for-vs-2008-from-source.html

而不是复制粘贴,我将只链接:http://theroundedengineer.blogspot.com/2011/07/opencv-23-for- 2008-from-source.html。

Hopefully that helps. Granted I'm far from an expert on the differences between VS 2008 and VS 2010.

希望有帮助。当然,我对VS 2008和VS 2010的区别还远远不够。

#4


0  

I got exactly the same problem. I couldn't read any image. I checked the data flag and image size. The flag indicated error and the size was always (0, 0). Although I do not know the actual cause, I somehow could avoid the problem and run my program fine.

我也有同样的问题。我看不懂任何图片。我检查了数据标志和图像大小。虽然我不知道实际的原因,但是我可以避免这个问题并运行我的程序。

At first, I compiled OpenCV myself. Even though all the dlls seemed to be created correctly and there was no build error, I noticed that the header folders are not correctly organized. Therefore, I switched to the superpack binary and tried static linking. There were a lot of undefined symbols at the beginning, so I basically just put everything into VS link options. The number of libraries I had to input to VS was quite absurd, but it is a good way to test if the superpack works.

一开始,我自己编译OpenCV。尽管所有的dll似乎都被正确地创建了,并且没有生成错误,但是我注意到标题文件夹没有被正确地组织起来。因此,我切换到superpack二进制文件并尝试了静态链接。一开始有很多未定义的符号,所以我基本上把所有东西都放到VS链接选项中。我必须输入VS的库的数量是相当荒谬的,但是这是一个测试超级包是否有效的好方法。

These are what I use. opencv_core230d.lib;opencv_calib3d230d.lib;opencv_contrib230d.lib;opencv_features2d230d.lib;opencv_highgui230d.lib;opencv_legacy230d.lib;opencv_ml230d.lib;opencv_imgproc230d.lib;opencv_video230d.lib;libjasperd.lib;libjpegd.lib;libpngd.lib;libtiffd.lib;zlibd.lib;

这些是我用的。opencv_core230d.lib;opencv_calib3d230d.lib opencv_contrib230d.lib;opencv_features2d230d.lib;opencv_highgui230d.lib opencv_legacy230d.lib;opencv_ml230d.lib;opencv_imgproc230d.lib;opencv_video230d.lib;libjasperd.lib;libjpegd.lib;libpngd.lib;libtiffd.lib;zlibd.lib;

I also need to input Comctl32.lib to resolve linking error.

我还需要输入Comctl32。lib来解决链接错误。

I tested my program with static libraries of superpack. Things work fine now. The headers I used are

我用超级包的静态库测试了我的程序。事情好了。我使用的标题是。

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

I do not try using dlls yet, but I can confirm that VS 2010 + OpenCV 2.3 64 bit from the superpack work. I hope you will have some luck with the superpack too.

我还没有尝试使用dlls,但是我可以确认VS 2010 + OpenCV 2.3 64位的超包工作。我希望你也能幸运地拥有超级包。

(Hmm, I can't remember if I put opencv.hpp in the opencv2 folder myself, or if it was there right from the beginning. I did a lot of things to make it work and was a bit confused. But, I believe you can figure this out yourself if there is anything wrong about the header.)

(嗯,我不记得我放了opencv。hpp在opencv2文件夹中,或者从一开始就在那里。我做了很多事情让它工作,有点困惑。但是,我相信如果标题有问题的话,你可以自己解决这个问题。

Hope this helps, Pinyo

希望这有助于,Pinyo

#5


0  

You should try making a cycle structure:

你应该尝试做一个循环结构:

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

using namespace cv;

int main(){

  Mat image;
  namedWindow( "Gray image", 2 );

    while(1){
       image = imread( "d://Gaa6P.png", 1 );
       imshow( "Gray image", image );
       waitKey(0);

    }

return 0;

}

#6


-1  

Check your firewall. turn off firewall totally. Your antivirus may block the process too. I had the same problem: cv::exception for memory and this was it's cause.

检查你的防火墙。关闭防火墙完全。你的反病毒也可能会阻止这个过程。我遇到了同样的问题:简历:对记忆的例外,这就是原因。