put all old stitching API into detail namespace

This commit is contained in:
Alexey Spizhevoy
2011-09-07 06:34:22 +00:00
parent bf0081a850
commit 95a3ffd0c5
24 changed files with 582 additions and 521 deletions

View File

@@ -39,14 +39,17 @@
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
using namespace std;
using namespace cv;
namespace cv {
namespace detail {
static const float WEIGHT_EPS = 1e-5f;
Ptr<Blender> cv::Blender::createDefault(int type, bool try_gpu)
Ptr<Blender> Blender::createDefault(int type, bool try_gpu)
{
if (type == NO)
return new Blender();
@@ -59,13 +62,13 @@ Ptr<Blender> cv::Blender::createDefault(int type, bool try_gpu)
}
void cv::Blender::prepare(const vector<Point> &corners, const vector<Size> &sizes)
void Blender::prepare(const vector<Point> &corners, const vector<Size> &sizes)
{
prepare(resultRoi(corners, sizes));
}
void cv::Blender::prepare(Rect dst_roi)
void Blender::prepare(Rect dst_roi)
{
dst_.create(dst_roi.size(), CV_16SC3);
dst_.setTo(Scalar::all(0));
@@ -75,7 +78,7 @@ void cv::Blender::prepare(Rect dst_roi)
}
void cv::Blender::feed(const Mat &img, const Mat &mask, Point tl)
void Blender::feed(const Mat &img, const Mat &mask, Point tl)
{
CV_Assert(img.type() == CV_16SC3);
CV_Assert(mask.type() == CV_8U);
@@ -99,7 +102,7 @@ void cv::Blender::feed(const Mat &img, const Mat &mask, Point tl)
}
void cv::Blender::blend(Mat &dst, Mat &dst_mask)
void Blender::blend(Mat &dst, Mat &dst_mask)
{
dst_.setTo(Scalar::all(0), dst_mask_ == 0);
dst = dst_;
@@ -109,7 +112,7 @@ void cv::Blender::blend(Mat &dst, Mat &dst_mask)
}
void cv::FeatherBlender::prepare(Rect dst_roi)
void FeatherBlender::prepare(Rect dst_roi)
{
Blender::prepare(dst_roi);
dst_weight_map_.create(dst_roi.size(), CV_32F);
@@ -117,7 +120,7 @@ void cv::FeatherBlender::prepare(Rect dst_roi)
}
void cv::FeatherBlender::feed(const Mat &img, const Mat &mask, Point tl)
void FeatherBlender::feed(const Mat &img, const Mat &mask, Point tl)
{
CV_Assert(img.type() == CV_16SC3);
CV_Assert(mask.type() == CV_8U);
@@ -144,7 +147,7 @@ void cv::FeatherBlender::feed(const Mat &img, const Mat &mask, Point tl)
}
void cv::FeatherBlender::blend(Mat &dst, Mat &dst_mask)
void FeatherBlender::blend(Mat &dst, Mat &dst_mask)
{
normalizeUsingWeightMap(dst_weight_map_, dst_);
dst_mask_ = dst_weight_map_ > WEIGHT_EPS;
@@ -152,14 +155,14 @@ void cv::FeatherBlender::blend(Mat &dst, Mat &dst_mask)
}
cv::MultiBandBlender::MultiBandBlender(int try_gpu, int num_bands)
MultiBandBlender::MultiBandBlender(int try_gpu, int num_bands)
{
setNumBands(num_bands);
can_use_gpu_ = try_gpu && gpu::getCudaEnabledDeviceCount();
}
void cv::MultiBandBlender::prepare(Rect dst_roi)
void MultiBandBlender::prepare(Rect dst_roi)
{
dst_roi_final_ = dst_roi;
@@ -192,7 +195,7 @@ void cv::MultiBandBlender::prepare(Rect dst_roi)
}
void cv::MultiBandBlender::feed(const Mat &img, const Mat &mask, Point tl)
void MultiBandBlender::feed(const Mat &img, const Mat &mask, Point tl)
{
CV_Assert(img.type() == CV_16SC3);
CV_Assert(mask.type() == CV_8U);
@@ -277,7 +280,7 @@ void cv::MultiBandBlender::feed(const Mat &img, const Mat &mask, Point tl)
}
void cv::MultiBandBlender::blend(Mat &dst, Mat &dst_mask)
void MultiBandBlender::blend(Mat &dst, Mat &dst_mask)
{
for (int i = 0; i <= num_bands_; ++i)
normalizeUsingWeightMap(dst_band_weights_[i], dst_pyr_laplace_[i]);
@@ -298,7 +301,7 @@ void cv::MultiBandBlender::blend(Mat &dst, Mat &dst_mask)
//////////////////////////////////////////////////////////////////////////////
// Auxiliary functions
void cv::normalizeUsingWeightMap(const Mat& weight, Mat& src)
void normalizeUsingWeightMap(const Mat& weight, Mat& src)
{
CV_Assert(weight.type() == CV_32F);
CV_Assert(src.type() == CV_16SC3);
@@ -317,7 +320,7 @@ void cv::normalizeUsingWeightMap(const Mat& weight, Mat& src)
}
void cv::createWeightMap(const Mat &mask, float sharpness, Mat &weight)
void createWeightMap(const Mat &mask, float sharpness, Mat &weight)
{
CV_Assert(mask.type() == CV_8U);
distanceTransform(mask, weight, CV_DIST_L1, 3);
@@ -325,7 +328,7 @@ void cv::createWeightMap(const Mat &mask, float sharpness, Mat &weight)
}
void cv::createLaplacePyr(const Mat &img, int num_levels, vector<Mat> &pyr)
void createLaplacePyr(const Mat &img, int num_levels, vector<Mat> &pyr)
{
pyr.resize(num_levels + 1);
pyr[0] = img;
@@ -340,7 +343,7 @@ void cv::createLaplacePyr(const Mat &img, int num_levels, vector<Mat> &pyr)
}
void cv::createLaplacePyrGpu(const Mat &img, int num_levels, vector<Mat> &pyr)
void createLaplacePyrGpu(const Mat &img, int num_levels, vector<Mat> &pyr)
{
pyr.resize(num_levels + 1);
@@ -361,7 +364,7 @@ void cv::createLaplacePyrGpu(const Mat &img, int num_levels, vector<Mat> &pyr)
}
void cv::restoreImageFromLaplacePyr(vector<Mat> &pyr)
void restoreImageFromLaplacePyr(vector<Mat> &pyr)
{
if (pyr.size() == 0)
return;
@@ -372,3 +375,6 @@ void cv::restoreImageFromLaplacePyr(vector<Mat> &pyr)
add(tmp, pyr[i - 1], pyr[i - 1]);
}
}
} // namespace detail
} // namespace cv