OpenCV の関数内の File 名などは基本的に std::string
ところが VC12 で提供されているText Box 等の string は System::String
と云う事で変換が必要なんです 絵文字:困った 冷汗
System::String から std::string への変換。。。
System::String ^fNameIn = textBox1->Text;// Text Box から
std::string fName = SystemStrToStdStr(fNameIn);// System::String を標準文字列に変換
// System::String を標準文字列に変換
std::string SystemStrToStdStr(System::String ^systr){
using namespace Runtime::InteropServices;
const char *cps = (const char *)(Marshal::StringToHGlobalAnsi(systr)).ToPointer();
std::string ststr = cps;
Marshal::FreeHGlobal(IntPtr((void *)cps));
return ststr;
}