@@ -261,6 +261,8 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra
261
261
double compose_scale = 1 ;
262
262
bool is_compose_scale_set = false ;
263
263
264
+ std::vector<detail::CameraParams> cameras_scaled (cameras_);
265
+
264
266
UMat full_img, img;
265
267
for (size_t img_idx = 0 ; img_idx < imgs_.size (); ++img_idx)
266
268
{
@@ -282,16 +284,16 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra
282
284
compose_work_aspect = compose_scale / work_scale_;
283
285
284
286
// Update warped image scale
285
- warped_image_scale_ * = static_cast <float >(compose_work_aspect);
286
- w = warper_->create (( float )warped_image_scale_ );
287
+ float warp_scale = static_cast <float >(warped_image_scale_ * compose_work_aspect);
288
+ w = warper_->create (warp_scale );
287
289
288
290
// Update corners and sizes
289
291
for (size_t i = 0 ; i < imgs_.size (); ++i)
290
292
{
291
293
// Update intrinsics
292
- cameras_ [i].focal *= compose_work_aspect;
293
- cameras_ [i].ppx *= compose_work_aspect;
294
- cameras_ [i].ppy *= compose_work_aspect;
294
+ cameras_scaled [i].ppx *= compose_work_aspect;
295
+ cameras_scaled [i].ppy *= compose_work_aspect;
296
+ cameras_scaled [i].focal *= compose_work_aspect;
295
297
296
298
// Update corner and size
297
299
Size sz = full_img_sizes_[i];
@@ -302,8 +304,8 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra
302
304
}
303
305
304
306
Mat K;
305
- cameras_ [i].K ().convertTo (K, CV_32F);
306
- Rect roi = w->warpRoi (sz, K, cameras_ [i].R );
307
+ cameras_scaled [i].K ().convertTo (K, CV_32F);
308
+ Rect roi = w->warpRoi (sz, K, cameras_scaled [i].R );
307
309
corners[i] = roi.tl ();
308
310
sizes[i] = roi.size ();
309
311
}
@@ -324,7 +326,7 @@ Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArra
324
326
LOGLN (" after resize time: " << ((getTickCount () - compositing_t ) / getTickFrequency ()) << " sec" );
325
327
326
328
Mat K;
327
- cameras_ [img_idx].K ().convertTo (K, CV_32F);
329
+ cameras_scaled [img_idx].K ().convertTo (K, CV_32F);
328
330
329
331
#if ENABLE_LOG
330
332
int64 pt = getTickCount ();
0 commit comments