vendor: OpenCV 5.0.0 snapshot at 755e50675d97db9b7d449d8bd6b09888646f6c6e
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
// Compatibility
|
||||
#include "shadow_sift.hpp"
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifdef HAVE_OPENCV_XFEATURES2D
|
||||
|
||||
#include "opencv2/xfeatures2d.hpp"
|
||||
using namespace cv::xfeatures2d;
|
||||
|
||||
typedef DAISY::NormalizationType DAISY_NormalizationType;
|
||||
|
||||
typedef AKAZE::DescriptorType AKAZE_DescriptorType;
|
||||
typedef AgastFeatureDetector::DetectorType AgastFeatureDetector_DetectorType;
|
||||
typedef KAZE::DiffusivityType KAZE_DiffusivityType;
|
||||
|
||||
#endif
|
||||
@@ -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,48 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import cv2 as cv
|
||||
import numpy as np
|
||||
|
||||
from tests_common import NewOpenCVTests, unittest
|
||||
|
||||
class xfeatures2d_test(NewOpenCVTests):
|
||||
def setUp(self):
|
||||
super(xfeatures2d_test, self).setUp()
|
||||
if not cv.cuda.getCudaEnabledDeviceCount():
|
||||
self.skipTest("No CUDA-capable device is detected")
|
||||
|
||||
@unittest.skipIf('OPENCV_TEST_DATA_PATH' not in os.environ,
|
||||
"OPENCV_TEST_DATA_PATH is not defined")
|
||||
def test_surf(self):
|
||||
img_path = os.environ['OPENCV_TEST_DATA_PATH'] + "/gpu/features2d/aloe.png"
|
||||
hessianThreshold = 100
|
||||
nOctaves = 3
|
||||
nOctaveLayers = 2
|
||||
extended = False
|
||||
keypointsRatio = 0.05
|
||||
upright = False
|
||||
|
||||
npMat = cv.cvtColor(cv.imread(img_path),cv.COLOR_BGR2GRAY)
|
||||
cuMat = cv.cuda_GpuMat(npMat)
|
||||
|
||||
try:
|
||||
cuSurf = cv.cuda_SURF_CUDA.create(hessianThreshold,nOctaves,nOctaveLayers,extended,keypointsRatio,upright)
|
||||
surf = cv.xfeatures2d_SURF.create(hessianThreshold,nOctaves,nOctaveLayers,extended,upright)
|
||||
except cv.error as e:
|
||||
self.assertEqual(e.code, cv.Error.StsNotImplemented)
|
||||
self.skipTest("OPENCV_ENABLE_NONFREE is not enabled in this build.")
|
||||
|
||||
cuKeypoints = cuSurf.detect(cuMat,cv.cuda_GpuMat())
|
||||
keypointsHost = cuSurf.downloadKeypoints(cuKeypoints)
|
||||
keypoints = surf.detect(npMat)
|
||||
self.assertTrue(len(keypointsHost) == len(keypoints))
|
||||
|
||||
cuKeypoints, cuDescriptors = cuSurf.detectWithDescriptors(cuMat,cv.cuda_GpuMat(),cuKeypoints,useProvidedKeypoints=True)
|
||||
keypointsHost = cuSurf.downloadKeypoints(cuKeypoints)
|
||||
descriptorsHost = cuDescriptors.download()
|
||||
keypoints, descriptors = surf.compute(npMat,keypoints)
|
||||
|
||||
self.assertTrue(len(keypointsHost) == len(keypoints) and descriptorsHost.shape == descriptors.shape)
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/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 MSDDetector_test(NewOpenCVTests):
|
||||
|
||||
def test_create(self):
|
||||
|
||||
msd = cv.xfeatures2d.MSDDetector_create()
|
||||
self.assertFalse(msd is None)
|
||||
|
||||
img1 = np.zeros((100, 100, 3), dtype=np.uint8)
|
||||
kp1_ = msd.detect(img1, None)
|
||||
|
||||
class matchLOGOS_test(NewOpenCVTests):
|
||||
|
||||
def test_basic(self):
|
||||
|
||||
frame = self.get_sample('python/images/baboon.png', cv.IMREAD_COLOR)
|
||||
detector = cv.xfeatures2d.AKAZE_create(threshold = 0.003)
|
||||
|
||||
keypoints1, descrs1 = detector.detectAndCompute(frame, None)
|
||||
keypoints2, descrs2 = detector.detectAndCompute(frame, None)
|
||||
matches1to2 = cv.xfeatures2d.matchLOGOS(keypoints1, keypoints2, range(len(keypoints1)), range(len(keypoints2)))
|
||||
self.assertFalse(matches1to2 is None)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
@@ -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()
|
||||
Reference in New Issue
Block a user