I have a Qt application in which I open/choose a video file with :
QString fichier=QFileDialog::getOpenFileName(…);
Then, I need to read this video with openCV with :
string str= fichier.toStdString();
const char* c_videoFile=str.c_str();
capture = cvCreateFileCapture(c_videoFile);
if(capture==0){
//file cannot be open
}
else{
//get frames, ...
}
The problem is that it doesn't work at all (capture==0) with file name with characters like :
Dziękuję
Påfårö
Русский
キャン#&セル
even with
capture = cvCreateFileCapture("path/to/Русский.mp4");
for example. If I ouput c_videoFile in the console, the name is correct.
How to solve that knowing that I have to use Qt to open the file so I necessarily have a QString to convert into a const char* . Can't openCV deal with that kind of characters?
I tried the answer there imread(openCV),QString unicodes but I get errors "no type named setCodecForCStrings in QTextCodec", "no type named setCodecForTr in QTextCodec", "no member named toAscii in QString". So I think this answer was valid for older version of Qt.
I work on Mac OS 10.8.5, Qt 5.3.1 and openCV 2.4.8. It works on Windows 7.