0
votes

Every other type in the C++ interface so far I have seen is a class. Why is DMatch here still listed as a struct, when the documentation says that it is a class here:

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

or is that reference to class an ambiguous one. Just looking for info on why OpenCV is still using structs in its C++ interface.

Also in the file /opencv-master/modules/core/doc/basic_structures.rst

DMatch seems to be documented as a class e.g.

    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;
        };
1
class X { public: is pretty much the same as struct X{, just as struct X { private: is the same as class X {. No real question here.MSalters

1 Answers

0
votes

Never mind, I found it was also listed in the CORE doc. here as a class as below...so I'm just going with that...Thanks for the help on this though

    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;
    };