added number of bands estimation in opencv_stitching
This commit is contained in:
parent
767a6e8e78
commit
5b50d63754
@ -41,6 +41,9 @@ class MultiBandBlender : public Blender
|
|||||||
public:
|
public:
|
||||||
MultiBandBlender(int num_bands = 7) : num_bands_(num_bands) {}
|
MultiBandBlender(int num_bands = 7) : num_bands_(num_bands) {}
|
||||||
|
|
||||||
|
int numBands() const { return num_bands_; }
|
||||||
|
void setNumBands(int val) { num_bands_ = val; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cv::Point blend(const std::vector<cv::Mat> &src, const std::vector<cv::Point> &corners, const std::vector<cv::Mat> &masks,
|
cv::Point blend(const std::vector<cv::Mat> &src, const std::vector<cv::Point> &corners, const std::vector<cv::Mat> &masks,
|
||||||
cv::Mat& dst, cv::Mat& dst_mask);
|
cv::Mat& dst, cv::Mat& dst_mask);
|
||||||
|
@ -347,8 +347,13 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
t = getTickCount();
|
t = getTickCount();
|
||||||
LOGLN("Blending images...");
|
LOGLN("Blending images...");
|
||||||
Mat result, result_mask;
|
|
||||||
Ptr<Blender> blender = Blender::createDefault(blend_type);
|
Ptr<Blender> blender = Blender::createDefault(blend_type);
|
||||||
|
if (blend_type == Blender::MULTI_BAND)
|
||||||
|
// Ensure last pyramid layer area is about 1 pix
|
||||||
|
dynamic_cast<MultiBandBlender*>((Blender*)(blender))
|
||||||
|
->setNumBands(static_cast<int>(ceil(log(static_cast<double>(images_f[0].size().area()))
|
||||||
|
/ log(4.0))));
|
||||||
|
Mat result, result_mask;
|
||||||
(*blender)(images_f, corners, masks_warped, result, result_mask);
|
(*blender)(images_f, corners, masks_warped, result, result_mask);
|
||||||
LOGLN("Blending images, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");
|
LOGLN("Blending images, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user