Commit fd27d5ea authored by Quentin Chateau's avatar Quentin Chateau Committed by Alexander Alekhin

Merge pull request #13449 from Tytan:stitching-warp-interpolation

Stitching: added functions to set warp interpolation mode (#13449)

* Added functions to set warp interpolation mode

* Use InterpolationFlags enum

* Improved getter/setter naming
parent 493611ac
...@@ -193,6 +193,9 @@ public: ...@@ -193,6 +193,9 @@ public:
CV_WRAP bool waveCorrection() const { return do_wave_correct_; } CV_WRAP bool waveCorrection() const { return do_wave_correct_; }
CV_WRAP void setWaveCorrection(bool flag) { do_wave_correct_ = flag; } CV_WRAP void setWaveCorrection(bool flag) { do_wave_correct_ = flag; }
CV_WRAP InterpolationFlags interpolationFlags() const { return interp_flags_; }
CV_WRAP void setInterpolationFlags(InterpolationFlags interp_flags) { interp_flags_ = interp_flags; }
detail::WaveCorrectKind waveCorrectKind() const { return wave_correct_kind_; } detail::WaveCorrectKind waveCorrectKind() const { return wave_correct_kind_; }
void setWaveCorrectKind(detail::WaveCorrectKind kind) { wave_correct_kind_ = kind; } void setWaveCorrectKind(detail::WaveCorrectKind kind) { wave_correct_kind_ = kind; }
...@@ -289,6 +292,7 @@ private: ...@@ -289,6 +292,7 @@ private:
double seam_est_resol_; double seam_est_resol_;
double compose_resol_; double compose_resol_;
double conf_thresh_; double conf_thresh_;
InterpolationFlags interp_flags_;
Ptr<Feature2D> features_finder_; Ptr<Feature2D> features_finder_;
Ptr<detail::FeaturesMatcher> features_matcher_; Ptr<detail::FeaturesMatcher> features_matcher_;
cv::UMat matching_mask_; cv::UMat matching_mask_;
......
...@@ -55,6 +55,7 @@ Ptr<Stitcher> Stitcher::create(Mode mode) ...@@ -55,6 +55,7 @@ Ptr<Stitcher> Stitcher::create(Mode mode)
stitcher->setSeamFinder(makePtr<detail::GraphCutSeamFinder>(detail::GraphCutSeamFinderBase::COST_COLOR)); stitcher->setSeamFinder(makePtr<detail::GraphCutSeamFinder>(detail::GraphCutSeamFinderBase::COST_COLOR));
stitcher->setBlender(makePtr<detail::MultiBandBlender>(false)); stitcher->setBlender(makePtr<detail::MultiBandBlender>(false));
stitcher->setFeaturesFinder(ORB::create()); stitcher->setFeaturesFinder(ORB::create());
stitcher->setInterpolationFlags(INTER_LINEAR);
stitcher->work_scale_ = 1; stitcher->work_scale_ = 1;
stitcher->seam_scale_ = 1; stitcher->seam_scale_ = 1;
...@@ -185,7 +186,7 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra ...@@ -185,7 +186,7 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra
K(1,1) *= (float)seam_work_aspect_; K(1,1) *= (float)seam_work_aspect_;
K(1,2) *= (float)seam_work_aspect_; K(1,2) *= (float)seam_work_aspect_;
corners[i] = w->warp(seam_est_imgs_[i], K, cameras_[i].R, INTER_LINEAR, BORDER_REFLECT, images_warped[i]); corners[i] = w->warp(seam_est_imgs_[i], K, cameras_[i].R, interp_flags_, BORDER_REFLECT, images_warped[i]);
sizes[i] = images_warped[i].size(); sizes[i] = images_warped[i].size();
w->warp(masks[i], K, cameras_[i].R, INTER_NEAREST, BORDER_CONSTANT, masks_warped[i]); w->warp(masks[i], K, cameras_[i].R, INTER_NEAREST, BORDER_CONSTANT, masks_warped[i]);
...@@ -297,7 +298,7 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra ...@@ -297,7 +298,7 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra
int64 pt = getTickCount(); int64 pt = getTickCount();
#endif #endif
// Warp the current image // Warp the current image
w->warp(img, K, cameras_[img_idx].R, INTER_LINEAR, BORDER_REFLECT, img_warped); w->warp(img, K, cameras_[img_idx].R, interp_flags_, BORDER_REFLECT, img_warped);
LOGLN(" warp the current image: " << ((getTickCount() - pt) / getTickFrequency()) << " sec"); LOGLN(" warp the current image: " << ((getTickCount() - pt) / getTickFrequency()) << " sec");
#if ENABLE_LOG #if ENABLE_LOG
pt = getTickCount(); pt = getTickCount();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment