From 8b1f88c40f273ed5ce5accd4ca813a1d95e60ecb Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Thu, 21 Feb 2013 16:12:33 +0400 Subject: [PATCH] updated gpu module API --- modules/core/src/gpumat.cpp | 16 +-- .../gpu/doc/feature_detection_and_description.rst | 110 ++++++++++----------- modules/gpu/doc/object_detection.rst | 4 +- modules/gpu/include/opencv2/gpu/gpu.hpp | 90 ++++++----------- modules/gpu/perf/perf_features2d.cpp | 9 +- modules/gpu/src/cascadeclassifier.cpp | 9 ++ modules/gpu/src/hough.cpp | 8 +- modules/gpu/src/imgproc.cpp | 39 +++----- modules/gpu/src/pyrlk.cpp | 35 +++++-- modules/gpu/test/test_features2d.cpp | 24 ++--- modules/gpu/test/test_gpumat.cpp | 34 +++++++ modules/stitching/src/matchers.cpp | 2 +- samples/gpu/{morfology.cpp => morphology.cpp} | 0 samples/gpu/performance/tests.cpp | 2 +- samples/gpu/surf_keypoint_matcher.cpp | 4 +- 15 files changed, 199 insertions(+), 187 deletions(-) rename samples/gpu/{morfology.cpp => morphology.cpp} (100%) diff --git a/modules/core/src/gpumat.cpp b/modules/core/src/gpumat.cpp index 269e11b..53e118a 100644 --- a/modules/core/src/gpumat.cpp +++ b/modules/core/src/gpumat.cpp @@ -361,13 +361,13 @@ size_t cv::gpu::DeviceInfo::sharedMemPerBlock() const return deviceProps.get(device_id_)->sharedMemPerBlock; } -void cv::gpu::DeviceInfo::queryMemory(size_t& totalMemory, size_t& freeMemory) const +void cv::gpu::DeviceInfo::queryMemory(size_t& _totalMemory, size_t& _freeMemory) const { int prevDeviceID = getDevice(); if (prevDeviceID != device_id_) setDevice(device_id_); - cudaSafeCall( cudaMemGetInfo(&freeMemory, &totalMemory) ); + cudaSafeCall( cudaMemGetInfo(&_freeMemory, &_totalMemory) ); if (prevDeviceID != device_id_) setDevice(prevDeviceID); @@ -375,16 +375,16 @@ void cv::gpu::DeviceInfo::queryMemory(size_t& totalMemory, size_t& freeMemory) c size_t cv::gpu::DeviceInfo::freeMemory() const { - size_t totalMemory, freeMemory; - queryMemory(totalMemory, freeMemory); - return freeMemory; + size_t _totalMemory, _freeMemory; + queryMemory(_totalMemory, _freeMemory); + return _freeMemory; } size_t cv::gpu::DeviceInfo::totalMemory() const { - size_t totalMemory, freeMemory; - queryMemory(totalMemory, freeMemory); - return totalMemory; + size_t _totalMemory, _freeMemory; + queryMemory(_totalMemory, _freeMemory); + return _totalMemory; } bool cv::gpu::DeviceInfo::supports(FeatureSet feature_set) const diff --git a/modules/gpu/doc/feature_detection_and_description.rst b/modules/gpu/doc/feature_detection_and_description.rst index aafc35a..4129ba8 100644 --- a/modules/gpu/doc/feature_detection_and_description.rst +++ b/modules/gpu/doc/feature_detection_and_description.rst @@ -370,16 +370,16 @@ Releases inner buffer memory. -gpu::BruteForceMatcher_GPU_base -------------------------------- -.. ocv:class:: gpu::BruteForceMatcher_GPU_base +gpu::BFMatcher_GPU +-------------------------- +.. ocv:class:: gpu::BFMatcher_GPU Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches between descriptor sets. :: - class BruteForceMatcher_GPU_base + class BFMatcher_GPU { public: - explicit BruteForceMatcher_GPU_base(int norm = cv::NORM_L2); + explicit BFMatcher_GPU(int norm = cv::NORM_L2); // Add descriptors to train descriptor collection. void add(const std::vector& descCollection); @@ -478,67 +478,67 @@ Brute-force descriptor matcher. For each descriptor in the first set, this match }; -The class ``BruteForceMatcher_GPU_base`` has an interface similar to the class :ocv:class:`DescriptorMatcher`. It has two groups of ``match`` methods: for matching descriptors of one image with another image or with an image set. Also, all functions have an alternative to save results either to the GPU memory or to the CPU memory. +The class ``BFMatcher_GPU`` has an interface similar to the class :ocv:class:`DescriptorMatcher`. It has two groups of ``match`` methods: for matching descriptors of one image with another image or with an image set. Also, all functions have an alternative to save results either to the GPU memory or to the CPU memory. .. seealso:: :ocv:class:`DescriptorMatcher`, :ocv:class:`BFMatcher` -gpu::BruteForceMatcher_GPU_base::match --------------------------------------- +gpu::BFMatcher_GPU::match +------------------------------------- Finds the best match for each descriptor from a query set with train descriptors. -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::match(const GpuMat& query, const GpuMat& train, std::vector& matches, const GpuMat& mask = GpuMat()) +.. ocv:function:: void gpu::BFMatcher_GPU::match(const GpuMat& query, const GpuMat& train, std::vector& matches, const GpuMat& mask = GpuMat()) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::matchSingle(const GpuMat& query, const GpuMat& train, GpuMat& trainIdx, GpuMat& distance, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null()) +.. ocv:function:: void gpu::BFMatcher_GPU::matchSingle(const GpuMat& query, const GpuMat& train, GpuMat& trainIdx, GpuMat& distance, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null()) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::match(const GpuMat& query, std::vector& matches, const std::vector& masks = std::vector()) +.. ocv:function:: void gpu::BFMatcher_GPU::match(const GpuMat& query, std::vector& matches, const std::vector& masks = std::vector()) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::matchCollection( const GpuMat& query, const GpuMat& trainCollection, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, const GpuMat& masks=GpuMat(), Stream& stream=Stream::Null() ) +.. ocv:function:: void gpu::BFMatcher_GPU::matchCollection( const GpuMat& query, const GpuMat& trainCollection, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, const GpuMat& masks=GpuMat(), Stream& stream=Stream::Null() ) .. seealso:: :ocv:func:`DescriptorMatcher::match` -gpu::BruteForceMatcher_GPU_base::makeGpuCollection --------------------------------------------------- -Performs a GPU collection of train descriptors and masks in a suitable format for the :ocv:func:`gpu::BruteForceMatcher_GPU_base::matchCollection` function. +gpu::BFMatcher_GPU::makeGpuCollection +------------------------------------------------- +Performs a GPU collection of train descriptors and masks in a suitable format for the :ocv:func:`gpu::BFMatcher_GPU::matchCollection` function. -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::makeGpuCollection(GpuMat& trainCollection, GpuMat& maskCollection, const vector& masks = std::vector()) +.. ocv:function:: void gpu::BFMatcher_GPU::makeGpuCollection(GpuMat& trainCollection, GpuMat& maskCollection, const vector& masks = std::vector()) -gpu::BruteForceMatcher_GPU_base::matchDownload ----------------------------------------------- -Downloads matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU_base::matchSingle` or :ocv:func:`gpu::BruteForceMatcher_GPU_base::matchCollection` to vector with :ocv:class:`DMatch`. +gpu::BFMatcher_GPU::matchDownload +--------------------------------------------- +Downloads matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::matchSingle` or :ocv:func:`gpu::BFMatcher_GPU::matchCollection` to vector with :ocv:class:`DMatch`. -.. ocv:function:: static void gpu::BruteForceMatcher_GPU_base::matchDownload(const GpuMat& trainIdx, const GpuMat& distance, std::vector&matches) +.. ocv:function:: static void gpu::BFMatcher_GPU::matchDownload(const GpuMat& trainIdx, const GpuMat& distance, std::vector&matches) -.. ocv:function:: static void gpu::BruteForceMatcher_GPU_base::matchDownload( const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, std::vector& matches ) +.. ocv:function:: static void gpu::BFMatcher_GPU::matchDownload( const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, std::vector& matches ) -gpu::BruteForceMatcher_GPU_base::matchConvert +gpu::BFMatcher_GPU::matchConvert --------------------------------------------- -Converts matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU_base::matchSingle` or :ocv:func:`gpu::BruteForceMatcher_GPU_base::matchCollection` to vector with :ocv:class:`DMatch`. +Converts matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::matchSingle` or :ocv:func:`gpu::BFMatcher_GPU::matchCollection` to vector with :ocv:class:`DMatch`. -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::matchConvert(const Mat& trainIdx, const Mat& distance, std::vector&matches) +.. ocv:function:: void gpu::BFMatcher_GPU::matchConvert(const Mat& trainIdx, const Mat& distance, std::vector&matches) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::matchConvert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, std::vector&matches) +.. ocv:function:: void gpu::BFMatcher_GPU::matchConvert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, std::vector&matches) -gpu::BruteForceMatcher_GPU_base::knnMatch ------------------------------------------ +gpu::BFMatcher_GPU::knnMatch +---------------------------------------- Finds the ``k`` best matches for each descriptor from a query set with train descriptors. -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::knnMatch(const GpuMat& query, const GpuMat& train, std::vector< std::vector >&matches, int k, const GpuMat& mask = GpuMat(), bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::knnMatch(const GpuMat& query, const GpuMat& train, std::vector< std::vector >&matches, int k, const GpuMat& mask = GpuMat(), bool compactResult = false) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::knnMatchSingle(const GpuMat& query, const GpuMat& train, GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null()) +.. ocv:function:: void gpu::BFMatcher_GPU::knnMatchSingle(const GpuMat& query, const GpuMat& train, GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null()) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::knnMatch(const GpuMat& query, std::vector< std::vector >&matches, int k, const std::vector&masks = std::vector(), bool compactResult = false ) +.. ocv:function:: void gpu::BFMatcher_GPU::knnMatch(const GpuMat& query, std::vector< std::vector >&matches, int k, const std::vector&masks = std::vector(), bool compactResult = false ) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::knnMatch2Collection(const GpuMat& query, const GpuMat& trainCollection, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, const GpuMat& maskCollection = GpuMat(), Stream& stream = Stream::Null()) +.. ocv:function:: void gpu::BFMatcher_GPU::knnMatch2Collection(const GpuMat& query, const GpuMat& trainCollection, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, const GpuMat& maskCollection = GpuMat(), Stream& stream = Stream::Null()) :param query: Query set of descriptors. @@ -560,41 +560,41 @@ The third variant of the method stores the results in GPU memory. -gpu::BruteForceMatcher_GPU_base::knnMatchDownload -------------------------------------------------- -Downloads matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU_base::knnMatchSingle` or :ocv:func:`gpu::BruteForceMatcher_GPU_base::knnMatch2Collection` to vector with :ocv:class:`DMatch`. +gpu::BFMatcher_GPU::knnMatchDownload +------------------------------------------------ +Downloads matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::knnMatchSingle` or :ocv:func:`gpu::BFMatcher_GPU::knnMatch2Collection` to vector with :ocv:class:`DMatch`. -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::knnMatchDownload(const GpuMat& trainIdx, const GpuMat& distance, std::vector< std::vector >&matches, bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::knnMatchDownload(const GpuMat& trainIdx, const GpuMat& distance, std::vector< std::vector >&matches, bool compactResult = false) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::knnMatch2Download(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, std::vector< std::vector >& matches, bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::knnMatch2Download(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, std::vector< std::vector >& matches, bool compactResult = false) If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors. -gpu::BruteForceMatcher_GPU_base::knnMatchConvert +gpu::BFMatcher_GPU::knnMatchConvert ------------------------------------------------ -Converts matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU_base::knnMatchSingle` or :ocv:func:`gpu::BruteForceMatcher_GPU_base::knnMatch2Collection` to CPU vector with :ocv:class:`DMatch`. +Converts matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::knnMatchSingle` or :ocv:func:`gpu::BFMatcher_GPU::knnMatch2Collection` to CPU vector with :ocv:class:`DMatch`. -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::knnMatchConvert(const Mat& trainIdx, const Mat& distance, std::vector< std::vector >&matches, bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::knnMatchConvert(const Mat& trainIdx, const Mat& distance, std::vector< std::vector >&matches, bool compactResult = false) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::knnMatch2Convert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, std::vector< std::vector >& matches, bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::knnMatch2Convert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, std::vector< std::vector >& matches, bool compactResult = false) If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors. -gpu::BruteForceMatcher_GPU_base::radiusMatch --------------------------------------------- +gpu::BFMatcher_GPU::radiusMatch +------------------------------------------- For each query descriptor, finds the best matches with a distance less than a given threshold. -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::radiusMatch(const GpuMat& query, const GpuMat& train, std::vector< std::vector >&matches, float maxDistance, const GpuMat& mask = GpuMat(), bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::radiusMatch(const GpuMat& query, const GpuMat& train, std::vector< std::vector >&matches, float maxDistance, const GpuMat& mask = GpuMat(), bool compactResult = false) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::radiusMatchSingle(const GpuMat& query, const GpuMat& train, GpuMat& trainIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null()) +.. ocv:function:: void gpu::BFMatcher_GPU::radiusMatchSingle(const GpuMat& query, const GpuMat& train, GpuMat& trainIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null()) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::radiusMatch(const GpuMat& query, std::vector< std::vector >&matches, float maxDistance, const std::vector& masks = std::vector(), bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::radiusMatch(const GpuMat& query, std::vector< std::vector >&matches, float maxDistance, const std::vector& masks = std::vector(), bool compactResult = false) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::radiusMatchCollection(const GpuMat& query, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance, const std::vector& masks = std::vector(), Stream& stream = Stream::Null()) +.. ocv:function:: void gpu::BFMatcher_GPU::radiusMatchCollection(const GpuMat& query, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance, const std::vector& masks = std::vector(), Stream& stream = Stream::Null()) :param query: Query set of descriptors. @@ -618,26 +618,26 @@ The third variant of the method stores the results in GPU memory and does not st -gpu::BruteForceMatcher_GPU_base::radiusMatchDownload ----------------------------------------------------- -Downloads matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU_base::radiusMatchSingle` or :ocv:func:`gpu::BruteForceMatcher_GPU_base::radiusMatchCollection` to vector with :ocv:class:`DMatch`. +gpu::BFMatcher_GPU::radiusMatchDownload +--------------------------------------------------- +Downloads matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::radiusMatchSingle` or :ocv:func:`gpu::BFMatcher_GPU::radiusMatchCollection` to vector with :ocv:class:`DMatch`. -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& distance, const GpuMat& nMatches, std::vector< std::vector >&matches, bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& distance, const GpuMat& nMatches, std::vector< std::vector >&matches, bool compactResult = false) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, const GpuMat& nMatches, std::vector< std::vector >& matches, bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, const GpuMat& nMatches, std::vector< std::vector >& matches, bool compactResult = false) If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors. -gpu::BruteForceMatcher_GPU_base::radiusMatchConvert +gpu::BFMatcher_GPU::radiusMatchConvert --------------------------------------------------- -Converts matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU_base::radiusMatchSingle` or :ocv:func:`gpu::BruteForceMatcher_GPU_base::radiusMatchCollection` to vector with :ocv:class:`DMatch`. +Converts matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::radiusMatchSingle` or :ocv:func:`gpu::BFMatcher_GPU::radiusMatchCollection` to vector with :ocv:class:`DMatch`. -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::radiusMatchConvert(const Mat& trainIdx, const Mat& distance, const Mat& nMatches, std::vector< std::vector >&matches, bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::radiusMatchConvert(const Mat& trainIdx, const Mat& distance, const Mat& nMatches, std::vector< std::vector >&matches, bool compactResult = false) -.. ocv:function:: void gpu::BruteForceMatcher_GPU_base::radiusMatchConvert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, const Mat& nMatches, std::vector< std::vector >& matches, bool compactResult = false) +.. ocv:function:: void gpu::BFMatcher_GPU::radiusMatchConvert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, const Mat& nMatches, std::vector< std::vector >& matches, bool compactResult = false) If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors. diff --git a/modules/gpu/doc/object_detection.rst b/modules/gpu/doc/object_detection.rst index 20e3013..1336602 100644 --- a/modules/gpu/doc/object_detection.rst +++ b/modules/gpu/doc/object_detection.rst @@ -271,7 +271,9 @@ gpu::CascadeClassifier_GPU::detectMultiScale ------------------------------------------------ Detects objects of different sizes in the input image. -.. ocv:function:: int gpu::CascadeClassifier_GPU::detectMultiScale( const GpuMat& image, GpuMat& objectsBuf, double scaleFactor=1.1, int minNeighbors=4, Size minSize=Size() ) +.. ocv:function:: int gpu::CascadeClassifier_GPU::detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, double scaleFactor=1.2, int minNeighbors=4, Size minSize=Size()) + +.. ocv:function:: int gpu::CascadeClassifier_GPU::detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, Size maxObjectSize, Size minSize = Size(), double scaleFactor = 1.1, int minNeighbors = 4) :param image: Matrix of type ``CV_8U`` containing an image where objects should be detected. diff --git a/modules/gpu/include/opencv2/gpu/gpu.hpp b/modules/gpu/include/opencv2/gpu/gpu.hpp index 7cc57e4..afbe067 100644 --- a/modules/gpu/include/opencv2/gpu/gpu.hpp +++ b/modules/gpu/include/opencv2/gpu/gpu.hpp @@ -804,31 +804,24 @@ private: GpuMat lab, l, ab; }; - -struct CV_EXPORTS CannyBuf; - -CV_EXPORTS void Canny(const GpuMat& image, GpuMat& edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false); -CV_EXPORTS void Canny(const GpuMat& image, CannyBuf& buf, GpuMat& edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false); -CV_EXPORTS void Canny(const GpuMat& dx, const GpuMat& dy, GpuMat& edges, double low_thresh, double high_thresh, bool L2gradient = false); -CV_EXPORTS void Canny(const GpuMat& dx, const GpuMat& dy, CannyBuf& buf, GpuMat& edges, double low_thresh, double high_thresh, bool L2gradient = false); - struct CV_EXPORTS CannyBuf { - CannyBuf() {} - explicit CannyBuf(const Size& image_size, int apperture_size = 3) {create(image_size, apperture_size);} - CannyBuf(const GpuMat& dx_, const GpuMat& dy_); - void create(const Size& image_size, int apperture_size = 3); - void release(); GpuMat dx, dy; - GpuMat dx_buf, dy_buf; - GpuMat edgeBuf; - GpuMat trackBuf1, trackBuf2; + GpuMat mag; + GpuMat map; + GpuMat st1, st2; + GpuMat unused; Ptr filterDX, filterDY; }; +CV_EXPORTS void Canny(const GpuMat& image, GpuMat& edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false); +CV_EXPORTS void Canny(const GpuMat& image, CannyBuf& buf, GpuMat& edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false); +CV_EXPORTS void Canny(const GpuMat& dx, const GpuMat& dy, GpuMat& edges, double low_thresh, double high_thresh, bool L2gradient = false); +CV_EXPORTS void Canny(const GpuMat& dx, const GpuMat& dy, CannyBuf& buf, GpuMat& edges, double low_thresh, double high_thresh, bool L2gradient = false); + class CV_EXPORTS ImagePyramid { public: @@ -1504,6 +1497,12 @@ public: explicit BruteForceMatcher_GPU(Hamming /*d*/) : BruteForceMatcher_GPU_base(HammingDist) {} }; +class CV_EXPORTS BFMatcher_GPU : public BruteForceMatcher_GPU_base +{ +public: + explicit BFMatcher_GPU(int norm = NORM_L2) : BruteForceMatcher_GPU_base(norm == NORM_L1 ? L1Dist : norm == NORM_L2 ? L2Dist : HammingDist) {} +}; + ////////////////////////////////// CascadeClassifier_GPU ////////////////////////////////////////// // The cascade classifier class for object detection: supports old haar and new lbp xlm formats and nvbin for haar cascades olny. class CV_EXPORTS CascadeClassifier_GPU @@ -1518,7 +1517,8 @@ public: void release(); /* returns number of detected objects */ - int detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, double scaleFactor = 1.1, int minNeighbors = 4, Size minSize = Size()); + int detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, double scaleFactor = 1.2, int minNeighbors = 4, Size minSize = Size()); + int detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, Size maxObjectSize, Size minSize = Size(), double scaleFactor = 1.1, int minNeighbors = 4); bool findLargestObject; bool visualizeInPlace; @@ -1526,7 +1526,6 @@ public: Size getClassifierSize() const; private: - struct CascadeClassifierImpl; CascadeClassifierImpl* impl; struct HaarCascade; @@ -1858,64 +1857,33 @@ inline GoodFeaturesToTrackDetector_GPU::GoodFeaturesToTrackDetector_GPU(int maxC class CV_EXPORTS PyrLKOpticalFlow { public: - PyrLKOpticalFlow() - { - winSize = Size(21, 21); - maxLevel = 3; - iters = 30; - derivLambda = 0.5; - useInitialFlow = false; - minEigThreshold = 1e-4f; - getMinEigenVals = false; - isDeviceArch11_ = !DeviceInfo().supports(FEATURE_SET_COMPUTE_12); - } + PyrLKOpticalFlow(); void sparse(const GpuMat& prevImg, const GpuMat& nextImg, const GpuMat& prevPts, GpuMat& nextPts, GpuMat& status, GpuMat* err = 0); void dense(const GpuMat& prevImg, const GpuMat& nextImg, GpuMat& u, GpuMat& v, GpuMat* err = 0); + void releaseMemory(); + Size winSize; int maxLevel; int iters; - double derivLambda; + double derivLambda; //unused bool useInitialFlow; - float minEigThreshold; - bool getMinEigenVals; - - void releaseMemory() - { - dx_calcBuf_.release(); - dy_calcBuf_.release(); - - prevPyr_.clear(); - nextPyr_.clear(); - - dx_buf_.release(); - dy_buf_.release(); - - uPyr_.clear(); - vPyr_.clear(); - } + float minEigThreshold; //unused + bool getMinEigenVals; //unused private: - void calcSharrDeriv(const GpuMat& src, GpuMat& dx, GpuMat& dy); - - void buildImagePyramid(const GpuMat& img0, vector& pyr, bool withBorder); - - GpuMat dx_calcBuf_; - GpuMat dy_calcBuf_; - + GpuMat uPyr_[2]; vector prevPyr_; vector nextPyr_; + GpuMat vPyr_[2]; + vector unused1; + vector unused2; + bool unused3; - GpuMat dx_buf_; - GpuMat dy_buf_; - - vector uPyr_; - vector vPyr_; - - bool isDeviceArch11_; + GpuMat buf_; }; diff --git a/modules/gpu/perf/perf_features2d.cpp b/modules/gpu/perf/perf_features2d.cpp index 7c966af..a93cef9 100644 --- a/modules/gpu/perf/perf_features2d.cpp +++ b/modules/gpu/perf/perf_features2d.cpp @@ -161,8 +161,7 @@ PERF_TEST_P(DescSize_Norm, Features2D_BFMatch, Combine(Values(64, 128, 256), Val if (PERF_RUN_GPU()) { - cv::gpu::BruteForceMatcher_GPU_base d_matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normType -2) / 2)); + cv::gpu::BFMatcher_GPU d_matcher(normType); cv::gpu::GpuMat d_query(query); cv::gpu::GpuMat d_train(train); @@ -221,8 +220,7 @@ PERF_TEST_P(DescSize_K_Norm, Features2D_BFKnnMatch, Combine( if (PERF_RUN_GPU()) { - cv::gpu::BruteForceMatcher_GPU_base d_matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normType -2) / 2)); + cv::gpu::BFMatcher_GPU d_matcher(normType); cv::gpu::GpuMat d_query(query); cv::gpu::GpuMat d_train(train); @@ -275,8 +273,7 @@ PERF_TEST_P(DescSize_Norm, Features2D_BFRadiusMatch, Combine(Values(64, 128, 256 if (PERF_RUN_GPU()) { - cv::gpu::BruteForceMatcher_GPU_base d_matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normType -2) / 2)); + cv::gpu::BFMatcher_GPU d_matcher(normType); cv::gpu::GpuMat d_query(query); cv::gpu::GpuMat d_train(train); diff --git a/modules/gpu/src/cascadeclassifier.cpp b/modules/gpu/src/cascadeclassifier.cpp index cfaa753..3603933 100644 --- a/modules/gpu/src/cascadeclassifier.cpp +++ b/modules/gpu/src/cascadeclassifier.cpp @@ -58,6 +58,7 @@ bool cv::gpu::CascadeClassifier_GPU::load(const string&) { throw_no Size cv::gpu::CascadeClassifier_GPU::getClassifierSize() const { throw_nogpu(); return Size();} void cv::gpu::CascadeClassifier_GPU::release() { throw_nogpu(); } int cv::gpu::CascadeClassifier_GPU::detectMultiScale( const GpuMat&, GpuMat&, double, int, Size) {throw_nogpu(); return -1;} +int cv::gpu::CascadeClassifier_GPU::detectMultiScale( const GpuMat&, GpuMat&, Size, Size, double, int) {throw_nogpu(); return -1;} #else @@ -682,6 +683,12 @@ int cv::gpu::CascadeClassifier_GPU::detectMultiScale( const GpuMat& image, GpuMa return impl->process(image, objectsBuf, (float)scaleFactor, minNeighbors, findLargestObject, visualizeInPlace, minSize, cv::Size()); } +int cv::gpu::CascadeClassifier_GPU::detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, Size maxObjectSize, Size minSize, double scaleFactor, int minNeighbors) +{ + CV_Assert( !this->empty()); + return impl->process(image, objectsBuf, (float)scaleFactor, minNeighbors, findLargestObject, visualizeInPlace, minSize, maxObjectSize); +} + bool cv::gpu::CascadeClassifier_GPU::load(const string& filename) { release(); @@ -771,6 +778,8 @@ NCVStatus loadFromXML(const std::string &filename, haar.bNeedsTiltedII = false; Ncv32u curMaxTreeDepth; + std::vector xmlFileCont; + std::vector h_TmpClassifierNotRootNodes; haarStages.resize(0); haarClassifierNodes.resize(0); diff --git a/modules/gpu/src/hough.cpp b/modules/gpu/src/hough.cpp index fecb717..09cf018 100644 --- a/modules/gpu/src/hough.cpp +++ b/modules/gpu/src/hough.cpp @@ -121,9 +121,7 @@ void cv::gpu::HoughLines(const GpuMat& src, GpuMat& lines, HoughLinesBuf& buf, f buf.accum.setTo(Scalar::all(0)); DeviceInfo devInfo; - cudaDeviceProp prop; - cudaSafeCall(cudaGetDeviceProperties(&prop, devInfo.deviceID())); - linesAccum_gpu(srcPoints, pointsCount, buf.accum, rho, theta, prop.sharedMemPerBlock, devInfo.supports(FEATURE_SET_COMPUTE_20)); + linesAccum_gpu(srcPoints, pointsCount, buf.accum, rho, theta, devInfo.sharedMemPerBlock(), devInfo.supports(FEATURE_SET_COMPUTE_20)); ensureSizeIsEnough(2, maxLines, CV_32FC2, lines); @@ -196,9 +194,7 @@ void cv::gpu::HoughLinesP(const GpuMat& src, GpuMat& lines, HoughLinesBuf& buf, buf.accum.setTo(Scalar::all(0)); DeviceInfo devInfo; - cudaDeviceProp prop; - cudaSafeCall(cudaGetDeviceProperties(&prop, devInfo.deviceID())); - linesAccum_gpu(srcPoints, pointsCount, buf.accum, rho, theta, prop.sharedMemPerBlock, devInfo.supports(FEATURE_SET_COMPUTE_20)); + linesAccum_gpu(srcPoints, pointsCount, buf.accum, rho, theta, devInfo.sharedMemPerBlock(), devInfo.supports(FEATURE_SET_COMPUTE_20)); ensureSizeIsEnough(1, maxLines, CV_32SC4, lines); diff --git a/modules/gpu/src/imgproc.cpp b/modules/gpu/src/imgproc.cpp index 3e992b5..24f015b 100644 --- a/modules/gpu/src/imgproc.cpp +++ b/modules/gpu/src/imgproc.cpp @@ -91,7 +91,6 @@ void cv::gpu::Canny(const GpuMat&, GpuMat&, double, double, int, bool) { throw_n void cv::gpu::Canny(const GpuMat&, CannyBuf&, GpuMat&, double, double, int, bool) { throw_nogpu(); } void cv::gpu::Canny(const GpuMat&, const GpuMat&, GpuMat&, double, double, bool) { throw_nogpu(); } void cv::gpu::Canny(const GpuMat&, const GpuMat&, CannyBuf&, GpuMat&, double, double, bool) { throw_nogpu(); } -cv::gpu::CannyBuf::CannyBuf(const GpuMat&, const GpuMat&) { throw_nogpu(); } void cv::gpu::CannyBuf::create(const Size&, int) { throw_nogpu(); } void cv::gpu::CannyBuf::release() { throw_nogpu(); } @@ -1429,12 +1428,6 @@ void cv::gpu::convolve(const GpuMat& image, const GpuMat& templ, GpuMat& result, ////////////////////////////////////////////////////////////////////////////// // Canny -cv::gpu::CannyBuf::CannyBuf(const GpuMat& dx_, const GpuMat& dy_) -{ - (void) dx_; - (void) dy_; -} - void cv::gpu::CannyBuf::create(const Size& image_size, int apperture_size) { if (apperture_size > 0) @@ -1449,22 +1442,21 @@ void cv::gpu::CannyBuf::create(const Size& image_size, int apperture_size) } } - ensureSizeIsEnough(image_size, CV_32FC1, edgeBuf); - ensureSizeIsEnough(image_size, CV_32SC1, dx_buf); + ensureSizeIsEnough(image_size, CV_32FC1, mag); + ensureSizeIsEnough(image_size, CV_32SC1, map); - ensureSizeIsEnough(1, image_size.area(), CV_16UC2, trackBuf1); - ensureSizeIsEnough(1, image_size.area(), CV_16UC2, trackBuf2); + ensureSizeIsEnough(1, image_size.area(), CV_16UC2, st1); + ensureSizeIsEnough(1, image_size.area(), CV_16UC2, st2); } void cv::gpu::CannyBuf::release() { dx.release(); dy.release(); - dx_buf.release(); - dy_buf.release(); - edgeBuf.release(); - trackBuf1.release(); - trackBuf2.release(); + mag.release(); + map.release(); + st1.release(); + st2.release(); } namespace canny @@ -1487,13 +1479,14 @@ namespace { using namespace canny; - calcMap(dx, dy, buf.edgeBuf, buf.dx_buf, low_thresh, high_thresh); + buf.map.setTo(Scalar::all(0)); + calcMap(dx, dy, buf.mag, buf.map, low_thresh, high_thresh); - edgesHysteresisLocal(buf.dx_buf, buf.trackBuf1.ptr()); + edgesHysteresisLocal(buf.map, buf.st1.ptr()); - edgesHysteresisGlobal(buf.dx_buf, buf.trackBuf1.ptr(), buf.trackBuf2.ptr()); + edgesHysteresisGlobal(buf.map, buf.st1.ptr(), buf.st2.ptr()); - getEdges(buf.dx_buf, dst); + getEdges(buf.map, dst); } } @@ -1525,14 +1518,14 @@ void cv::gpu::Canny(const GpuMat& src, CannyBuf& buf, GpuMat& dst, double low_th src.locateROI(wholeSize, ofs); GpuMat srcWhole(wholeSize, src.type(), src.datastart, src.step); - calcMagnitude(srcWhole, ofs.x, ofs.y, buf.dx, buf.dy, buf.edgeBuf, L2gradient); + calcMagnitude(srcWhole, ofs.x, ofs.y, buf.dx, buf.dy, buf.mag, L2gradient); } else { buf.filterDX->apply(src, buf.dx, Rect(0, 0, src.cols, src.rows)); buf.filterDY->apply(src, buf.dy, Rect(0, 0, src.cols, src.rows)); - calcMagnitude(buf.dx, buf.dy, buf.edgeBuf, L2gradient); + calcMagnitude(buf.dx, buf.dy, buf.mag, L2gradient); } CannyCaller(buf.dx, buf.dy, buf, dst, static_cast(low_thresh), static_cast(high_thresh)); @@ -1557,7 +1550,7 @@ void cv::gpu::Canny(const GpuMat& dx, const GpuMat& dy, CannyBuf& buf, GpuMat& d dst.create(dx.size(), CV_8U); buf.create(dx.size(), -1); - calcMagnitude(dx, dy, buf.edgeBuf, L2gradient); + calcMagnitude(dx, dy, buf.mag, L2gradient); CannyCaller(dx, dy, buf, dst, static_cast(low_thresh), static_cast(high_thresh)); } diff --git a/modules/gpu/src/pyrlk.cpp b/modules/gpu/src/pyrlk.cpp index d94341d..49a6c5a 100644 --- a/modules/gpu/src/pyrlk.cpp +++ b/modules/gpu/src/pyrlk.cpp @@ -48,8 +48,10 @@ using namespace cv::gpu; #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) +cv::gpu::PyrLKOpticalFlow::PyrLKOpticalFlow() { throw_nogpu(); } void cv::gpu::PyrLKOpticalFlow::sparse(const GpuMat&, const GpuMat&, const GpuMat&, GpuMat&, GpuMat&, GpuMat*) { throw_nogpu(); } void cv::gpu::PyrLKOpticalFlow::dense(const GpuMat&, const GpuMat&, GpuMat&, GpuMat&, GpuMat*) { throw_nogpu(); } +void cv::gpu::PyrLKOpticalFlow::releaseMemory() {} #else /* !defined (HAVE_CUDA) */ @@ -66,6 +68,14 @@ namespace pyrlk PtrStepSzf err, int2 winSize, cudaStream_t stream = 0); } +cv::gpu::PyrLKOpticalFlow::PyrLKOpticalFlow() +{ + winSize = Size(21, 21); + maxLevel = 3; + iters = 30; + useInitialFlow = false; +} + namespace { void calcPatchSize(cv::Size winSize, dim3& block, dim3& patch) @@ -137,11 +147,11 @@ void cv::gpu::PyrLKOpticalFlow::sparse(const GpuMat& prevImg, const GpuMat& next } else { - cvtColor(prevImg, dx_calcBuf_, COLOR_BGR2BGRA); - dx_calcBuf_.convertTo(prevPyr_[0], CV_32F); + cvtColor(prevImg, buf_, COLOR_BGR2BGRA); + buf_.convertTo(prevPyr_[0], CV_32F); - cvtColor(nextImg, dx_calcBuf_, COLOR_BGR2BGRA); - dx_calcBuf_.convertTo(nextPyr_[0], CV_32F); + cvtColor(nextImg, buf_, COLOR_BGR2BGRA); + buf_.convertTo(nextPyr_[0], CV_32F); } for (int level = 1; level <= maxLevel; ++level) @@ -193,9 +203,6 @@ void cv::gpu::PyrLKOpticalFlow::dense(const GpuMat& prevImg, const GpuMat& nextI pyrDown(nextPyr_[level - 1], nextPyr_[level]); } - uPyr_.resize(2); - vPyr_.resize(2); - ensureSizeIsEnough(prevImg.size(), CV_32FC1, uPyr_[0]); ensureSizeIsEnough(prevImg.size(), CV_32FC1, vPyr_[0]); ensureSizeIsEnough(prevImg.size(), CV_32FC1, uPyr_[1]); @@ -225,4 +232,18 @@ void cv::gpu::PyrLKOpticalFlow::dense(const GpuMat& prevImg, const GpuMat& nextI vPyr_[idx].copyTo(v); } +void cv::gpu::PyrLKOpticalFlow::releaseMemory() +{ + prevPyr_.clear(); + nextPyr_.clear(); + + buf_.release(); + + uPyr_[0].release(); + vPyr_[0].release(); + + uPyr_[1].release(); + vPyr_[1].release(); +} + #endif /* !defined (HAVE_CUDA) */ diff --git a/modules/gpu/test/test_features2d.cpp b/modules/gpu/test/test_features2d.cpp index 1fa4fe7..3879ac0 100644 --- a/modules/gpu/test/test_features2d.cpp +++ b/modules/gpu/test/test_features2d.cpp @@ -583,8 +583,7 @@ PARAM_TEST_CASE(BruteForceMatcher, cv::gpu::DeviceInfo, NormCode, DescriptorSize GPU_TEST_P(BruteForceMatcher, Match_Single) { - cv::gpu::BruteForceMatcher_GPU_base matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2)); + cv::gpu::BFMatcher_GPU matcher(normCode); cv::gpu::GpuMat mask; if (useMask) @@ -611,8 +610,7 @@ GPU_TEST_P(BruteForceMatcher, Match_Single) GPU_TEST_P(BruteForceMatcher, Match_Collection) { - cv::gpu::BruteForceMatcher_GPU_base matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2)); + cv::gpu::BFMatcher_GPU matcher(normCode); cv::gpu::GpuMat d_train(train); @@ -666,8 +664,7 @@ GPU_TEST_P(BruteForceMatcher, Match_Collection) GPU_TEST_P(BruteForceMatcher, KnnMatch_2_Single) { - cv::gpu::BruteForceMatcher_GPU_base matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2)); + cv::gpu::BFMatcher_GPU matcher(normCode); const int knn = 2; @@ -706,8 +703,7 @@ GPU_TEST_P(BruteForceMatcher, KnnMatch_2_Single) GPU_TEST_P(BruteForceMatcher, KnnMatch_3_Single) { - cv::gpu::BruteForceMatcher_GPU_base matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2)); + cv::gpu::BFMatcher_GPU matcher(normCode); const int knn = 3; @@ -746,8 +742,7 @@ GPU_TEST_P(BruteForceMatcher, KnnMatch_3_Single) GPU_TEST_P(BruteForceMatcher, KnnMatch_2_Collection) { - cv::gpu::BruteForceMatcher_GPU_base matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2)); + cv::gpu::BFMatcher_GPU matcher(normCode); const int knn = 2; @@ -809,8 +804,7 @@ GPU_TEST_P(BruteForceMatcher, KnnMatch_2_Collection) GPU_TEST_P(BruteForceMatcher, KnnMatch_3_Collection) { - cv::gpu::BruteForceMatcher_GPU_base matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2)); + cv::gpu::BFMatcher_GPU matcher(normCode); const int knn = 3; @@ -872,8 +866,7 @@ GPU_TEST_P(BruteForceMatcher, KnnMatch_3_Collection) GPU_TEST_P(BruteForceMatcher, RadiusMatch_Single) { - cv::gpu::BruteForceMatcher_GPU_base matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2)); + cv::gpu::BFMatcher_GPU matcher(normCode); const float radius = 1.f / countFactor; @@ -922,8 +915,7 @@ GPU_TEST_P(BruteForceMatcher, RadiusMatch_Single) GPU_TEST_P(BruteForceMatcher, RadiusMatch_Collection) { - cv::gpu::BruteForceMatcher_GPU_base matcher( - cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2)); + cv::gpu::BFMatcher_GPU matcher(normCode); const int n = 3; const float radius = 1.f / countFactor * n; diff --git a/modules/gpu/test/test_gpumat.cpp b/modules/gpu/test/test_gpumat.cpp index fc57512..9ece87c 100644 --- a/modules/gpu/test/test_gpumat.cpp +++ b/modules/gpu/test/test_gpumat.cpp @@ -322,4 +322,38 @@ INSTANTIATE_TEST_CASE_P(GPU_GpuMat, ConvertTo, testing::Combine( ALL_DEPTH, WHOLE_SUBMAT)); +//////////////////////////////////////////////////////////////////////////////// +// ensureSizeIsEnough + +struct EnsureSizeIsEnough : testing::TestWithParam +{ + virtual void SetUp() + { + cv::gpu::DeviceInfo devInfo = GetParam(); + cv::gpu::setDevice(devInfo.deviceID()); + } +}; + +GPU_TEST_P(EnsureSizeIsEnough, BufferReuse) +{ + cv::gpu::GpuMat buffer(100, 100, CV_8U); + cv::gpu::GpuMat old = buffer; + + // don't reallocate memory + cv::gpu::ensureSizeIsEnough(10, 20, CV_8U, buffer); + EXPECT_EQ(10, buffer.rows); + EXPECT_EQ(20, buffer.cols); + EXPECT_EQ(CV_8UC1, buffer.type()); + EXPECT_EQ(reinterpret_cast(old.data), reinterpret_cast(buffer.data)); + + // don't reallocate memory + cv::gpu::ensureSizeIsEnough(20, 30, CV_8U, buffer); + EXPECT_EQ(20, buffer.rows); + EXPECT_EQ(30, buffer.cols); + EXPECT_EQ(CV_8UC1, buffer.type()); + EXPECT_EQ(reinterpret_cast(old.data), reinterpret_cast(buffer.data)); +} + +INSTANTIATE_TEST_CASE_P(GPU_GpuMat, EnsureSizeIsEnough, ALL_DEVICES); + #endif // HAVE_CUDA diff --git a/modules/stitching/src/matchers.cpp b/modules/stitching/src/matchers.cpp index 9abfd6b..dc6b5fa 100644 --- a/modules/stitching/src/matchers.cpp +++ b/modules/stitching/src/matchers.cpp @@ -219,7 +219,7 @@ void GpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &feat descriptors1_.upload(features1.descriptors); descriptors2_.upload(features2.descriptors); - BruteForceMatcher_GPU_base matcher(BruteForceMatcher_GPU_base::L2Dist); + BFMatcher_GPU matcher(NORM_L2); MatchesSet matches; // Find 1->2 matches diff --git a/samples/gpu/morfology.cpp b/samples/gpu/morphology.cpp similarity index 100% rename from samples/gpu/morfology.cpp rename to samples/gpu/morphology.cpp diff --git a/samples/gpu/performance/tests.cpp b/samples/gpu/performance/tests.cpp index bc46353..b35102d 100644 --- a/samples/gpu/performance/tests.cpp +++ b/samples/gpu/performance/tests.cpp @@ -364,7 +364,7 @@ TEST(BruteForceMatcher) // Init GPU matcher - gpu::BruteForceMatcher_GPU_base d_matcher(gpu::BruteForceMatcher_GPU_base::L2Dist); + gpu::BFMatcher_GPU d_matcher(NORM_L2); gpu::GpuMat d_query(query); gpu::GpuMat d_train(train); diff --git a/samples/gpu/surf_keypoint_matcher.cpp b/samples/gpu/surf_keypoint_matcher.cpp index 76a3e6d..617cda5 100644 --- a/samples/gpu/surf_keypoint_matcher.cpp +++ b/samples/gpu/surf_keypoint_matcher.cpp @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) cout << "FOUND " << keypoints2GPU.cols << " keypoints on second image" << endl; // matching descriptors - gpu::BruteForceMatcher_GPU_base matcher(gpu::BruteForceMatcher_GPU_base::L2Dist); + BFMatcher_GPU matcher(NORM_L2); GpuMat trainIdx, distance; matcher.matchSingle(descriptors1GPU, descriptors2GPU, trainIdx, distance); @@ -69,7 +69,7 @@ int main(int argc, char* argv[]) surf.downloadKeypoints(keypoints2GPU, keypoints2); surf.downloadDescriptors(descriptors1GPU, descriptors1); surf.downloadDescriptors(descriptors2GPU, descriptors2); - BruteForceMatcher_GPU_base::matchDownload(trainIdx, distance, matches); + BFMatcher_GPU::matchDownload(trainIdx, distance, matches); // drawing the results Mat img_matches; -- 2.7.4