我有自己的 C++,我正在尝试使用 Pybind11 生成 python 绑定:
auto markerParams = MarkerDetector::Params::create(MarkerType::chessboard);
markerDetector.detect(image, markerParams);
我有为MarkerDetector::Params
struct 生成绑定的问题,因为它是一个内部结构,使用工厂方法构造,以枚举作为参数:
enum MarkerType { chessboard, tag };
typedef std::vector<cv::Point> ContourType;
typedef std::vector<cv::Point2d> ContourTyped;
// contour full, contour approximate, area, corners
typedef std::tuple<ContourType, ContourType, double, ContourTyped> MarkerDescriptor;
class MarkerDetector {
public:
std::vector<MarkerDescriptor> detect(Mat image, const Params params);
struct Params {
int rows, cols;
ColorRange borderColor;
ShapeDetector::Params borderShape;
cv::Size borderSize;
cv::Size Size;
static Params create(MarkerType markerType) {
static Params markerTypes[] = {
{ 3, 6, ColorRange::GREEN, ShapeDetector::Params::RECTANGLE, cv::Size(30,30), cv::Size(140, 140) }
};
return markerTypes[markerType];
}
};
};
有谁知道如何处理这个更高级的案例?