Ask Your Question

Revision history [back]

Documentation - KeyPoint class

Hi,

I have a question about the documentation of the KeyPoint class.

see files:

  • core/include/opencv2/core/types.hpp
  • core/src/opencv2/core/types.cpp

Background:

i was looking for a way to convert vector< KeyPoint > to vector< Point2f >.

There is the convert(const std::vector< KeyPoint > &keypoints, std::vector< Point2f > &points2f, const std::vector< int > &keypointIndexes=std::vector< int >()) function. The documentation in the header file says:

/**
This method converts vector of keypoints to vector of points or the reverse, where each keypoint is
assigned the same size and the same orientation.

@param keypoints Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
@param points2f Array of (x,y) coordinates of each keypoint
@param keypointIndexes Array of indexes of keypoints to be converted to points. (Acts like a mask to
convert only specified keypoints)
*/

and there is the convert (const std::vector< Point2f > &points2f, std::vector< KeyPoint > &keypoints, float size=1, float response=1, int octave=0, int class_id=-1) function on which the documentation says:

/** @overload
@param points2f Array of (x,y) coordinates of each keypoint
@param keypoints Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
@param size keypoint diameter
@param response keypoint detector response on the keypoint (that is, strength of the keypoint)
@param octave pyramid octave in which the keypoint has been detected
@param class_id object id
*/

what expands to

"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts."

in the documentation at http://docs.opencv.org/master/d2/d29/classcv_1_1KeyPoint.html

But if you see the implementation its clear that the actual functionalities of the both convert() functions do not fit their documentation. The first one converts from vector< KeyPoint > to vector< Point2f > and the overloaded one from vector< Point2f > to vector < KeyPoint >.

So now i'm not sure if

  1. everything is OK and well documented and me, as a newbie, just cannot read the documentation well
  2. the documentation in core/include/opencv2/core/types.hpp is wrong
  3. the implementation in core/src/opencv2/core/types.cpp is wrong

Would be nice if you guys could help me out on this. Is it a issue that need to get fixed? Or is it normal to document it this way?