Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/129.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 加速人脸标志检测器_C++_Matlab_Mex_Dlib - Fatal编程技术网

C++ 加速人脸标志检测器

C++ 加速人脸标志检测器,c++,matlab,mex,dlib,C++,Matlab,Mex,Dlib,我已经构建了dlib的人脸地标检测示例的mex函数。作为一个输入参数,示例采用shape\u predictor\u 68\u face\u landmarks.dat的路径 相反,我想在Matlab中打开shape\u predictor\u 68\u face\u landmarks.dat,并将其作为参数传递给mex\u函数,而不是每次调用mex函数时都打开它(下面发布的代码需要2秒钟) 由于我是cpp和dlib的初学者,我不知道如何实现这一点,或者这是否是正确的方法 非常感谢您的帮助 v

我已经构建了dlib的人脸地标检测示例的mex函数。作为一个输入参数,示例采用
shape\u predictor\u 68\u face\u landmarks.dat
的路径

相反,我想在Matlab中打开
shape\u predictor\u 68\u face\u landmarks.dat
,并将其作为参数传递给
mex\u函数
,而不是每次调用mex函数时都打开它(下面发布的代码需要2秒钟)

由于我是cpp和dlib的初学者,我不知道如何实现这一点,或者这是否是正确的方法

非常感谢您的帮助

void mex_function (const string shape_predictor_68_face_landmarks_location, const array2d<rgb_pixel>&img ,matlab_struct& output){

    frontal_face_detector detector = get_frontal_face_detector();

    shape_predictor sp;
    deserialize(shape_predictor_68_face_landmarks_location) >> sp;
    ...
}
void mex_函数(常量字符串形状、预测器、面、地标、常量数组2d和img、matlab结构和输出){
正面探测器=获取正面探测器();
形状预测因子sp;
反序列化(形状、预测值、面、地标、位置)>>sp;
...
}

该代码无效
mex
cpp
在我构建mex文件后,上面粘贴的代码在matlab中工作。是全部代码。我很惊讶,因为所有的mex函数都有相同的“main”
void mex函数(int nlhs、mxArray*plhs[],int nrhs、mxArray const*prhs[])
我发现差异是由于dlib提供的mex_wrapper.cpp造成的。这是更详细的解释。