【发布时间】:2013-08-27 22:01:49
【问题描述】:
我希望能够使用 OpenCV 在 python 中计算 LBP 描述符。 根据this我需要重新编译openCV。
我更改了opencv-2.4.6.1/modules/contrib/src/facerec.cpp 中的elbp() 函数,因此它们不再是statisc。
现在我必须在 HFile 中声明它们(假设我创建了elbp.hpp,还是应该将其添加到现有文件中?):
// This is a header file created to expose the elbp (evaluate LBP) functions
#include "opencv2/core/core.hpp"
namespace cv {
Mat elbp(InputArray src, int radius, int neighbors);
Mat elbp(InputArray src, OutputArray dst, int radius, int neighbors);
Mat spatial_histogram(InputArray _src, int numPatterns, int grid_x, int grid_y, bool /*normed*/);
};
为了编译 OpenCV,我按照指令 here 创建了 cv2.so 共享对象。
我的问题是,如何创建 python“包装器”(如果我使用正确的词)能够从 python 调用 elbp() 函数?我觉得我在这里错过了关键的一步。
例如python中存在cv2.HogDescriptor()函数,我想同样暴露LBP描述符。
【问题讨论】: