Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
256 views
in Technique[技术] by (71.8m points)

c++ - OpenCV 2.3 and Visual Studio 2010

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="......modulescoresrcarray.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 "......modulescoresrcarray.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 "......modulescoresrcarray.cpp" std::basic_string,std::allocator > line 2482 int

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.3includeopencv2, < your directory >OpenCV2.3includeopencv and < your directory >OpenCV2.3include
  • Linker
    • General
      • Add lib directory < your directory >OpenCV2.3lib
    • 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.3in

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

Julien,


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...