5

I'm trying to reduce the calculation time of my stitching algorithm. I got some images which I want to stitch in a defined order but it seems like cv::stitcher.stitch() function tries to stitch every image with every other image.

I feel like I might find the solution in the parameters of OpenCV Stitcher. If not maybe I have to modify the function or try something else to reduce calculation time. But since I'm pretty much a beginner, I don't know how. I know that using GPU might be a possibility but I just don't get CUDA running on Ubuntu at the moment.

It would be great if you could give me some advice!

Parameters for OpenCV Stitcher module:

Stitcher Stitcher::createDefault(bool try_use_gpu) {
Stitcher stitcher;
stitcher.setRegistrationResol(0.6);
stitcher.setSeamEstimationResol(0.1);       
stitcher.setCompositingResol(ORIG_RESOL);    
stitcher.setPanoConfidenceThresh(1);    
stitcher.setWaveCorrection(true);    
stitcher.setWaveCorrectKind(detail::WAVE_CORRECT_HORIZ);    
stitcher.setFeaturesMatcher(new detail::BestOf2NearestMatcher(try_use_gpu));
stitcher.setBundleAdjuster(new detail::BundleAdjusterRay());

from stitcher.cpp:

https://code.ros.org/trac/opencv/browser/trunk/opencv/modules/stitching/src/stitcher.cpp?rev=7244

zx485
  • 28,498
  • 28
  • 50
  • 59
user2481582
  • 73
  • 1
  • 6
  • http://docs.opencv.org/modules/stitching/doc/stitching.html – Suvarna Pattayil Jun 14 '13 at 10:40
  • http://docs.opencv.org/trunk/modules/stitching/doc/high_level.html – LovaBill Jun 14 '13 at 11:23
  • The OpenCV [Documentation](http://docs.opencv.org/modules/stitching/doc/stitching.html) on stitching explains all of the parameters in more detail than could be explained here. If there are any specific questions, change or create a new question – GPPK Jun 14 '13 at 11:50
  • This doesn't really help me. But thanks anyway. I simply want to know why exactly the opencv stitcher algorithm needs so much longer for stitching ~20 images than stitching 2 images. I feel like it should take 19 times longer but it doesn't, probably because it tries to stitch all images with each other instead of stitching the first one to the second, the second to the third and so on because this is what I need. You know what I mean? – user2481582 Jun 14 '13 at 12:15
  • The algorithm does not scales linearly. The first half (registration stage) grows quadratically. – Andrey Kamaev Jun 15 '13 at 15:12
  • 1
    @SuvarnaPattayil your link doesn't explain: setRegistrationResol, setSeamEstimationResol, setCompositingResol, setPanoConfidenceThresh and many more... And the new documentation of opencv 3.1 doesn't give any explanation neither. – LandonZeKepitelOfGreytBritn Jul 22 '17 at 09:40
  • 1
  • 1
    @GPPK your link doesn't explain: setRegistrationResol, setSeamEstimationResol, setCompositingResol, setPanoConfidenceThresh and many more... And the new documentation of opencv 3.1 doesn't give any explanation neither. – LandonZeKepitelOfGreytBritn Jul 22 '17 at 09:41
  • I'd google "opencv stiching doc high level" or dig into the source code. – LovaBill Jul 27 '17 at 09:09

1 Answers1

0

I want to stitch in a defined order but it seems like cv::stitcher.stitch() function tries to stitch every image with every other image.

cv::stitcher does not have a parameter to fulfil your requirement.

However, in the stitching_detailed.cpp sample you have the --rangewidth parameter. By setting it to 1, the algorithm will only consider adjacent image pairs (e.g. for pair 1-2 matches would be computed but not for pair 1-3)

Lukas Weber
  • 455
  • 6
  • 13