4
votes

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!

6
what kind of problems do you meet?CharlesB
Without knowing what the specific problems are (error message at compile time/run time/etc.) it is probably difficult to help you out. So you might want to inform us what specifically is going wrong.Bart
Stop installing and start addressing the crashes. You cannot get help with them until you document what you see and what you know in a question.Hans Passant
Sorry guys...i forgot to add the code and errors. The errors make no sense to me...I hope it helps though.に か
oh the includes are wrong... use #include <opencv2\core.hpp> #include <opencv2\highgui\highgui.hpp>Nick

6 Answers

2
votes

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,

1
votes

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.

0
votes

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

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

0
votes

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.

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;

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

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.

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

Hope this helps, Pinyo

0
votes

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;

}
-1
votes

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.