1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge pull request #12827 from hrnr:stitching_4

[evolution] Stitching for OpenCV 4.0

* stitching: wrap Stitcher::create for bindings

* provide method for consistent stitcher usage across languages

* samples: add python stitching sample

* port cpp stitching sample to python

* stitching: consolidate Stitcher create methods

* remove Stitcher::createDefault, it returns Stitcher, not Ptr<Stitcher> -> inconsistent API
* deprecate cv::createStitcher and cv::createStitcherScans in favor of Stitcher::create

* stitching: avoid anonymous enum in Stitcher

* ORIG_RESOL should be double
* add documentatiton

* stitching: improve documentation in Stitcher

* stitching: expose estimator in Stitcher

* remove ABI hack

* stitching: drop try_use_gpu flag

* OCL will be used automatically through T-API in OCL-enable paths
* CUDA won't be used unless user sets CUDA-enabled classes manually

* stitching: drop FeaturesFinder

* use Feature2D instead of FeaturesFinder
* interoperability with features2d module
* detach from dependency on xfeatures2d

* features2d: fix compute and detect to work with UMat vectors

* correctly pass UMats as UMats to allow OCL paths
* support vector of UMats as output arg

* stitching: use nearest interpolation for resizing masks

* fix warnings
This commit is contained in:
Jiri Horner
2018-11-10 17:53:48 +01:00
committed by Alexander Alekhin
parent be9b676db3
commit 1ba7c728a6
18 changed files with 329 additions and 810 deletions
+13 -13
View File
@@ -17,6 +17,10 @@
#include "opencv2/stitching/detail/warpers.hpp"
#include "opencv2/stitching/warpers.hpp"
#ifdef HAVE_OPENCV_XFEATURES2D
#include "opencv2/xfeatures2d/nonfree.hpp"
#endif
#define ENABLE_LOG 1
#define LOG(msg) std::cout << msg
#define LOGLN(msg) std::cout << msg << std::endl
@@ -374,23 +378,20 @@ int main(int argc, char* argv[])
int64 t = getTickCount();
#endif
Ptr<FeaturesFinder> finder;
if (features_type == "surf")
Ptr<Feature2D> finder;
if (features_type == "orb")
{
#ifdef HAVE_OPENCV_XFEATURES2D
if (try_cuda && cuda::getCudaEnabledDeviceCount() > 0)
finder = makePtr<SurfFeaturesFinderGpu>();
else
#endif
finder = makePtr<SurfFeaturesFinder>();
finder = ORB::create();
}
else if (features_type == "orb")
#ifdef HAVE_OPENCV_XFEATURES2D
else if (features_type == "surf")
{
finder = makePtr<OrbFeaturesFinder>();
finder = xfeatures2d::SURF::create();
}
else if (features_type == "sift") {
finder = makePtr<SiftFeaturesFinder>();
finder = xfeatures2d::SIFT::create();
}
#endif
else
{
cout << "Unknown 2D features type: '" << features_type << "'.\n";
@@ -435,7 +436,7 @@ int main(int argc, char* argv[])
is_seam_scale_set = true;
}
(*finder)(img, features[i]);
computeImageFeatures(finder, img, features[i]);
features[i].img_idx = i;
LOGLN("Features in image #" << i+1 << ": " << features[i].keypoints.size());
@@ -443,7 +444,6 @@ int main(int argc, char* argv[])
images[i] = img.clone();
}
finder->collectGarbage();
full_img.release();
img.release();