提交 5bf8109d 编写于 作者: A Alexey Spizhevoy

minor memory optimization in opencv_stitching

上级 4827fbf3
...@@ -160,8 +160,7 @@ void MultiBandBlender::prepare(Rect dst_roi) ...@@ -160,8 +160,7 @@ void MultiBandBlender::prepare(Rect dst_roi)
Blender::prepare(dst_roi); Blender::prepare(dst_roi);
dst_pyr_laplace_.resize(num_bands_ + 1); dst_pyr_laplace_.resize(num_bands_ + 1);
dst_pyr_laplace_[0].create(dst_roi.size(), CV_32FC3); dst_pyr_laplace_[0] = dst_;
dst_pyr_laplace_[0].setTo(Scalar::all(0));
dst_band_weights_.resize(num_bands_ + 1); dst_band_weights_.resize(num_bands_ + 1);
dst_band_weights_[0].create(dst_roi.size(), CV_32F); dst_band_weights_[0].create(dst_roi.size(), CV_32F);
......
...@@ -78,7 +78,7 @@ vector<string> img_names; ...@@ -78,7 +78,7 @@ vector<string> img_names;
bool trygpu = false; bool trygpu = false;
double work_megapix = 0.3; double work_megapix = 0.3;
double seam_megapix = 0.1; double seam_megapix = 0.1;
double compose_megapix = 1; double compose_megapix = 6;
int ba_space = BundleAdjuster::FOCAL_RAY_SPACE; int ba_space = BundleAdjuster::FOCAL_RAY_SPACE;
float conf_thresh = 1.f; float conf_thresh = 1.f;
bool wave_correct = true; bool wave_correct = true;
...@@ -453,6 +453,7 @@ int main(int argc, char* argv[]) ...@@ -453,6 +453,7 @@ int main(int argc, char* argv[])
else else
img = full_img; img = full_img;
full_img.release(); full_img.release();
Size img_size = img.size();
// Update cameras paramters // Update cameras paramters
cameras[img_idx].focal *= compose_work_aspect; cameras[img_idx].focal *= compose_work_aspect;
...@@ -462,9 +463,10 @@ int main(int argc, char* argv[]) ...@@ -462,9 +463,10 @@ int main(int argc, char* argv[])
img_warped); img_warped);
img_warped.convertTo(img_warped_f, CV_32F); img_warped.convertTo(img_warped_f, CV_32F);
img_warped.release(); img_warped.release();
img.release();
// Warp current image mask // Warp current image mask
mask.create(img.size(), CV_8U); mask.create(img_size, CV_8U);
mask.setTo(Scalar::all(255)); mask.setTo(Scalar::all(255));
warper->warp(mask, static_cast<float>(cameras[img_idx].focal), cameras[img_idx].R, mask_warped, warper->warp(mask, static_cast<float>(cameras[img_idx].focal), cameras[img_idx].R, mask_warped,
INTER_NEAREST, BORDER_CONSTANT); INTER_NEAREST, BORDER_CONSTANT);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册