43#ifndef OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP
44#define OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP
47# warning Detected Apple 'NO' macro definition, it can cause build conflicts. Please, include this header before any Apple headers.
50#include "opencv2/core.hpp"
66 enum { NO, GAIN, GAIN_BLOCKS, CHANNELS, CHANNELS_BLOCKS };
75 CV_WRAP
void feed(
const std::vector<Point> &corners,
const std::vector<UMat> &images,
76 const std::vector<UMat> &masks);
78 virtual void feed(
const std::vector<Point> &corners,
const std::vector<UMat> &images,
79 const std::vector<std::pair<UMat, uchar> > &masks) = 0;
88 CV_WRAP
virtual void getMatGains(CV_OUT std::vector<Mat>& ) {
CV_Error(Error::StsInternal,
"");};
89 CV_WRAP
virtual void setMatGains(std::vector<Mat>& ) {
CV_Error(Error::StsInternal,
""); };
90 CV_WRAP
void setUpdateGain(
bool b) { updateGain = b; };
91 CV_WRAP
bool getUpdateGain() {
return updateGain; };
101 void feed(
const std::vector<Point> &,
const std::vector<UMat> &,
102 const std::vector<std::pair<UMat,uchar> > &) CV_OVERRIDE { }
104 CV_WRAP
void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE { umv.clear();
return; };
105 CV_WRAP
void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE { umv.clear();
return; };
118 : nr_feeds_(nr_feeds), similarity_threshold_(1) {}
119 void feed(
const std::vector<Point> &corners,
const std::vector<UMat> &images,
120 const std::vector<std::pair<UMat,uchar> > &masks) CV_OVERRIDE;
121 void singleFeed(
const std::vector<Point> &corners,
const std::vector<UMat> &images,
122 const std::vector<std::pair<UMat,uchar> > &masks);
124 CV_WRAP
void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE ;
125 CV_WRAP
void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE ;
126 CV_WRAP
void setNrFeeds(
int nr_feeds) { nr_feeds_ = nr_feeds; }
127 CV_WRAP
int getNrFeeds() {
return nr_feeds_; }
128 CV_WRAP
void setSimilarityThreshold(
double similarity_threshold) { similarity_threshold_ = similarity_threshold; }
129 CV_WRAP
double getSimilarityThreshold()
const {
return similarity_threshold_; }
130 void prepareSimilarityMask(
const std::vector<Point> &corners,
const std::vector<UMat> &images);
131 std::vector<double> gains()
const;
134 UMat buildSimilarityMask(InputArray src_array1, InputArray src_array2);
138 double similarity_threshold_;
139 std::vector<UMat> similarities_;
149 : nr_feeds_(nr_feeds), similarity_threshold_(1) {}
150 void feed(
const std::vector<Point> &corners,
const std::vector<UMat> &images,
151 const std::vector<std::pair<UMat,uchar> > &masks) CV_OVERRIDE;
153 CV_WRAP
void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE;
154 CV_WRAP
void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE;
155 CV_WRAP
void setNrFeeds(
int nr_feeds) { nr_feeds_ = nr_feeds; }
156 CV_WRAP
int getNrFeeds() {
return nr_feeds_; }
157 CV_WRAP
void setSimilarityThreshold(
double similarity_threshold) { similarity_threshold_ = similarity_threshold; }
158 CV_WRAP
double getSimilarityThreshold()
const {
return similarity_threshold_; }
159 std::vector<Scalar> gains()
const {
return gains_; }
162 std::vector<Scalar> gains_;
164 double similarity_threshold_;
173 : bl_width_(bl_width), bl_height_(bl_height), nr_feeds_(nr_feeds), nr_gain_filtering_iterations_(2),
174 similarity_threshold_(1) {}
176 CV_WRAP
void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE;
177 CV_WRAP
void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE;
178 CV_WRAP
void setNrFeeds(
int nr_feeds) { nr_feeds_ = nr_feeds; }
179 CV_WRAP
int getNrFeeds() {
return nr_feeds_; }
180 CV_WRAP
void setSimilarityThreshold(
double similarity_threshold) { similarity_threshold_ = similarity_threshold; }
181 CV_WRAP
double getSimilarityThreshold()
const {
return similarity_threshold_; }
182 CV_WRAP
void setBlockSize(
int width,
int height) { bl_width_ = width; bl_height_ = height; }
183 CV_WRAP
void setBlockSize(Size size) { setBlockSize(size.width, size.height); }
184 CV_WRAP Size getBlockSize()
const {
return Size(bl_width_, bl_height_); }
185 CV_WRAP
void setNrGainsFilteringIterations(
int nr_iterations) { nr_gain_filtering_iterations_ = nr_iterations; }
186 CV_WRAP
int getNrGainsFilteringIterations()
const {
return nr_gain_filtering_iterations_; }
189 template<
class Compensator>
190 void feed(
const std::vector<Point> &corners,
const std::vector<UMat> &images,
191 const std::vector<std::pair<UMat,uchar> > &masks);
197 int bl_width_, bl_height_;
198 std::vector<UMat> gain_maps_;
200 int nr_gain_filtering_iterations_;
201 double similarity_threshold_;
216 void feed(
const std::vector<Point> &corners,
const std::vector<UMat> &images,
217 const std::vector<std::pair<UMat,uchar> > &masks) CV_OVERRIDE;
223 CV_WRAP
void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE { BlocksCompensator::getMatGains(umv); }
225 CV_WRAP
void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE { BlocksCompensator::setMatGains(umv); }
237 void feed(
const std::vector<Point> &corners,
const std::vector<UMat> &images,
238 const std::vector<std::pair<UMat,uchar> > &masks) CV_OVERRIDE;
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
Exposure compensator which tries to remove exposure related artifacts by adjusting image block on eac...
Definition: exposure_compensate.hpp:232
void feed(const std::vector< Point > &corners, const std::vector< UMat > &images, const std::vector< std::pair< UMat, uchar > > &masks) CV_OVERRIDE
Exposure compensator which tries to remove exposure related artifacts by adjusting image blocks.
Definition: exposure_compensate.hpp:170
void feed(const std::vector< Point > &corners, const std::vector< UMat > &images, const std::vector< std::pair< UMat, uchar > > &masks)
CV_WRAP void apply(int index, Point corner, InputOutputArray image, InputArray mask) CV_OVERRIDE
Compensate exposure in the specified image.
Exposure compensator which tries to remove exposure related artifacts by adjusting image block intens...
Definition: exposure_compensate.hpp:208
void feed(const std::vector< Point > &corners, const std::vector< UMat > &images, const std::vector< std::pair< UMat, uchar > > &masks) CV_OVERRIDE
Exposure compensator which tries to remove exposure related artifacts by adjusting image intensities ...
Definition: exposure_compensate.hpp:146
void feed(const std::vector< Point > &corners, const std::vector< UMat > &images, const std::vector< std::pair< UMat, uchar > > &masks) CV_OVERRIDE
Base class for all exposure compensators.
Definition: exposure_compensate.hpp:61
virtual void feed(const std::vector< Point > &corners, const std::vector< UMat > &images, const std::vector< std::pair< UMat, uchar > > &masks)=0
Exposure compensator which tries to remove exposure related artifacts by adjusting image intensities,...
Definition: exposure_compensate.hpp:112
void feed(const std::vector< Point > &corners, const std::vector< UMat > &images, const std::vector< std::pair< UMat, uchar > > &masks) CV_OVERRIDE
Stub exposure compensator which does nothing.
Definition: exposure_compensate.hpp:99
void feed(const std::vector< Point > &, const std::vector< UMat > &, const std::vector< std::pair< UMat, uchar > > &) CV_OVERRIDE
Definition: exposure_compensate.hpp:101
#define CV_Error(code, msg)
Call the error handler.
Definition: base.hpp:320
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: cvstd_wrapper.hpp:74