为什么OpenCV中的DMatch是一个结构而不是一个类 PC++接口中的其他类型到目前为止我所看到的都是一个类。为什么在文档中说DMatch是一个类时,它仍然作为一个结构列出:

为什么OpenCV中的DMatch是一个结构而不是一个类 PC++接口中的其他类型到目前为止我所看到的都是一个类。为什么在文档中说DMatch是一个类时,它仍然作为一个结构列出:,c++,c,class,opencv,struct,C++,C,Class,Opencv,Struct,用于匹配关键点描述符的类:查询描述符索引、列车描述符索引、列车图像索引和描述符之间的距离 或者,对类的引用是不明确的。只是想了解为什么OpenCV仍然在C++接口中使用结构。 也在文件/opencv master/modules/core/doc/basic_structures.rst中 DMatch似乎被记录为一个类,例如 DMatch ------ .. ocv:class:: DMatch Class for matching keypoint desc

用于匹配关键点描述符的类:查询描述符索引、列车描述符索引、列车图像索引和描述符之间的距离

或者,对类的引用是不明确的。只是想了解为什么OpenCV仍然在C++接口中使用结构。 也在文件/opencv master/modules/core/doc/basic_structures.rst中

DMatch似乎被记录为一个类,例如

    DMatch
    ------
    .. ocv:class:: DMatch

    Class for matching keypoint descriptors: query descriptor index,
    train descriptor index, train image index, and distance between descriptors. ::

        class DMatch
        {
        public:
            DMatch() : queryIdx(-1), trainIdx(-1), imgIdx(-1),
                       distance(std::numeric_limits<float>::max()) {}
            DMatch( int _queryIdx, int _trainIdx, float _distance ) :
                    queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(-1),
                    distance(_distance) {}
            DMatch( int _queryIdx, int _trainIdx, int _imgIdx, float _distance ) :
                    queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(_imgIdx),
                    distance(_distance) {}

            int queryIdx; // query descriptor index
            int trainIdx; // train descriptor index
            int imgIdx;   // train image index

            float distance;

            // less is better
            bool operator<( const DMatch &m ) const;
        };

没关系,我发现它也列在核心文档中。作为一个班级,如下所示…所以我只想说…谢谢你在这方面的帮助

    Never mind, I found it was also listed in the CORE doc. [here](http://docs.opencv.org/trunk/modules/core/doc/basic_structures.html?highlight=dmatch#DMatch) as a class...so I'm just going with that...Thanks for the help on this though
    DMatch

    class DMatch

    Class for matching keypoint descriptors: query descriptor index, train descriptor index, train image index, and distance between descriptors.

    class DMatch
    {
    public:
        DMatch() : queryIdx(-1), trainIdx(-1), imgIdx(-1),
                   distance(std::numeric_limits<float>::max()) {}
        DMatch( int _queryIdx, int _trainIdx, float _distance ) :
                queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(-1),
                distance(_distance) {}
        DMatch( int _queryIdx, int _trainIdx, int _imgIdx, float _distance ) :
                queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(_imgIdx),
                distance(_distance) {}

        int queryIdx; // query descriptor index
        int trainIdx; // train descriptor index
        int imgIdx;   // train image index

        float distance;

        // less is better
        bool operator<( const DMatch &m ) const;
    };
类X{public:与结构X{几乎相同,正如结构X{private:与类X{相同。这里没有真正的问题。