Use string::c_str()
to get the underlying pointer of a string:
Mat* cv_imread(String* filename, int flags) {
return new Mat(cv::imread(filename->c_str(), flags));
}
Or you can use string::data()
too. They have the same functionality after C++11.
Edit: OP seems to want to pass a char*
to cv_read
. Then should do this:
cv_read(new String(filename), 1);