Does cv::VideoCapture support both UTF-8 and traditional codepage-encoded strings?

asked 2017-04-19 21:20:44 -0600

Hello, I recently built OpenCV 3.2.0 from the Git repository (I downloaded the current source code in the master-branch, and I think it is somewhat different from the currently available official release), and built it on Windows 7, Visual Studio 2015, with CUDA support.

Please look at the following code:

int main()
{
    cv::VideoCapture vc_949{ "안녕\\이런.wmv" };
    std::cout << vc_949.isOpened() << std::endl;
    cv::VideoCapture vc_utf8{ u8"안녕\\이런.wmv" };
    std::cout << vc_utf8.isOpened() << std::endl;
}

I compiled this with Visual Studio 2015 and it prints:

1
1

Two character arrays "안녕\\이런.wmv" and u8"안녕\\이런.wmv" were completely different; even their lengths are not the same. But it seems that both vc_949 and vc_utf8 opens the video without any problem.

I wonder:

  1. How that's possible? Underlying data type of two strings are the same, and they call the same overload of the constructor.
  2. Which one is the preferred way? I wish I can use UTF-8 strings, but I've heard lots of complains about unicode support in OpenCV. Is it safe to use UTF-8 encoded strings for cv::VideoCapture (or other OpenCV components working with files) in Windows?
edit retag flag offensive close merge delete

Comments

actually, only ascii strings are supported, no utf or unicode of any kind.

berak gravatar imageberak ( 2017-04-22 03:34:52 -0600 )edit

Are there any plans to provide support for unicode paths for VideoCapture?

Myke623 gravatar imageMyke623 ( 2018-04-18 06:55:55 -0600 )edit

@Myke623 : NO.

berak gravatar imageberak ( 2018-04-18 07:00:02 -0600 )edit