Merge pull request #13555 from qchateau:nr_blocks_gain_filtering_iterations

This commit is contained in:
Alexander Alekhin 2019-01-04 12:12:35 +00:00
commit 78da679472
2 changed files with 6 additions and 3 deletions

View File

@ -159,12 +159,14 @@ class CV_EXPORTS_W BlocksCompensator : public ExposureCompensator
{ {
public: public:
BlocksCompensator(int bl_width=32, int bl_height=32, int nr_feeds=1) BlocksCompensator(int bl_width=32, int bl_height=32, int nr_feeds=1)
: bl_width_(bl_width), bl_height_(bl_height), nr_feeds_(nr_feeds) {} : bl_width_(bl_width), bl_height_(bl_height), nr_feeds_(nr_feeds), nr_gain_filtering_iterations_(2) {}
CV_WRAP void apply(int index, Point corner, InputOutputArray image, InputArray mask) CV_OVERRIDE; CV_WRAP void apply(int index, Point corner, InputOutputArray image, InputArray mask) CV_OVERRIDE;
CV_WRAP void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE; CV_WRAP void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE;
CV_WRAP void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE; CV_WRAP void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE;
CV_WRAP void setNrFeeds(int nr_feeds) { nr_feeds_ = nr_feeds; } CV_WRAP void setNrFeeds(int nr_feeds) { nr_feeds_ = nr_feeds; }
CV_WRAP int getNrFeeds() { return nr_feeds_; } CV_WRAP int getNrFeeds() { return nr_feeds_; }
CV_WRAP void setNrGainsFilteringIterations(int nr_iterations) { nr_gain_filtering_iterations_ = nr_iterations; }
CV_WRAP int getNrGainsFilteringIterations() const { return nr_gain_filtering_iterations_; }
protected: protected:
template<class Compensator> template<class Compensator>
@ -178,6 +180,7 @@ private:
int bl_width_, bl_height_; int bl_width_, bl_height_;
std::vector<UMat> gain_maps_; std::vector<UMat> gain_maps_;
int nr_feeds_; int nr_feeds_;
int nr_gain_filtering_iterations_;
}; };
/** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image block /** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image block

View File

@ -411,8 +411,8 @@ void BlocksCompensator::feed(const std::vector<Point> &corners, const std::vecto
UMat gain_map = getGainMap(compensator, bl_idx, bl_per_img); UMat gain_map = getGainMap(compensator, bl_idx, bl_per_img);
bl_idx += bl_per_img.width*bl_per_img.height; bl_idx += bl_per_img.width*bl_per_img.height;
sepFilter2D(gain_map, gain_map, CV_32F, ker, ker); for (int i=0; i<nr_gain_filtering_iterations_; ++i)
sepFilter2D(gain_map, gain_map, CV_32F, ker, ker); sepFilter2D(gain_map, gain_map, CV_32F, ker, ker);
gain_maps_[img_idx] = gain_map; gain_maps_[img_idx] = gain_map;
} }