Hello,

Can someone please help me with this problem.:(

I am trying to openFileDialog in VisualC++, and I want to load an image through cvLoadImage, but I'm getting error that it cannot just convert

error C2664: 'cvLoadImage' : cannot convert parameter 1 from 'System::String ^' to 'const char *'

. I have looked online for help, and different people sometimes use marshaling or CString or other methods but all I've tried is still not working out.:confused:

So I'm pasting a code snippet for someone to please tell me what to do.

IplImage *pic
openFileDialog1->Filter = "Picture Files (*.jpg;*.bmp;*.gif;*.png) |*.jpg;*.bmp;*.gif;*.png|All files (*.*)|*.*";
openFileDialog1->FilterIndex = 1;
if(openFileDialog1->ShowDialog == System::Windows::Forms::DialogResult::OK)
{
pic = cvLoadImage(openFileDialog1->FileName, CV_LOAD_IMAGE_COLOR);
..... //face detection not included to save space
cvShowImage("Detection", pic);
}

Thanks in advance:)