I am using OpenCV 2.4.6 with VS2012 c++/cli in Windows 8 and trying to simply read a matrix from a file. At runtime, I am crashing when I try and open the file and I am getting an error saying "System.Runtime.InteropServices.SEHException" - "External component has thrown an exception".
I have two questions: 1) what is causing this error; and 2) why is try/catch not handling this error?
My code looks like:
private: System::Void buttonLoadStyle_Click(System::Object^ sender, System::EventArgs^ e) {
FileStorage fs;
try
{
fs.open("SVStyle0.xml",FileStorage::READ);
}
catch(cv::Exception& e)
{
const char * err_msg = e.what();
}
catch(...)
{
System::Windows::Forms::MessageBox::Show("Load Style Exception","Rune Time Error!",MessageBoxButtons::OK,MessageBoxIcon::Error);
}
if(fs.isOpened())
{
// do something
}
};
I get the exception when the the fs.open line tries to open the file. Further, the exception is not caught by my try/catch blocks.
Any help greatly appreciated. Thanks