Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using ifstream in VS2015

Hello,

I am calling a function from OpenCV that uses ifstream in C++. ifstream doesn't seem to work when tried in isolation.

Ptr<ERFilter> er_filter1 = createERFilterNM1(loadClassifierNM1("trained_classifierNM1.xml"), 8, 0.00015f, 0.13f, 0.2f, true, 0.1f);

But getting.....

OpenCV Error: Bad argument (Default classifier file not found!) in cv::text::ERClassifierNM1::ERClassifierNM1, file ~\opencv_contrib-3.1.0\modules\text\src\erfilter.cpp, line 1039

The offending line is.....

 if (ifstream(filename.c_str())) 
 { 
       .. Stuff works ....
 } 
 else 
 { 
       error!!
 }

Everything worked in VS2013 but i have to switch to VS2015.

I cannot get ifstream to work at all, even though the file is located in the .exe folder itsself or project directory. Everywhere really.

It's like ifstream has stopped working during the switch to VS2015

https://github.com/opencv/opencv_contrib/blob/master/modules/text/src/erfilter.cpp#L1025

Using ifstream in VS2015

Hello,

I am calling a function from OpenCV that uses ifstream in C++. ifstream doesn't seem to work when tried in isolation.

Ptr<ERFilter> er_filter1 = createERFilterNM1(loadClassifierNM1("trained_classifierNM1.xml"), 8, 0.00015f, 0.13f, 0.2f, true, 0.1f);

But getting.....

OpenCV Error: Bad argument (Default classifier file not found!) in cv::text::ERClassifierNM1::ERClassifierNM1, file ~\opencv_contrib-3.1.0\modules\text\src\erfilter.cpp, line 1039

The offending line is.....

 if (ifstream(filename.c_str())) 
 { 
       .. Stuff works ....
 } 
 else 
 { 
       error!!
 }

Everything worked in VS2013 but i have to switch to VS2015.

I cannot get ifstream to work at all, even though the file is located in the .exe folder itsself or project directory. Everywhere really.

It's like ifstream has stopped working during the switch to VS2015

https://github.com/opencv/opencv_contrib/blob/master/modules/text/src/erfilter.cpp#L1025

I have also tried the full path and adding files to VS2015 project resources folder.