From 868035215f029229099624945465319b64f5ba72 Mon Sep 17 00:00:00 2001 From: Alexey Spizhevoy Date: Sat, 21 May 2011 14:44:37 +0000 Subject: [PATCH] made number of bands in blending parameter --- modules/stitching/blenders.hpp | 2 +- modules/stitching/main.cpp | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/stitching/blenders.hpp b/modules/stitching/blenders.hpp index a3942a353f..d471ee966b 100644 --- a/modules/stitching/blenders.hpp +++ b/modules/stitching/blenders.hpp @@ -43,7 +43,7 @@ private: class MultiBandBlender : public Blender { public: - MultiBandBlender(int num_bands = 7) { setNumBands(num_bands); } + MultiBandBlender(int num_bands = 5) { setNumBands(num_bands); } int numBands() const { return num_bands_; } void setNumBands(int val) { num_bands_ = val; } diff --git a/modules/stitching/main.cpp b/modules/stitching/main.cpp index 82bb014366..78bcfbb4d1 100644 --- a/modules/stitching/main.cpp +++ b/modules/stitching/main.cpp @@ -23,6 +23,7 @@ void printUsage() << "\t[--warp (plane|cylindrical|spherical)]\n" << "\t[--seam (no|voronoi|graphcut)]\n" << "\t[--blend (no|feather|multiband)]\n" + << "\t[--numbands ]\n" << "\t[--output ]\n\n"; cout << "--matchconf\n" << "\tGood values are in [0.2, 0.8] range usually.\n\n"; @@ -45,6 +46,7 @@ bool user_match_conf = false; float match_conf = 0.6f; int seam_find_type = SeamFinder::VORONOI; int blend_type = Blender::MULTI_BAND; +int numbands = 5; string result_name = "result.png"; int parseCmdArgs(int argc, char** argv) @@ -173,6 +175,11 @@ int parseCmdArgs(int argc, char** argv) } i++; } + else if (string(argv[i]) == "--numbands") + { + numbands = atoi(argv[i + 1]); + i++; + } else if (string(argv[i]) == "--output") { result_name = argv[i + 1]; @@ -410,14 +417,12 @@ int main(int argc, char* argv[]) if (static_cast(blender) == 0) { - // Create blender - blender = Blender::createDefault(blend_type); + if (blend_type == Blender::MULTI_BAND) { - // Ensure last pyramid layer area is about 1 pix MultiBandBlender* mb = dynamic_cast(static_cast(blender)); - mb->setNumBands(static_cast(ceil(log(static_cast(img_warped_f.size().area())) / log(4.0)))); + mb->setNumBands(numbands); } // Determine the final image size