minor changes in opencv_stitching

This commit is contained in:
Alexey Spizhevoy 2011-05-23 14:28:53 +00:00
parent 47443d9826
commit 3bb685a744
2 changed files with 19 additions and 12 deletions

View File

@ -185,13 +185,16 @@ void MultiBandBlender::feed(const Mat &img, const Mat &mask, Point tl)
CV_Assert(img.type() == CV_16SC3);
CV_Assert(mask.type() == CV_8U);
int top = tl.y - dst_roi_.y;
int left = tl.x - dst_roi_.x;
int bottom = dst_roi_.br().y - tl.y - img.rows;
int right = dst_roi_.br().x - tl.x - img.cols;
Point tl_new(dst_roi_.tl());
Point br_new(dst_roi_.br());
int top = tl.y - tl_new.y;
int left = tl.x - tl_new.x;
int bottom = br_new.y - tl.y - img.rows;
int right = br_new.x - tl.x - img.cols;
// Create the source image Laplacian pyramid
vector<Mat> src_pyr_gauss(num_bands_ + 1);
src_pyr_gauss[0] = img;
copyMakeBorder(img, src_pyr_gauss[0], top, bottom, left, right,
BORDER_REFLECT);
for (int i = 0; i < num_bands_; ++i)
@ -212,21 +215,25 @@ void MultiBandBlender::feed(const Mat &img, const Mat &mask, Point tl)
// Add weighted layer of the source image to the final Laplacian pyramid layer
for (int i = 0; i <= num_bands_; ++i)
{
for (int y = 0; y < dst_pyr_laplace_[i].rows; ++y)
int dx = 0;//(tl_new.x >> i) - (dst_roi_.x >> i);
int dy = 0;//(tl_new.y >> i) - (dst_roi_.y >> i);
for (int y = 0; y < src_pyr_laplace[i].rows; ++y)
{
const Point3_<short>* src_row = src_pyr_laplace[i].ptr<Point3_<short> >(y);
Point3_<short>* dst_row = dst_pyr_laplace_[i].ptr<Point3_<short> >(y);
Point3_<short>* dst_row = dst_pyr_laplace_[i].ptr<Point3_<short> >(y + dy);
const float* weight_row = weight_pyr_gauss[i].ptr<float>(y);
float* dst_weight_row = dst_band_weights_[i].ptr<float>(y + dy);
for (int x = 0; x < dst_pyr_laplace_[i].cols; ++x)
for (int x = 0; x < src_pyr_laplace[i].cols; ++x)
{
dst_row[x].x += static_cast<short>(src_row[x].x * weight_row[x]);
dst_row[x].y += static_cast<short>(src_row[x].y * weight_row[x]);
dst_row[x].z += static_cast<short>(src_row[x].z * weight_row[x]);
dst_row[x + dx].x += static_cast<short>(src_row[x].x * weight_row[x]);
dst_row[x + dx].y += static_cast<short>(src_row[x].y * weight_row[x]);
dst_row[x + dx].z += static_cast<short>(src_row[x].z * weight_row[x]);
dst_weight_row[x + dx] += weight_row[x];
}
}
dst_band_weights_[i] += weight_pyr_gauss[i];
}
}

View File

@ -78,7 +78,7 @@ vector<string> img_names;
bool trygpu = false;
double work_megapix = 0.3;
double seam_megapix = 0.1;
double compose_megapix = 6;
double compose_megapix = 1;
int ba_space = BundleAdjuster::FOCAL_RAY_SPACE;
float conf_thresh = 1.f;
bool wave_correct = true;