minor memory optimization in opencv_stitching

This commit is contained in:
Alexey Spizhevoy 2011-05-23 12:20:12 +00:00
parent 4827fbf326
commit 5bf8109dbc
2 changed files with 5 additions and 4 deletions

View File

@ -160,8 +160,7 @@ void MultiBandBlender::prepare(Rect dst_roi)
Blender::prepare(dst_roi);
dst_pyr_laplace_.resize(num_bands_ + 1);
dst_pyr_laplace_[0].create(dst_roi.size(), CV_32FC3);
dst_pyr_laplace_[0].setTo(Scalar::all(0));
dst_pyr_laplace_[0] = dst_;
dst_band_weights_.resize(num_bands_ + 1);
dst_band_weights_[0].create(dst_roi.size(), CV_32F);

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 = 1;
double compose_megapix = 6;
int ba_space = BundleAdjuster::FOCAL_RAY_SPACE;
float conf_thresh = 1.f;
bool wave_correct = true;
@ -453,6 +453,7 @@ int main(int argc, char* argv[])
else
img = full_img;
full_img.release();
Size img_size = img.size();
// Update cameras paramters
cameras[img_idx].focal *= compose_work_aspect;
@ -462,9 +463,10 @@ int main(int argc, char* argv[])
img_warped);
img_warped.convertTo(img_warped_f, CV_32F);
img_warped.release();
img.release();
// Warp current image mask
mask.create(img.size(), CV_8U);
mask.create(img_size, CV_8U);
mask.setTo(Scalar::all(255));
warper->warp(mask, static_cast<float>(cameras[img_idx].focal), cameras[img_idx].R, mask_warped,
INTER_NEAREST, BORDER_CONSTANT);