mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
- add missing tests for ORB
- remove useless code for 2.3
This commit is contained in:
parent
4b1f183bcd
commit
dc37ad803e
@ -195,40 +195,6 @@ void HarrisResponse::operator()(std::vector<cv::KeyPoint>& kpts) const
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct RoiPredicate
|
||||
{
|
||||
RoiPredicate(const cv::Rect& r) :
|
||||
r(r)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator()(const cv::KeyPoint& keyPt) const
|
||||
{
|
||||
return !r.contains(keyPt.pt);
|
||||
}
|
||||
|
||||
cv::Rect r;
|
||||
};
|
||||
|
||||
void runByImageBorder(std::vector<cv::KeyPoint>& keypoints, cv::Size imageSize, int borderSize)
|
||||
{
|
||||
if (borderSize > 0)
|
||||
{
|
||||
keypoints.erase(
|
||||
std::remove_if(
|
||||
keypoints.begin(),
|
||||
keypoints.end(),
|
||||
RoiPredicate(
|
||||
cv::Rect(
|
||||
cv::Point(borderSize, borderSize),
|
||||
cv::Point(imageSize.width - borderSize,
|
||||
imageSize.height - borderSize)))), keypoints.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline bool keypointResponseGreater(const cv::KeyPoint& lhs, const cv::KeyPoint& rhs)
|
||||
@ -669,11 +635,7 @@ void ORB::computeKeyPoints(const std::vector<cv::Mat>& image_pyramid, const std:
|
||||
// Remove keypoints very close to the border
|
||||
// half_patch_size_ for orientation, 4 for Harris
|
||||
unsigned int border_safety = std::max(half_patch_size_, 4);
|
||||
#if ((CV_MAJOR_VERSION >= 2) && ((CV_MINOR_VERSION >2) || ((CV_MINOR_VERSION == 2) && (CV_SUBMINOR_VERSION>=9))))
|
||||
cv::KeyPointsFilter::runByImageBorder(keypoints, image_pyramid[level].size(), border_safety);
|
||||
#else
|
||||
::runByImageBorder(keypoints, image_pyramid[level].size(), border_safety);
|
||||
#endif
|
||||
|
||||
// Keep more points than necessary as FAST does not give amazing corners
|
||||
if (keypoints.size() > 2 * n_features_per_level_[level])
|
||||
@ -843,7 +805,7 @@ void ORB::computeDescriptors(const cv::Mat& image, const cv::Mat& integral_image
|
||||
cv::KeyPointsFilter::runByImageBorder(keypoints, image.size(), border_safety);
|
||||
|
||||
// Get the patterns to apply
|
||||
cv::Ptr<OrbPatterns> patterns = patterns_[level];
|
||||
OrbPatterns* patterns = patterns_[level];
|
||||
|
||||
//create the descriptor mat, keypoints.size() rows, BYTES cols
|
||||
descriptors = cv::Mat::zeros(keypoints.size(), kBytes, CV_8UC1);
|
||||
|
@ -398,7 +398,7 @@ protected:
|
||||
double t = (double)getTickCount();
|
||||
dextractor->compute( img, keypoints, calcDescriptors );
|
||||
t = getTickCount() - t;
|
||||
ts->printf(cvtest::TS::LOG, "\nAverage time of computiting one descriptor = %g ms (previous time = %g ms).\n", t/((double)cvGetTickFrequency()*1000.)/calcDescriptors.rows, prevTime );
|
||||
ts->printf(cvtest::TS::LOG, "\nAverage time of computing one descriptor = %g ms (previous time = %g ms).\n", t/((double)cvGetTickFrequency()*1000.)/calcDescriptors.rows, prevTime );
|
||||
|
||||
if( calcDescriptors.rows != (int)keypoints.size() )
|
||||
{
|
||||
@ -1009,6 +1009,12 @@ TEST( Features2d_Detector_SURF, regression )
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_ORB, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-orb", FeatureDetector::create("ORB") );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_GridFAST, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-grid-fast", FeatureDetector::create("GridFAST") );
|
||||
@ -1038,6 +1044,14 @@ TEST( Features2d_DescriptorExtractor_SURF, regression )
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_ORB, regression )
|
||||
{
|
||||
// TODO adjust the parameters below
|
||||
CV_DescriptorExtractorTest<L2<float> > test( "descriptor-orb", 0.035f,
|
||||
DescriptorExtractor::create("ORB"), 0.147372f );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_BRIEF, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-brief", 1,
|
||||
|
Loading…
Reference in New Issue
Block a user