According to https://learn.microsoft.com/en-us/cpp/dotnet/how-to-convert-system-string-to-standard-string, try something like this:
if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
MessageBox::Show( openFileDialog1->FileName, "Path:");
IntPtr p = Runtime::InteropServices::Marshal::StringToHGlobalAnsi( openFileDialog1->FileName);
const char* path = (const char*)p.ToPointer( );
Mat src = imread( path, 0);
. . .
Marshal::FreeHGlobal( p);
}
See also: