0

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

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by dolly_olaide
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.