Merge branch 'master' into gpu-cuda-rename
Conflicts: modules/core/include/opencv2/core/cuda.hpp modules/cudacodec/src/thread.cpp modules/cudacodec/src/thread.hpp modules/superres/perf/perf_superres.cpp modules/superres/src/btv_l1_cuda.cpp modules/superres/src/optical_flow.cpp modules/videostab/src/global_motion.cpp modules/videostab/src/inpainting.cpp samples/cpp/stitching_detailed.cpp samples/cpp/videostab.cpp samples/gpu/stereo_multi.cpp
This commit is contained in:
@@ -50,13 +50,13 @@ static const float WEIGHT_EPS = 1e-5f;
|
||||
Ptr<Blender> Blender::createDefault(int type, bool try_gpu)
|
||||
{
|
||||
if (type == NO)
|
||||
return new Blender();
|
||||
return makePtr<Blender>();
|
||||
if (type == FEATHER)
|
||||
return new FeatherBlender();
|
||||
return makePtr<FeatherBlender>();
|
||||
if (type == MULTI_BAND)
|
||||
return new MultiBandBlender(try_gpu);
|
||||
return makePtr<MultiBandBlender>(try_gpu);
|
||||
CV_Error(Error::StsBadArg, "unsupported blending method");
|
||||
return NULL;
|
||||
return Ptr<Blender>();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -48,13 +48,13 @@ namespace detail {
|
||||
Ptr<ExposureCompensator> ExposureCompensator::createDefault(int type)
|
||||
{
|
||||
if (type == NO)
|
||||
return new NoExposureCompensator();
|
||||
return makePtr<NoExposureCompensator>();
|
||||
if (type == GAIN)
|
||||
return new GainCompensator();
|
||||
return makePtr<GainCompensator>();
|
||||
if (type == GAIN_BLOCKS)
|
||||
return new BlocksGainCompensator();
|
||||
return makePtr<BlocksGainCompensator>();
|
||||
CV_Error(Error::StsBadArg, "unsupported exposure compensation method");
|
||||
return NULL;
|
||||
return Ptr<ExposureCompensator>();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -155,8 +155,8 @@ void CpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &feat
|
||||
|
||||
matches_info.matches.clear();
|
||||
|
||||
Ptr<flann::IndexParams> indexParams = new flann::KDTreeIndexParams();
|
||||
Ptr<flann::SearchParams> searchParams = new flann::SearchParams();
|
||||
Ptr<flann::IndexParams> indexParams = makePtr<flann::KDTreeIndexParams>();
|
||||
Ptr<flann::SearchParams> searchParams = makePtr<flann::SearchParams>();
|
||||
|
||||
if (features2.descriptors.depth() == CV_8U)
|
||||
{
|
||||
@@ -314,7 +314,7 @@ SurfFeaturesFinder::SurfFeaturesFinder(double hess_thresh, int num_octaves, int
|
||||
if (num_octaves_descr == num_octaves && num_layers_descr == num_layers)
|
||||
{
|
||||
surf = Algorithm::create<Feature2D>("Feature2D.SURF");
|
||||
if( surf.empty() )
|
||||
if( !surf )
|
||||
CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" );
|
||||
surf->set("hessianThreshold", hess_thresh);
|
||||
surf->set("nOctaves", num_octaves);
|
||||
@@ -325,7 +325,7 @@ SurfFeaturesFinder::SurfFeaturesFinder(double hess_thresh, int num_octaves, int
|
||||
detector_ = Algorithm::create<FeatureDetector>("Feature2D.SURF");
|
||||
extractor_ = Algorithm::create<DescriptorExtractor>("Feature2D.SURF");
|
||||
|
||||
if( detector_.empty() || extractor_.empty() )
|
||||
if( !detector_ || !extractor_ )
|
||||
CV_Error( Error::StsNotImplemented, "OpenCV was built without SURF support" );
|
||||
|
||||
detector_->set("hessianThreshold", hess_thresh);
|
||||
@@ -349,7 +349,7 @@ void SurfFeaturesFinder::find(const Mat &image, ImageFeatures &features)
|
||||
{
|
||||
gray_image = image;
|
||||
}
|
||||
if (surf.empty())
|
||||
if (!surf)
|
||||
{
|
||||
detector_->detect(gray_image, features.keypoints);
|
||||
extractor_->compute(gray_image, features.keypoints, features.descriptors);
|
||||
@@ -365,7 +365,7 @@ void SurfFeaturesFinder::find(const Mat &image, ImageFeatures &features)
|
||||
OrbFeaturesFinder::OrbFeaturesFinder(Size _grid_size, int n_features, float scaleFactor, int nlevels)
|
||||
{
|
||||
grid_size = _grid_size;
|
||||
orb = new ORB(n_features * (99 + grid_size.area())/100/grid_size.area(), scaleFactor, nlevels);
|
||||
orb = makePtr<ORB>(n_features * (99 + grid_size.area())/100/grid_size.area(), scaleFactor, nlevels);
|
||||
}
|
||||
|
||||
void OrbFeaturesFinder::find(const Mat &image, ImageFeatures &features)
|
||||
@@ -534,12 +534,12 @@ BestOf2NearestMatcher::BestOf2NearestMatcher(bool try_use_gpu, float match_conf,
|
||||
#ifdef HAVE_OPENCV_CUDAFEATURES2D
|
||||
if (try_use_gpu && getCudaEnabledDeviceCount() > 0)
|
||||
{
|
||||
impl_ = new GpuMatcher(match_conf);
|
||||
impl_ = makePtr<GpuMatcher>(match_conf);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
impl_ = new CpuMatcher(match_conf);
|
||||
impl_ = makePtr<CpuMatcher>(match_conf);
|
||||
}
|
||||
|
||||
is_thread_safe_ = impl_->isThreadSafe();
|
||||
|
@@ -53,34 +53,34 @@ Stitcher Stitcher::createDefault(bool try_use_gpu)
|
||||
stitcher.setPanoConfidenceThresh(1);
|
||||
stitcher.setWaveCorrection(true);
|
||||
stitcher.setWaveCorrectKind(detail::WAVE_CORRECT_HORIZ);
|
||||
stitcher.setFeaturesMatcher(new detail::BestOf2NearestMatcher(try_use_gpu));
|
||||
stitcher.setBundleAdjuster(new detail::BundleAdjusterRay());
|
||||
stitcher.setFeaturesMatcher(makePtr<detail::BestOf2NearestMatcher>(try_use_gpu));
|
||||
stitcher.setBundleAdjuster(makePtr<detail::BundleAdjusterRay>());
|
||||
|
||||
#ifdef HAVE_OPENCV_CUDA
|
||||
if (try_use_gpu && cuda::getCudaEnabledDeviceCount() > 0)
|
||||
{
|
||||
#ifdef HAVE_OPENCV_NONFREE
|
||||
stitcher.setFeaturesFinder(new detail::SurfFeaturesFinderGpu());
|
||||
stitcher.setFeaturesFinder(makePtr<detail::SurfFeaturesFinderGpu>());
|
||||
#else
|
||||
stitcher.setFeaturesFinder(new detail::OrbFeaturesFinder());
|
||||
stitcher.setFeaturesFinder(makePtr<detail::OrbFeaturesFinder>());
|
||||
#endif
|
||||
stitcher.setWarper(new SphericalWarperGpu());
|
||||
stitcher.setSeamFinder(new detail::GraphCutSeamFinderGpu());
|
||||
stitcher.setWarper(makePtr<SphericalWarperGpu>());
|
||||
stitcher.setSeamFinder(makePtr<detail::GraphCutSeamFinderGpu>());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef HAVE_OPENCV_NONFREE
|
||||
stitcher.setFeaturesFinder(new detail::SurfFeaturesFinder());
|
||||
stitcher.setFeaturesFinder(makePtr<detail::SurfFeaturesFinder>());
|
||||
#else
|
||||
stitcher.setFeaturesFinder(new detail::OrbFeaturesFinder());
|
||||
stitcher.setFeaturesFinder(makePtr<detail::OrbFeaturesFinder>());
|
||||
#endif
|
||||
stitcher.setWarper(new SphericalWarper());
|
||||
stitcher.setSeamFinder(new detail::GraphCutSeamFinder(detail::GraphCutSeamFinderBase::COST_COLOR));
|
||||
stitcher.setWarper(makePtr<SphericalWarper>());
|
||||
stitcher.setSeamFinder(makePtr<detail::GraphCutSeamFinder>(detail::GraphCutSeamFinderBase::COST_COLOR));
|
||||
}
|
||||
|
||||
stitcher.setExposureCompensator(new detail::BlocksGainCompensator());
|
||||
stitcher.setBlender(new detail::MultiBandBlender(try_use_gpu));
|
||||
stitcher.setExposureCompensator(makePtr<detail::BlocksGainCompensator>());
|
||||
stitcher.setBlender(makePtr<detail::MultiBandBlender>(try_use_gpu));
|
||||
|
||||
return stitcher;
|
||||
}
|
||||
|
Reference in New Issue
Block a user