Пример исходного кода. Файл называется 沙发模型 12_0017.jpg :
Код: Выделить всё
bool AssetFileDropFileTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
{
// 1) Read filename. Seems to be OK.
const wxString& wxFilename = filenames[0];
// 2) Convert to std string. Fails here return empty.
const std::string stdFilename = wxFilename.ToStdString();
// 3) Read image using OpenCV.
const cv::String opencvFilename= stdFilename ;
const cv::Mat image = cv::imread(opencvFilename, cv::IMREAD_UNCHANGED);
/* DO SOMETHING WITH image ...*/
return true;
}
Я использую wxwidgets 3.1.0.
Подробнее здесь: https://stackoverflow.com/questions/795 ... d-software