Merge pull request #2506 from alalek:move_sift
commit
b31e55b6b5
13 changed files with 49 additions and 1434 deletions
@ -0,0 +1,2 @@ |
|||||||
|
// Compatibility
|
||||||
|
#include "shadow_sift.hpp" |
@ -0,0 +1,20 @@ |
|||||||
|
// Compatibility
|
||||||
|
// SIFT is moved to the main repository
|
||||||
|
|
||||||
|
namespace cv { |
||||||
|
namespace xfeatures2d { |
||||||
|
|
||||||
|
/** Use cv.SIFT_create() instead */ |
||||||
|
CV_WRAP static inline |
||||||
|
Ptr<cv::SIFT> SIFT_create(int nfeatures = 0, int nOctaveLayers = 3, |
||||||
|
double contrastThreshold = 0.04, double edgeThreshold = 10, |
||||||
|
double sigma = 1.6) |
||||||
|
{ |
||||||
|
CV_LOG_ONCE_WARNING(NULL, "DEPRECATED: cv.xfeatures2d.SIFT_create() is deprecated due SIFT tranfer to the main repository. " |
||||||
|
"https://github.com/opencv/opencv/issues/16736" |
||||||
|
); |
||||||
|
|
||||||
|
return SIFT::create(nfeatures, nOctaveLayers, contrastThreshold, edgeThreshold, sigma); |
||||||
|
} |
||||||
|
|
||||||
|
}} // namespace
|
@ -0,0 +1,24 @@ |
|||||||
|
#!/usr/bin/env python |
||||||
|
|
||||||
|
# Python 2/3 compatibility |
||||||
|
from __future__ import print_function |
||||||
|
|
||||||
|
import os |
||||||
|
import numpy as np |
||||||
|
import cv2 as cv |
||||||
|
|
||||||
|
from tests_common import NewOpenCVTests |
||||||
|
|
||||||
|
class sift_compatibility_test(NewOpenCVTests): |
||||||
|
|
||||||
|
def test_create(self): |
||||||
|
|
||||||
|
sift = cv.xfeatures2d.SIFT_create() |
||||||
|
self.assertFalse(sift is None) |
||||||
|
|
||||||
|
img1 = np.zeros((100, 100, 3), dtype=np.uint8) |
||||||
|
kp1_, des1_ = sift.detectAndCompute(img1, None) |
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__': |
||||||
|
NewOpenCVTests.bootstrap() |
@ -1,72 +0,0 @@ |
|||||||
// This file is part of OpenCV project.
|
|
||||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
||||||
// of this distribution and at http://opencv.org/license.html.
|
|
||||||
#include "perf_precomp.hpp" |
|
||||||
|
|
||||||
namespace opencv_test { namespace { |
|
||||||
|
|
||||||
typedef perf::TestBaseWithParam<std::string> sift; |
|
||||||
|
|
||||||
#define SIFT_IMAGES \ |
|
||||||
"cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
|
|
||||||
"stitching/a3.png" |
|
||||||
|
|
||||||
PERF_TEST_P(sift, detect, testing::Values(SIFT_IMAGES)) |
|
||||||
{ |
|
||||||
string filename = getDataPath(GetParam()); |
|
||||||
Mat frame = imread(filename, IMREAD_GRAYSCALE); |
|
||||||
ASSERT_FALSE(frame.empty()) << "Unable to load source image " << filename; |
|
||||||
|
|
||||||
Mat mask; |
|
||||||
declare.in(frame).time(90); |
|
||||||
Ptr<SIFT> detector = SIFT::create(); |
|
||||||
vector<KeyPoint> points; |
|
||||||
|
|
||||||
PERF_SAMPLE_BEGIN(); |
|
||||||
detector->detect(frame, points, mask); |
|
||||||
PERF_SAMPLE_END(); |
|
||||||
|
|
||||||
SANITY_CHECK_NOTHING(); |
|
||||||
} |
|
||||||
|
|
||||||
PERF_TEST_P(sift, extract, testing::Values(SIFT_IMAGES)) |
|
||||||
{ |
|
||||||
string filename = getDataPath(GetParam()); |
|
||||||
Mat frame = imread(filename, IMREAD_GRAYSCALE); |
|
||||||
ASSERT_FALSE(frame.empty()) << "Unable to load source image " << filename; |
|
||||||
|
|
||||||
Mat mask; |
|
||||||
declare.in(frame).time(90); |
|
||||||
|
|
||||||
Ptr<SIFT> detector = SIFT::create(); |
|
||||||
vector<KeyPoint> points; |
|
||||||
Mat descriptors; |
|
||||||
detector->detect(frame, points, mask); |
|
||||||
|
|
||||||
PERF_SAMPLE_BEGIN(); |
|
||||||
detector->compute(frame, points, descriptors); |
|
||||||
PERF_SAMPLE_END(); |
|
||||||
|
|
||||||
SANITY_CHECK_NOTHING(); |
|
||||||
} |
|
||||||
|
|
||||||
PERF_TEST_P(sift, full, testing::Values(SIFT_IMAGES)) |
|
||||||
{ |
|
||||||
string filename = getDataPath(GetParam()); |
|
||||||
Mat frame = imread(filename, IMREAD_GRAYSCALE); |
|
||||||
ASSERT_FALSE(frame.empty()) << "Unable to load source image " << filename; |
|
||||||
|
|
||||||
Mat mask; |
|
||||||
declare.in(frame).time(90); |
|
||||||
Ptr<SIFT> detector = SIFT::create(); |
|
||||||
vector<KeyPoint> points; |
|
||||||
Mat descriptors; |
|
||||||
|
|
||||||
PERF_SAMPLE_BEGIN(); |
|
||||||
detector->detectAndCompute(frame, mask, points, descriptors, false); |
|
||||||
PERF_SAMPLE_END(); |
|
||||||
|
|
||||||
SANITY_CHECK_NOTHING(); |
|
||||||
} |
|
||||||
|
|
||||||
}} // namespace
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue