Python Cython访问opencv功能2D模块

Python Cython访问opencv功能2D模块,python,c++,opencv,freak,Python,C++,Opencv,Freak,我真的需要你的帮助。我尝试使用Cython通过Python访问opencv描述符AKAZE和FREAK(直到现在我才尝试使用FREAK)。但是每次我尝试编译它时,我都会收到一条错误的信息,大约730行,因为Cython说它不知道向量类型,有些行不在HPP文件中的C++语法中。但我不明白这一点,因为它是官方的opencv标题,应该可以工作 这是我的错误消息的一部分: /usr/include/opencv2/features2d/features2d.hpp:1515:35: error:

我真的需要你的帮助。我尝试使用Cython通过Python访问opencv描述符AKAZE和FREAK(直到现在我才尝试使用FREAK)。但是每次我尝试编译它时,我都会收到一条错误的信息,大约730行,因为Cython说它不知道向量类型,有些行不在HPP文件中的C++语法中。但我不明白这一点,因为它是官方的opencv标题,应该可以工作

这是我的错误消息的一部分:

    /usr/include/opencv2/features2d/features2d.hpp:1515:35: error: ISO C++ forbids declaration of ‘parameter’ with no type [-fpermissive]
    /usr/include/opencv2/features2d/features2d.hpp:1515:41: error: expected ‘,’ or ‘...’ before ‘<’ token
    CV_EXPORTS float getRecall( const vector<Point2f>& recallPrecisionCurve, float l_precision );
                                     ^
    /usr/include/opencv2/features2d/features2d.hpp:1516:39: error: ‘vector’ does not name a type
    CV_EXPORTS int getNearestPoint( const vector<Point2f>& recallPrecisionCurve, float l_precision );
错误消息几乎会对每个函数抛出错误(我只想访问畸形构造函数)。希望你能帮助我

非常感谢, 狮子座

cdef extern from "opencv2/core/core.hpp":
  cdef int  CV_WINDOW_AUTOSIZE
  cdef int CV_8UC3

# -------------------------------------Bool Header-------------------------

cdef extern from "stdbool.h":
    ctypedef struct bool:
        pass
# ------------------------------------Vector Header------------------------

cdef extern from "vector" namespace "std":
    cdef cppclass vector [T]:
        pass


# -----------------------------------Features2d Header----------------------

cdef extern from "/usr/include/opencv2/features2d/features2d.hpp" namespace "cv":
    cdef cppclass FREAK:
        FREAK* FREAK( bool orientationNormalized=true, bool scaleNormalized=true, float patternScale=22.0, int nOctaves=4, const vector& selectedPairs=vector<int>()) except *
        FREAK* FREAK( const FREAK& rhs )
        int descriptorSize()
        int descriptorType()
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

libdir = ["/usr/include/", "/usr/local/lib"]
incdir = ["/usr/local/lib/", "/usr/include", "/usr/include/opencv2/core"]

ext_modules = [Extension("description",
                     ["description.pyx"],
                     language="c++",
                     library_dirs=libdir,
                     include_dirs=incdir,
                     libraries=["opencv_features2d", "opencv_core"])]

setup(name="description", ext_modules=cythonize(ext_modules))