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:)

I've been to the page. But I do not understand how to implement either of the methods for the code. Can you please show me how to use any of the methods?

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.