Problem Can't include OpenCV in Orbiter plugin

Evgheny

New member
Joined
Oct 18, 2011
Messages
29
Reaction score
0
Points
0
Location
Moscow
I need to use OpenCV library in my Orbiter plugin.

OpenCV has two variants of API: C version and C++.

I've tried to add opencv in my orbiter plugin project in VS2010.
I've followed this tutorial:
http://opencv.willowgarage.com/wiki/VisualC++

Compilation and linking goes fine. VS2010 doesn't highlight any line with red - everything should be fine ;)

But when I open Orbiter and start my plugin, Orbiter crashes ;(

For example this little piece of code:

Code:
ifstream ifile(tmplfilename);
if ( !FILE_LOADED && ifile ) {
    // loading template file
    Mat tmpl = cv::imread(tmplfilename, 1);  // << here occurs error
    FILE_LOADED = true;
}

It's C++ version of opencv.

But if I write the same thing in C version of opencv:

Code:
ifstream ifile(tmplfilename);
if ( !FILE_LOADED && ifile ) {
    // loading template file
    IplImage* tmpl = 0;
    tmpl = cvLoadImage(tmplfilename, 1); // no error occurs
    FILE_LOADED = true;
}

So, cv::imread() doesn't work but the save cvLoadImage() works.
Every cv::function won't work...

So, it's problem of connection opencv to project. But why does VS2010 doesn't show any errors? ;)

Update:
I got this messages in output of VS2010:

First-chance exception at 0x5c4dd90c (msvcr100d.dll) in orbiter.exe: 0xC0000005: Access violation reading location 0x00706d62.
Unhandled exception at 0x5c4dd90c (msvcr100d.dll) in orbiter.exe: 0xC0000005: Access violation reading location 0x00706d62.
The program '[1744] orbiter.exe: Native' has exited with code -1073741819 (0xc0000005).

Thanks in advance
 
Last edited:
Yes, tmplstr is a valid string, because if I pass it to cvReadImage() - it works.

Problem is not in cv::imread, but in any cv::function.

I've tried to capture screen and to put in a file. cv::imwrite crashes but cvSaveImage() works

If I run debug mode, than it crashes on the line where cv:: function is.
It reports handle exception from msvcr100d.dll
 
Back
Top