1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 //  By downloading, copying, installing or using the software you agree to this license.
6 //  If you do not agree to this license, do not download, install,
7 //  copy or use the software.
8 //
9 //
10 //                          License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
16 //
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
19 //
20 //   * Redistribution's of source code must retain the above copyright notice,
21 //     this list of conditions and the following disclaimer.
22 //
23 //   * Redistribution's in binary form must reproduce the above copyright notice,
24 //     this list of conditions and the following disclaimer in the documentation
25 //     and/or other materials provided with the distribution.
26 //
27 //   * The name of the copyright holders may not be used to endorse or promote products
28 //     derived from this software without specific prior written permission.
29 //
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
40 //
41 //M*/
42 
43 #include "precomp.hpp"
44 #ifdef HAVE_EIGEN
45 #include <Eigen/Core>
46 #include <Eigen/Dense>
47 #endif
48 
49 namespace cv {
50 namespace detail {
51 
createDefault(int type)52 Ptr<ExposureCompensator> ExposureCompensator::createDefault(int type)
53 {
54     Ptr<ExposureCompensator> e;
55     if (type == NO)
56         e = makePtr<NoExposureCompensator>();
57     else if (type == GAIN)
58         e = makePtr<GainCompensator>();
59     else if (type == GAIN_BLOCKS)
60         e = makePtr<BlocksGainCompensator>();
61     else if (type == CHANNELS)
62         e = makePtr<ChannelsCompensator>();
63     else if (type == CHANNELS_BLOCKS)
64         e = makePtr<BlocksChannelsCompensator>();
65 
66     if (e.get() != nullptr)
67         return e;
68 
69     CV_Error(Error::StsBadArg, "unsupported exposure compensation method");
70 }
71 
72 
feed(const std::vector<Point> & corners,const std::vector<UMat> & images,const std::vector<UMat> & masks)73 void ExposureCompensator::feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
74                                const std::vector<UMat> &masks)
75 {
76     std::vector<std::pair<UMat,uchar> > level_masks;
77     for (size_t i = 0; i < masks.size(); ++i)
78         level_masks.push_back(std::make_pair(masks[i], (uchar)255));
79     feed(corners, images, level_masks);
80 }
81 
82 
feed(const std::vector<Point> & corners,const std::vector<UMat> & images,const std::vector<std::pair<UMat,uchar>> & masks)83 void GainCompensator::feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
84                            const std::vector<std::pair<UMat,uchar> > &masks)
85 {
86     LOGLN("Exposure compensation...");
87 #if ENABLE_LOG
88     int64 t = getTickCount();
89 #endif
90 
91     const int num_images = static_cast<int>(images.size());
92     Mat accumulated_gains;
93     prepareSimilarityMask(corners, images);
94 
95     for (int n = 0; n < nr_feeds_; ++n)
96     {
97         if (n > 0)
98         {
99             // Apply previous iteration gains
100             for (int i = 0; i < num_images; ++i)
101                 apply(i, corners[i], images[i], masks[i].first);
102         }
103 
104         singleFeed(corners, images, masks);
105 
106         if (n == 0)
107             accumulated_gains = gains_.clone();
108         else
109             multiply(accumulated_gains, gains_, accumulated_gains);
110     }
111     gains_ = accumulated_gains;
112 
113     LOGLN("Exposure compensation, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");
114 }
115 
singleFeed(const std::vector<Point> & corners,const std::vector<UMat> & images,const std::vector<std::pair<UMat,uchar>> & masks)116 void GainCompensator::singleFeed(const std::vector<Point> &corners, const std::vector<UMat> &images,
117                                  const std::vector<std::pair<UMat,uchar> > &masks)
118 {
119     CV_Assert(corners.size() == images.size() && images.size() == masks.size());
120 
121     if (images.size() == 0)
122         return;
123 
124     const int num_channels = images[0].channels();
125     CV_Assert(std::all_of(images.begin(), images.end(),
126         [num_channels](const UMat& image) { return image.channels() == num_channels; }));
127     CV_Assert(num_channels == 1 || num_channels == 3);
128 
129     const int num_images = static_cast<int>(images.size());
130     Mat_<int> N(num_images, num_images); N.setTo(0);
131     Mat_<double> I(num_images, num_images); I.setTo(0);
132     Mat_<bool> skip(num_images, 1); skip.setTo(true);
133 
134     Mat subimg1, subimg2;
135     Mat_<uchar> submask1, submask2, intersect;
136 
137     std::vector<UMat>::iterator similarity_it = similarities_.begin();
138 
139     for (int i = 0; i < num_images; ++i)
140     {
141         for (int j = i; j < num_images; ++j)
142         {
143             Rect roi;
144             if (overlapRoi(corners[i], corners[j], images[i].size(), images[j].size(), roi))
145             {
146                 subimg1 = images[i](Rect(roi.tl() - corners[i], roi.br() - corners[i])).getMat(ACCESS_READ);
147                 subimg2 = images[j](Rect(roi.tl() - corners[j], roi.br() - corners[j])).getMat(ACCESS_READ);
148 
149                 submask1 = masks[i].first(Rect(roi.tl() - corners[i], roi.br() - corners[i])).getMat(ACCESS_READ);
150                 submask2 = masks[j].first(Rect(roi.tl() - corners[j], roi.br() - corners[j])).getMat(ACCESS_READ);
151                 intersect = (submask1 == masks[i].second) & (submask2 == masks[j].second);
152 
153                 if (!similarities_.empty())
154                 {
155                     CV_Assert(similarity_it != similarities_.end());
156                     UMat similarity = *similarity_it++;
157                     // in-place operation has an issue. don't remove the swap
158                     // detail https://github.com/opencv/opencv/issues/19184
159                     Mat_<uchar> intersect_updated;
160                     bitwise_and(intersect, similarity, intersect_updated);
161                     std::swap(intersect, intersect_updated);
162                 }
163 
164                 int intersect_count = countNonZero(intersect);
165                 N(i, j) = N(j, i) = std::max(1, intersect_count);
166 
167                 // Don't compute Isums if subimages do not intersect anyway
168                 if (intersect_count == 0)
169                     continue;
170 
171                 // Don't skip images that intersect with at least one other image
172                 if (i != j)
173                 {
174                     skip(i, 0) = false;
175                     skip(j, 0) = false;
176                 }
177 
178                 double Isum1 = 0, Isum2 = 0;
179                 for (int y = 0; y < roi.height; ++y)
180                 {
181                     if (num_channels == 3)
182                     {
183                         const Vec<uchar, 3>* r1 = subimg1.ptr<Vec<uchar, 3> >(y);
184                         const Vec<uchar, 3>* r2 = subimg2.ptr<Vec<uchar, 3> >(y);
185                         for (int x = 0; x < roi.width; ++x)
186                         {
187                             if (intersect(y, x))
188                             {
189                                 Isum1 += norm(r1[x]);
190                                 Isum2 += norm(r2[x]);
191                             }
192                         }
193                     }
194                     else // if (num_channels == 1)
195                     {
196                         const uchar* r1 = subimg1.ptr<uchar>(y);
197                         const uchar* r2 = subimg2.ptr<uchar>(y);
198                         for (int x = 0; x < roi.width; ++x)
199                         {
200                             if (intersect(y, x))
201                             {
202                                 Isum1 += r1[x];
203                                 Isum2 += r2[x];
204                             }
205                         }
206                     }
207                 }
208                 I(i, j) = Isum1 / N(i, j);
209                 I(j, i) = Isum2 / N(i, j);
210             }
211         }
212     }
213     if (getUpdateGain() || gains_.rows != num_images)
214     {
215         double alpha = 0.01;
216         double beta = 100;
217         int num_eq = num_images - countNonZero(skip);
218         gains_.create(num_images, 1);
219         gains_.setTo(1);
220 
221         // No image process, gains are all set to one, stop here
222         if (num_eq == 0)
223             return;
224 
225         Mat_<double> A(num_eq, num_eq); A.setTo(0);
226         Mat_<double> b(num_eq, 1); b.setTo(0);
227         for (int i = 0, ki = 0; i < num_images; ++i)
228         {
229             if (skip(i, 0))
230                 continue;
231 
232             for (int j = 0, kj = 0; j < num_images; ++j)
233             {
234                 if (skip(j, 0))
235                     continue;
236 
237                 b(ki, 0) += beta * N(i, j);
238                 A(ki, ki) += beta * N(i, j);
239                 if (j != i)
240                 {
241                     A(ki, ki) += 2 * alpha * I(i, j) * I(i, j) * N(i, j);
242                     A(ki, kj) -= 2 * alpha * I(i, j) * I(j, i) * N(i, j);
243                 }
244                 ++kj;
245             }
246             ++ki;
247         }
248 
249         Mat_<double> l_gains;
250 
251 #ifdef HAVE_EIGEN
252         Eigen::MatrixXf eigen_A, eigen_b, eigen_x;
253         cv2eigen(A, eigen_A);
254         cv2eigen(b, eigen_b);
255 
256         Eigen::LLT<Eigen::MatrixXf> solver(eigen_A);
257 #if ENABLE_LOG
258         if (solver.info() != Eigen::ComputationInfo::Success)
259             LOGLN("Failed to solve exposure compensation system");
260 #endif
261         eigen_x = solver.solve(eigen_b);
262 
263         Mat_<float> l_gains_float;
264         eigen2cv(eigen_x, l_gains_float);
265         l_gains_float.convertTo(l_gains, CV_64FC1);
266 #else
267         solve(A, b, l_gains);
268 #endif
269         CV_CheckTypeEQ(l_gains.type(), CV_64FC1, "");
270 
271         for (int i = 0, j = 0; i < num_images; ++i)
272         {
273             // Only assign non-skipped gains. Other gains are already set to 1
274             if (!skip(i, 0))
275                 gains_.at<double>(i, 0) = l_gains(j++, 0);
276         }
277     }
278 }
279 
280 
apply(int index,Point,InputOutputArray image,InputArray)281 void GainCompensator::apply(int index, Point /*corner*/, InputOutputArray image, InputArray /*mask*/)
282 {
283     CV_INSTRUMENT_REGION();
284 
285     multiply(image, gains_(index, 0), image);
286 }
287 
288 
gains() const289 std::vector<double> GainCompensator::gains() const
290 {
291     std::vector<double> gains_vec(gains_.rows);
292     for (int i = 0; i < gains_.rows; ++i)
293         gains_vec[i] = gains_(i, 0);
294     return gains_vec;
295 }
296 
getMatGains(std::vector<Mat> & umv)297 void GainCompensator::getMatGains(std::vector<Mat>& umv)
298 {
299     umv.clear();
300     for (int i = 0; i < gains_.rows; ++i)
301         umv.push_back(Mat(1,1,CV_64FC1,Scalar(gains_(i, 0))));
302 }
setMatGains(std::vector<Mat> & umv)303 void GainCompensator::setMatGains(std::vector<Mat>& umv)
304 {
305     gains_=Mat_<double>(static_cast<int>(umv.size()),1);
306     for (int i = 0; i < static_cast<int>(umv.size()); i++)
307     {
308         int type = umv[i].type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
309         CV_CheckType(type, depth == CV_64F && cn == 1, "Only double images are supported for gain");
310         CV_Assert(umv[i].rows == 1 && umv[i].cols == 1);
311         gains_(i, 0) = umv[i].at<double>(0, 0);
312     }
313 }
314 
prepareSimilarityMask(const std::vector<Point> & corners,const std::vector<UMat> & images)315 void GainCompensator::prepareSimilarityMask(
316     const std::vector<Point> &corners, const std::vector<UMat> &images)
317 {
318     if (similarity_threshold_ >= 1)
319     {
320         LOGLN("  skipping similarity mask: disabled");
321         return;
322     }
323     if (!similarities_.empty())
324     {
325         LOGLN("  skipping similarity mask: already set");
326         return;
327     }
328 
329     LOGLN("  calculating similarity mask");
330     const int num_images = static_cast<int>(images.size());
331     for (int i = 0; i < num_images; ++i)
332     {
333         for (int j = i; j < num_images; ++j)
334         {
335             Rect roi;
336             if (overlapRoi(corners[i], corners[j], images[i].size(), images[j].size(), roi))
337             {
338                 UMat subimg1 = images[i](Rect(roi.tl() - corners[i], roi.br() - corners[i]));
339                 UMat subimg2 = images[j](Rect(roi.tl() - corners[j], roi.br() - corners[j]));
340                 UMat similarity = buildSimilarityMask(subimg1, subimg2);
341                 similarities_.push_back(similarity);
342             }
343         }
344     }
345 }
346 
buildSimilarityMask(InputArray src_array1,InputArray src_array2)347 UMat GainCompensator::buildSimilarityMask(InputArray src_array1, InputArray src_array2)
348 {
349     CV_Assert(src_array1.rows() == src_array2.rows() && src_array1.cols() == src_array2.cols());
350     CV_Assert(src_array1.type() == src_array2.type());
351     CV_Assert(src_array1.type() == CV_8UC3 || src_array1.type() == CV_8UC1);
352 
353     Mat src1 = src_array1.getMat();
354     Mat src2 = src_array2.getMat();
355 
356     UMat umat_similarity(src1.rows, src1.cols, CV_8UC1);
357     Mat similarity = umat_similarity.getMat(ACCESS_WRITE);
358 
359     if (src1.channels() == 3)
360     {
361         for (int y = 0; y < similarity.rows; ++y)
362         {
363             for (int x = 0; x < similarity.cols; ++x)
364             {
365                 Vec<float, 3> vec_diff =
366                     Vec<float, 3>(*src1.ptr<Vec<uchar, 3>>(y, x))
367                     - Vec<float, 3>(*src2.ptr<Vec<uchar, 3>>(y, x));
368                 double diff = norm(vec_diff * (1.f / 255.f));
369 
370                 *similarity.ptr<uchar>(y, x) = diff <= similarity_threshold_ ? 255 : 0;
371             }
372         }
373     }
374     else // if (src1.channels() == 1)
375     {
376         for (int y = 0; y < similarity.rows; ++y)
377         {
378             for (int x = 0; x < similarity.cols; ++x)
379             {
380                 float diff = std::abs(static_cast<int>(*src1.ptr<uchar>(y, x))
381                     - static_cast<int>(*src2.ptr<uchar>(y, x))) / 255.f;
382 
383                 *similarity.ptr<uchar>(y, x) = diff <= similarity_threshold_ ? 255 : 0;
384             }
385         }
386     }
387     similarity.release();
388 
389     Mat kernel = getStructuringElement(MORPH_RECT, Size(3,3));
390     UMat umat_erode;
391     erode(umat_similarity, umat_erode, kernel);
392     dilate(umat_erode, umat_similarity, kernel);
393 
394     return umat_similarity;
395 }
396 
feed(const std::vector<Point> & corners,const std::vector<UMat> & images,const std::vector<std::pair<UMat,uchar>> & masks)397 void ChannelsCompensator::feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
398                                const std::vector<std::pair<UMat,uchar> > &masks)
399 {
400     std::array<std::vector<UMat>, 3> images_channels;
401 
402     // Split channels of each input image
403     for (const UMat& image: images)
404     {
405         std::vector<UMat> image_channels;
406         image_channels.resize(3);
407         split(image, image_channels);
408 
409         for (int i = 0; i < int(images_channels.size()); ++i)
410             images_channels[i].emplace_back(std::move(image_channels[i]));
411     }
412 
413     // For each channel, feed the channel of each image in a GainCompensator
414     gains_.clear();
415     gains_.resize(images.size());
416 
417     GainCompensator compensator(getNrFeeds());
418     compensator.setSimilarityThreshold(getSimilarityThreshold());
419     compensator.prepareSimilarityMask(corners, images);
420 
421     for (int c = 0; c < 3; ++c)
422     {
423         const std::vector<UMat>& channels = images_channels[c];
424 
425         compensator.feed(corners, channels, masks);
426 
427         std::vector<double> gains = compensator.gains();
428         for (int i = 0; i < int(gains.size()); ++i)
429             gains_.at(i)[c] = gains[i];
430     }
431 }
432 
apply(int index,Point,InputOutputArray image,InputArray)433 void ChannelsCompensator::apply(int index, Point /*corner*/, InputOutputArray image, InputArray /*mask*/)
434 {
435     CV_INSTRUMENT_REGION();
436 
437     multiply(image, gains_.at(index), image);
438 }
439 
getMatGains(std::vector<Mat> & umv)440 void ChannelsCompensator::getMatGains(std::vector<Mat>& umv)
441 {
442     umv.clear();
443     for (int i = 0; i < static_cast<int>(gains_.size()); ++i)
444     {
445         Mat m;
446         Mat(gains_[i]).copyTo(m);
447         umv.push_back(m);
448     }
449 }
450 
setMatGains(std::vector<Mat> & umv)451 void ChannelsCompensator::setMatGains(std::vector<Mat>& umv)
452 {
453     for (int i = 0; i < static_cast<int>(umv.size()); i++)
454     {
455         Scalar s;
456         umv[i].copyTo(s);
457         gains_.push_back(s);
458     }
459 }
460 
461 
462 template<class Compensator>
feed(const std::vector<Point> & corners,const std::vector<UMat> & images,const std::vector<std::pair<UMat,uchar>> & masks)463 void BlocksCompensator::feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
464                              const std::vector<std::pair<UMat,uchar> > &masks)
465 {
466     CV_Assert(corners.size() == images.size() && images.size() == masks.size());
467 
468     const int num_images = static_cast<int>(images.size());
469 
470     std::vector<Size> bl_per_imgs(num_images);
471     std::vector<Point> block_corners;
472     std::vector<UMat> block_images;
473     std::vector<std::pair<UMat,uchar> > block_masks;
474 
475     // Construct blocks for gain compensator
476     for (int img_idx = 0; img_idx < num_images; ++img_idx)
477     {
478         Size bl_per_img((images[img_idx].cols + bl_width_ - 1) / bl_width_,
479                         (images[img_idx].rows + bl_height_ - 1) / bl_height_);
480         int bl_width = (images[img_idx].cols + bl_per_img.width - 1) / bl_per_img.width;
481         int bl_height = (images[img_idx].rows + bl_per_img.height - 1) / bl_per_img.height;
482         bl_per_imgs[img_idx] = bl_per_img;
483         for (int by = 0; by < bl_per_img.height; ++by)
484         {
485             for (int bx = 0; bx < bl_per_img.width; ++bx)
486             {
487                 Point bl_tl(bx * bl_width, by * bl_height);
488                 Point bl_br(std::min(bl_tl.x + bl_width, images[img_idx].cols),
489                             std::min(bl_tl.y + bl_height, images[img_idx].rows));
490 
491                 block_corners.push_back(corners[img_idx] + bl_tl);
492                 block_images.push_back(images[img_idx](Rect(bl_tl, bl_br)));
493                 block_masks.push_back(std::make_pair(masks[img_idx].first(Rect(bl_tl, bl_br)),
494                                                 masks[img_idx].second));
495             }
496         }
497     }
498 
499     if (getUpdateGain() || int(gain_maps_.size()) != num_images)
500     {
501         Compensator compensator;
502         compensator.setNrFeeds(getNrFeeds());
503         compensator.setSimilarityThreshold(getSimilarityThreshold());
504         compensator.feed(block_corners, block_images, block_masks);
505 
506         gain_maps_.clear();
507         gain_maps_.resize(num_images);
508 
509         Mat_<float> ker(1, 3);
510         ker(0, 0) = 0.25; ker(0, 1) = 0.5; ker(0, 2) = 0.25;
511 
512         int bl_idx = 0;
513         for (int img_idx = 0; img_idx < num_images; ++img_idx)
514         {
515             Size bl_per_img = bl_per_imgs[img_idx];
516             UMat gain_map = getGainMap(compensator, bl_idx, bl_per_img);
517             bl_idx += bl_per_img.width*bl_per_img.height;
518 
519             for (int i=0; i<nr_gain_filtering_iterations_; ++i)
520             {
521                 UMat tmp;
522                 sepFilter2D(gain_map, tmp, CV_32F, ker, ker);
523                 swap(gain_map, tmp);
524             }
525 
526             gain_maps_[img_idx] = gain_map;
527         }
528     }
529 }
530 
getGainMap(const GainCompensator & compensator,int bl_idx,Size bl_per_img)531 UMat BlocksCompensator::getGainMap(const GainCompensator& compensator, int bl_idx, Size bl_per_img)
532 {
533     std::vector<double> gains = compensator.gains();
534 
535     UMat u_gain_map(bl_per_img, CV_32F);
536     Mat_<float> gain_map = u_gain_map.getMat(ACCESS_WRITE);
537 
538     for (int by = 0; by < bl_per_img.height; ++by)
539         for (int bx = 0; bx < bl_per_img.width; ++bx, ++bl_idx)
540             gain_map(by, bx) = static_cast<float>(gains[bl_idx]);
541 
542     return u_gain_map;
543 }
544 
getGainMap(const ChannelsCompensator & compensator,int bl_idx,Size bl_per_img)545 UMat BlocksCompensator::getGainMap(const ChannelsCompensator& compensator, int bl_idx, Size bl_per_img)
546 {
547     std::vector<Scalar> gains = compensator.gains();
548 
549     UMat u_gain_map(bl_per_img, CV_32FC3);
550     Mat_<Vec3f> gain_map = u_gain_map.getMat(ACCESS_WRITE);
551 
552     for (int by = 0; by < bl_per_img.height; ++by)
553         for (int bx = 0; bx < bl_per_img.width; ++bx, ++bl_idx)
554             for (int c = 0; c < 3; ++c)
555                 gain_map(by, bx)[c] = static_cast<float>(gains[bl_idx][c]);
556 
557     return u_gain_map;
558 }
559 
apply(int index,Point,InputOutputArray _image,InputArray)560 void BlocksCompensator::apply(int index, Point /*corner*/, InputOutputArray _image, InputArray /*mask*/)
561 {
562     CV_INSTRUMENT_REGION();
563 
564     CV_Assert(_image.type() == CV_8UC3);
565 
566     UMat u_gain_map;
567     if (gain_maps_.at(index).size() == _image.size())
568         u_gain_map = gain_maps_.at(index);
569     else
570         resize(gain_maps_.at(index), u_gain_map, _image.size(), 0, 0, INTER_LINEAR);
571 
572     if (u_gain_map.channels() != 3)
573     {
574         std::vector<UMat> gains_channels;
575         gains_channels.push_back(u_gain_map);
576         gains_channels.push_back(u_gain_map);
577         gains_channels.push_back(u_gain_map);
578         merge(gains_channels, u_gain_map);
579     }
580 
581     multiply(_image, u_gain_map, _image, 1, _image.type());
582 }
583 
getMatGains(std::vector<Mat> & umv)584 void BlocksCompensator::getMatGains(std::vector<Mat>& umv)
585 {
586     umv.clear();
587     for (int i = 0; i < static_cast<int>(gain_maps_.size()); ++i)
588     {
589         Mat m;
590         gain_maps_[i].copyTo(m);
591         umv.push_back(m);
592     }
593 }
594 
setMatGains(std::vector<Mat> & umv)595 void BlocksCompensator::setMatGains(std::vector<Mat>& umv)
596 {
597     for (int i = 0; i < static_cast<int>(umv.size()); i++)
598     {
599         UMat m;
600         umv[i].copyTo(m);
601         gain_maps_.push_back(m);
602     }
603 }
604 
feed(const std::vector<Point> & corners,const std::vector<UMat> & images,const std::vector<std::pair<UMat,uchar>> & masks)605 void BlocksGainCompensator::feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
606                                  const std::vector<std::pair<UMat,uchar> > &masks)
607 {
608     BlocksCompensator::feed<GainCompensator>(corners, images, masks);
609 }
610 
feed(const std::vector<Point> & corners,const std::vector<UMat> & images,const std::vector<std::pair<UMat,uchar>> & masks)611 void BlocksChannelsCompensator::feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
612                                      const std::vector<std::pair<UMat,uchar> > &masks)
613 {
614     BlocksCompensator::feed<ChannelsCompensator>(corners, images, masks);
615 }
616 
617 
618 } // namespace detail
619 } // namespace cv
620