EnoxSoftware / DlibFaceLandmarkDetector

FaceLandmark Detector using Dlib (Unity Asset Plugin)
https://assetstore.unity.com/packages/tools/integration/dlib-facelandmark-detector-64314
95 stars 31 forks source link

Does the constructor parameter of FaceLandmarkDetector not support Chinese character path? #8

Closed huihut closed 4 years ago

huihut commented 4 years ago

In the FaceLandmarkDetector.cs

if (!DlibFaceLandmarkDetector_LoadShapePredictor (nativeObj, shapePredictorFilePath)) {
    Debug.LogError ("Failed to load " + shapePredictorFilePath);
}

shapePredictorFilePath = "D:/code/git/测试test/Assets/StreamingAssets\sp_human_face_68.dat"

Failed to load D:/code/git/测试test/Assets/StreamingAssets\sp_human_face_68.dat

I want it to run in the path of Chinese characters, what should I do?

EnoxSoftware commented 4 years ago

Please enable the "Use Unicode UTF-8 for worldwide language support" setting .All Settings -> Time & Language -> Language -> "Administrative Language Settings" UnicodeSetting

huihut commented 4 years ago

This can solve my computer problem, but the program written with DlibFaceLandmarkDetector will run on the user's computer (including Win7, MacOS).

Is it better to have the DlibFaceLandmarkDetector_LoadShapePredictor interface of dlibfacelandmarkdetector.dll receive the UTF-8 character shapePredictorFilename?

EnoxSoftware commented 4 years ago

You can set the relative file path from the project folder.

        //dlibShapePredictorFilePath = Utils.getFilePath (dlibShapePredictorFileName);
        dlibShapePredictorFilePath = "./Assets/StreamingAssets/sp_human_face_68.dat";
huihut commented 4 years ago

Thank you very much, I solved it.

#if UNITY_WEBGL && !UNITY_EDITOR
            var getFilePath_Coroutine = DlibFaceLandmarkDetector.Utils.getFilePathAsync (dlibShapePredictorMobileFileName, (result) => {
                coroutines.Clear ();

                dlibShapePredictorFilePath = result;
                Run ();
            });
            coroutines.Push (getFilePath_Coroutine);
            StartCoroutine (getFilePath_Coroutine);
#else
#if UNITY_EDITOR
            dlibShapePredictorFilePath = "./Assets/StreamingAssets/sp_human_face_68.dat";
#elif UNITY_STANDALONE_WIN
            dlibShapePredictorFilePath = "./Avalive_Data/StreamingAssets/sp_human_face_68.dat";
#elif UNITY_ANDROID || UNITY_IOS
            dlibShapePredictorFilePath = DlibFaceLandmarkDetector.Utils.getFilePath (dlibShapePredictorMobileFileName);
#else
            dlibShapePredictorFilePath = DlibFaceLandmarkDetector.Utils.getFilePath (dlibShapePredictorFileName);
#endif
            Run();
#endif