在学习ORB特征点时,想搞清楚detect和compute两个函数的实现。翻ORB的源代码,发现class CV_EXPORTS_W ORB : public Feature2D,在Feature2D中定义了detect和compute两个函数,找到feature.cpp,找到detect和compute两个函数的实现;这两个函数都是内部调用Feature2D::detectAndCompute函数,但是转到detectAndCompute函数后却没有发现其具体代码实现,只有两行代码CV_INSTRUMENT_REGION();CV_Error(Error::StsNotImplemented, ""); 相关代码如下所示:
//Feature2D的类定义:(在feature.hpp文件中
class CV_EXPORTS_W Feature2D : public virtual Algorithm
{
public:
virtual ~Feature2D();
/** @brief Detects keypoints in an image (first variant) or image set (second variant).
@param image Image.
@param keypoints The detected keypoints. In the second variant of the method keypoints[i] is a set
of keypoints detected in images[i] .
@param mask Mask specifying where to look for keypoints (optional). It must be a 8-bit integer
matrix with non-zero values in the region of interest.
*/
CV_WRAP virtual void detect( InputArray image,
CV_OUT std::vector& keypoints,
InputArray mask=noArray() ) ;
/** @overload
@param images Image set.
@param keypoints The detected keypoints. In the second variant of the method keypoints[i] is a set
of keypoints detected in images[i] .
@param masks Masks for each input image specifying where to look for keypoints (optional).
masks[i] is a mask for images[i].
*/
CV_WRAP virtual void detect( InputArrayOfArrays images,
CV_OUT std::vector >& keypoints,
InputArrayOfArrays masks=noArray() ) ;
/** @brief Computes the descriptors for a set of keypoints detected in an image (first variant) or image set
(second variant).
@param image Image.
@param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot be
computed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint
with several dominant orientations (for each orientation).
@param descriptors Computed descriptors. In the second variant of the method descriptors[i] are
descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the
descriptor for keypoint j-th keypoint.
*/
CV_WRAP virtual void compute( InputArray image,
CV_OUT CV_IN_OUT std::vector& keypoints,
OutputArray descriptors ) ;
/** @overload
@param images Image set.
@param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot be
computed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint
with several dominant orientations (for each orientation).
@param descriptors Computed descriptors. In the second variant of the method descriptors[i] are
descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the
descriptor for keypoint j-th keypoint.
*/
CV_WRAP virtual void compute( InputArrayOfArrays images,
CV_OUT CV_IN_OUT std::vector >& keypoints,
OutputArrayOfArrays descriptors ) ;
/** Detects keypoints and computes the descriptors */
CV_WRAP virtual void detectAndCompute( InputArray image, InputArray mask,
CV_OUT std::vector& keypoints,
OutputArray descriptors,
bool useProvidedKeypoints=false ) ;
CV_WRAP virtual int descriptorSize() const;
CV_WRAP virtual int descriptorType() const;
CV_WRAP virtual int defaultNorm() const;
CV_WRAP void write( const String& fileName ) const;
CV_WRAP void read( const String& fileName );
virtual void write( FileStorage&) const;
virtual void read( const FileNode&);
//! Return true if detector object is empty
CV_WRAP virtual bool empty() const;
};
//Feature2D的类实现:(在feature.cpp文件中
void Feature2D::detect( InputArray image,
std::vector& keypoints,
InputArray mask )
{
CV_INSTRUMENT_REGION();
if( image.empty() )
{
keypoints.clear();
return;
}
detectAndCompute(image, mask, keypoints, noArray(), false);
}
void Feature2D::compute( InputArray image,
std::vector& keypoints,
OutputArray descriptors )
{
CV_INSTRUMENT_REGION();
if( image.empty() )
{
descriptors.release();
return;
}
detectAndCompute(image, noArray(), keypoints, descriptors, true);
}
//下面这个函数就是我想问的,没有发现具体实现。
void Feature2D::detectAndCompute( InputArray, InputArray,
std::vector&,
OutputArray,
bool )
{
CV_INSTRUMENT_REGION();
CV_Error(Error::StsNotImplemented, "");
}
希望有知道的指导一下
能够打断点不,可以根据断点+步进查看下具体实现?