Hugin trunk 0.1
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
26#ifndef VIGRA_EXT_UTILS_H
27#define VIGRA_EXT_UTILS_H
28
30#include <vigra/rgbvalue.hxx>
31#include <vigra/transformimage.hxx>
32#include <vigra/codec.hxx>
33#include <cmath>
34
35namespace vigra {
36
37template <class T1, unsigned int R, unsigned int G, unsigned int B, class T2>
42
43}
44
45namespace vigra_ext {
46
49#define LUT_TRAITS(T1, Smin, Smax) \
50template<> \
51struct LUTTraits<T1> \
52{ \
53 static T1 max() \
54{ \
55 return Smax; \
56} \
57 static T1 min() \
58{ \
59 return Smin; \
60} \
61}; \
62template<> \
63struct LUTTraits<vigra::RGBValue<T1> > \
64{ \
65 static T1 max() \
66{ \
67 return Smax; \
68} \
69 static T1 min() \
70{ \
71 return Smin; \
72} \
73};
74
75 template <class T1>
76 struct LUTTraits;
77
78 LUT_TRAITS(unsigned char, 0, UCHAR_MAX);
80 LUT_TRAITS(unsigned short, 0, USHRT_MAX);
81 LUT_TRAITS(signed short, SHRT_MIN, SHRT_MAX);
82 LUT_TRAITS(unsigned int, 0, UINT_MAX);
83 LUT_TRAITS(signed int, INT_MIN, INT_MAX);
84 LUT_TRAITS(float, 0.0f, 1.0f);
85 LUT_TRAITS(double, 0.0, 1.0);
86
87#undef LUT_TRAITS
88
89inline double getMaxValForPixelType(const std::string & v)
90{
91 if (v == "UINT8") {
92 return 255;
93 } else if (v == "INT8") {
94 return 127;
95 } else if (v == "UINT16") {
96 return 65535;
97 } else if (v == "INT16") {
98 return 32767;
99 } else if (v == "UINT32") {
100 return 4294967295u;
101 } else if (v == "INT32") {
102 return 2147483647;
103 }
104 return 1.0;
105}
106
107template <class VALUE>
109{
111 {
112 }
113
114 PointPairT(short img1, VALUE val1, const hugin_utils::FDiff2D & p1, float r1,
115 short img2, VALUE val2, const hugin_utils::FDiff2D & p2, float r2)
116 : imgNr1(img1), i1(val1), p1(p1), r1(r1), imgNr2(img2), i2(val2), p2(p2), r2(r2)
117 {
118 }
119
120 short imgNr1;
123 float r1;
124 short imgNr2;
127 float r2;
128};
129
132
133
134
135// get the value_type of vector pixels and also single channel pixels.
136#define VT_TRAITS_VEC(T1) \
137template<> \
138struct ValueTypeTraits<vigra::RGBValue<T1, 0u, 1u, 2u> > \
139{ \
140 typedef vigra::RGBValue<T1, 0u, 1u, 2u>::value_type value_type; \
141};
142
143#define VT_TRAITS(T1) \
144template<> \
145struct ValueTypeTraits<T1> \
146{ \
147 typedef T1 value_type; \
148};
149
150template <class T1>
152{
153 typedef typename T1::value_type value_type;
154};
155
156#if 0
157VT_TRAITS_VEC(vigra::UInt8);
158VT_TRAITS_VEC(vigra::Int16);
159VT_TRAITS_VEC(vigra::UInt16);
160VT_TRAITS_VEC(vigra::Int32);
161VT_TRAITS_VEC(vigra::UInt32);
162VT_TRAITS_VEC(float);
163VT_TRAITS_VEC(double);
164#endif
165
166VT_TRAITS(vigra::UInt8);
167VT_TRAITS(vigra::Int16);
168VT_TRAITS(vigra::UInt16);
169VT_TRAITS(vigra::Int32);
170VT_TRAITS(vigra::UInt32);
172VT_TRAITS(double);
173
174#undef VT_TRAITS
175#undef VT_TRAITS_VEC
176
177
178using VIGRA_CSTD::pow;
179using VIGRA_CSTD::log;
180
181inline float pow(float a, double b)
182{
183 return std::pow(a,(float) b);
184}
185
187template <class T, unsigned int R, unsigned int G, unsigned int B>
188inline
189vigra::RGBValue<T, R, G, B> pow(vigra::RGBValue<T, R, G, B> const & v, double e) {
190 return vigra::RGBValue<T, R, G, B>(pow(v.red(),e), pow(v.green(),e), pow(v.blue(),e));
191}
192
194template <class V1, unsigned int R, unsigned int G, unsigned int B, class V2>
195inline
196vigra::RGBValue<V1, R, G, B> &
197operator+=(vigra::RGBValue<V1, R, G, B> & l, V2 const & r)
198{
199 l.red() += r;
200 l.green() += r;
201 l.blue() += r;
202 return l;
203}
204
206template <class T, unsigned int RIDX, unsigned int GIDX, unsigned int BIDX>
207inline
208vigra::RGBValue<T, RIDX, GIDX, BIDX>
209log(vigra::RGBValue<T, RIDX, GIDX, BIDX> const & v)
210{
211 return vigra::RGBValue<T, RIDX, GIDX, BIDX>(std::log(v.red()), std::log(v.green()), std::log(v.blue()));
212}
213
215template <class T, unsigned int RIDX, unsigned int GIDX, unsigned int BIDX>
216inline
217vigra::RGBValue<T, RIDX, GIDX, BIDX>
218log10(vigra::RGBValue<T, RIDX, GIDX, BIDX> const & v)
219{
220 return vigra::RGBValue<T, RIDX, GIDX, BIDX>(std::log10(v.red()), std::log10(v.green()), std::log10(v.blue()));
221}
222
224template <class V1, unsigned int R, unsigned int G, unsigned int B, class V2>
225inline
226// WARNING: This is a hack..
227//vigra::RGBValue<V1>
228typename vigra::PromoteTraits<vigra::RGBValue<V1, R, G, B>, V2 >::Promote
229operator+(vigra::RGBValue<V1, R, G, B> const & r1, V2 const & r2)
230{
231 typename vigra::PromoteTraits<vigra::RGBValue<V1, R, G, B>, V2 >::Promote res(r1);
232
233 res += r2;
234
235 return res;
236}
237
240template <class V, int SIZE, class D1, class D2>
241inline
242vigra::TinyVector<V, SIZE>
243pow(vigra::TinyVector<V, SIZE> const & v, double e)
244{
245 vigra::TinyVector<V, SIZE> res;
246 for (int i=0; i<SIZE; i++)
247 res[i] = std::pow(v[i], e);
248 return res;
249}
250
253template <class V, int SIZE, class D1, class D2>
254inline
255vigra::TinyVector<V, SIZE>
256log(vigra::TinyVector<V, SIZE> const & v, double e)
257{
258 vigra::TinyVector<V, SIZE> res;
259 for (int i=0; i<SIZE; i++)
260 res[i] = std::log(v[i], e);
261 return res;
262}
263
265template <class V>
266inline
267V
268getMaxComponent(vigra::RGBValue<V> const & v)
269{
270 return std::max(std::max(v.red(), v.green()), v.blue());
271}
272
274template <class V>
275inline
276V
278{
279 return v;
280}
281
283template <class V>
284inline
285V
286getMinComponent(vigra::RGBValue<V> const & v)
287{
288 return std::min(std::min(v.red(), v.green()), v.blue());
289}
290
292template <class V>
293inline
294V
296{
297 return v;
298}
299
300template <class VALUETYPE>
302{
303public:
310
312 FindComponentsMinMax() : min(vigra::NumericTraits<value_type>::max()), max(vigra::NumericTraits<value_type>::min()), count(0)
313 {}
314
316 void reset()
317 {
318 count = 0;
319 }
320
323 {
324 if (count)
325 {
326 if (v < min) min = v;
327 if (max < v) max = v;
328 }
329 else
330 {
331 min = v;
332 max = v;
333 }
334 ++count;
335 }
336
338 void operator()(vigra::RGBValue<VALUETYPE> const & v)
339 {
342 if (count)
343 {
344 if (vMin < min)
345 {
346 min = vMin;
347 };
348 if (vMax > max)
349 {
350 max = vMax;
351 };
352 }
353 else
354 {
355 min = vMin;
356 max = vMax;
357 }
358 ++count;
359 }
360
366 unsigned int count;
367};
368
369template<class ImgIter, class ImgAccessor, class AlphaIter, class AlphaAccessor>
370void applyExposureClipMask(vigra::triple<ImgIter, ImgIter, ImgAccessor> image, vigra::triple<AlphaIter, AlphaIter, AlphaAccessor> mask, double lowerLimit, double upperLimit)
371{
372 typedef typename ImgAccessor::value_type ImageValueType;
373 vigra_precondition((image.second - image.first) == (mask.second - mask.first), "applyExposureMask: image and mask have different sizes");
374 const vigra::Diff2D imgSize = image.second - image.first;
377
378 // create dest y iterator
379 ImgIter yd(image.first);
380 AlphaIter ymd(mask.first);
381 // loop over the image and transform
382 for (int y = 0; y < imgSize.y; ++y, ++yd.y, ++ymd.y)
383 {
384 // create x iterators
385 ImgIter xd(yd);
387 for (int x = 0; x < imgSize.x; ++x, ++xd.x, ++xmd.x)
388 {
389 const double minVal = vigra_ext::getMinComponent(*xd);
390 const double maxVal = vigra_ext::getMaxComponent(*xd);
392 {
393 *xmd = 0;
394 };
395 }
396 }
397}
398
401{
403 : size(0)
404 { }
405
406 template<typename PIXEL>
407 void operator()(PIXEL const & img1, PIXEL const & img2)
408 {
409 if (img1 > 0 && img2 > 0) {
410 size++;
411 }
412 }
413
414 unsigned int getSize()
415 {
416 return size;
417 }
418
419 unsigned int size;
420};
421
422
430template <class F1, class F2>
432{
435 NestFunctor(const F1 & fu1, const F2 & fu2)
436 : f1(fu1), f2(fu2)
437 { }
438
441 typedef typename F1::result_type result_type;
442
443 template <class T1>
444 result_type operator()(T1 const & v) const
445 {
446 return f1(f2(v));
447 }
448
450 template <class T1, class T2>
451 result_type operator()(T1 const & v1, T2 const & v2) const
452 {
453 return f1(f2(v1,v2));
454 }
455
457 template <class T1, class T2, class T3>
458 result_type operator()(T1 const & v1, T2 const & v2, T3 const & v3) const
459 {
460 return f1(f2(v1,v2,v3));
461 }
462};
463
464
467{
469 : count(0)
470 { }
471
472 template<typename PIXEL>
473 void operator()(PIXEL const & img1)
474 {
475 if (img1 > 0) {
476 count++;
477 }
478 }
479
481 {
482 return count;
483 }
484
485 int count;
486};
487
494template <class SrcImageIterator, class SrcAccessor>
495void circularCrop(vigra::triple<SrcImageIterator, SrcImageIterator, SrcAccessor> img,
496 hugin_utils::FDiff2D middle, double radius)
497{
498 vigra::Diff2D imgSize = img.second - img.first;
499 double r2 = radius*radius;
500
501 // create dest y iterator
502 SrcImageIterator yd(img.first);
503 // loop over the image and transform
504 for(int y=0; y < imgSize.y; ++y, ++yd.y)
505 {
506 // create x iterators
508 for(int x=0; x < imgSize.x; ++x, ++xd.x)
509 {
510 double dx = x-middle.x;
511 double dy = y-middle.y;
512 if (dx*dx+dy*dy > r2) {
513 *xd = 0;
514 }
515 }
516 }
517}
518
520template <class T>
522{
523 typedef T result_type;
524
525 T operator()(const T & a) const
526 {
527 return a;
528 }
529
530 template <class T2>
531 T2 operator()(const T2 & a, const hugin_utils::FDiff2D & p) const
532 {
533 return a;
534 }
535
536 template <class T2, class A>
537 A
538 hdrWeight(T2 v, A a) const
539 {
540 return a;
541 }
542
543};
544
545
549template <class T>
550typename vigra::NumericTraits<T>::RealPromote
551normalizeValue(T v, vigra::VigraTrueType)
552{
553 return vigra::NumericTraits<T>::toRealPromote(v) / vigra::NumericTraits<T>::max();
554}
555
556template <class T>
557typename vigra::NumericTraits<T>::RealPromote
558normalizeValue(T v, vigra::VigraFalseType)
559{
560 return v;
561}
562
563
564
565template <class DestValueType>
567{
568 public:
569 /* the functors argument type (actually, since
570 <tt>operator()</tt> is a template, much more types are possible)
571 */
573
574 /* the functors result type
575 */
577
578 /* init scale and offset
579 */
580 LinearTransform(float scale, float offset)
581 : scale_(scale), offset_(offset)
582 {}
583 template <class SrcValueType>
585 {
586 return vigra::NumericTraits<result_type>::fromRealPromote(scale_ * (vigra::NumericTraits<SrcValueType>::toRealPromote(s) + offset_));
587 }
588 private:
589
590 float scale_;
591 float offset_;
592};
593
594
596{
597 float minv;
598 float maxv;
599 float scale;
600
601 ApplyLogFunctor(float min_, float max_)
602 {
603 // protect against zeros in image data
604 if (min_ <= 0.0f) {
605 min_ = 1e-5f;
606 }
607 minv = std::log10(min_);
608 maxv = std::log10(max_);
609 scale = (maxv - minv)/255;
610 }
611
612 template <class T>
613 unsigned char operator()(T v) const
614 {
615 typedef vigra::NumericTraits<vigra::UInt8> DestTraits;
616 return DestTraits::fromRealPromote((std::log10(float(v))-minv)/scale);
617 }
618
619 template <class T, unsigned int R, unsigned int G, unsigned int B>
620 vigra::RGBValue<vigra::UInt8,0,1,2> operator()(const vigra::RGBValue<T,R,G,B> & v) const
621 {
622 typedef vigra::NumericTraits< vigra::RGBValue<vigra::UInt8,0,1,2> > DestTraits;
623 typedef vigra::NumericTraits< vigra::RGBValue<T,R,G,B> > SrcTraits;
624 return DestTraits::fromRealPromote((log10(SrcTraits::toRealPromote(v)) + (-minv))/scale);
625 }
626};
627
628
629template <class TIn, class TOut=vigra::UInt8>
631{
632 float minv;
633 float maxv;
634 float gamma;
635 float scale;
636
638 {
639 minv = min_;
640 maxv = max_;
641 gamma = gamma_;
642 scale = float(maxv) - minv;
643 }
644
646 {
647 typedef vigra::NumericTraits<TOut> DestTraits;
648 return DestTraits::fromRealPromote(pow((float(v)-minv)/scale, gamma)*255);
649 }
650
651 vigra::RGBValue<TOut> operator()(const vigra::RGBValue<TIn> & v) const
652 {
653 typedef vigra::NumericTraits< vigra::RGBValue<TOut> > DestTraits;
654 typedef vigra::NumericTraits< vigra::RGBValue<TIn> > SrcTraits;
655 return DestTraits::fromRealPromote(vigra_ext::pow((SrcTraits::toRealPromote(v)+(-minv))/scale, gamma)*255);
656 }
657};
658
659// gamma correction with lookup table
660template <>
661struct ApplyGammaFunctor<vigra::UInt16, vigra::UInt8>
662{
663 vigra::UInt8 lut[65536];
664
665 ApplyGammaFunctor(vigra::UInt16 min, vigra::UInt16 max, float gamma)
666 {
667 float scale = float(max) - min;
668 for (int i=0; i<65536; i++) {
669 lut[i] = hugin_utils::roundi(pow((float(i)-min)/scale, gamma)*255);
670 }
671 }
672
673 vigra::UInt8 operator()(vigra::UInt16 v) const
674 {
675 return lut[v];
676 }
677
678 vigra::RGBValue<vigra::UInt8> operator()(const vigra::RGBValue<vigra::UInt16> & v) const
679 {
680 return vigra::RGBValue<vigra::UInt8>(lut[v[0]], lut[v[1]], lut[v[2]]);
681 }
682};
683
684template <class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor, class T>
685 void applyMapping(vigra::triple<SrcIterator, SrcIterator, SrcAccessor> img,
686 vigra::pair<DestIterator, DestAccessor> dest, T min, T max, int mapping )
687{
688
689 switch (mapping)
690 {
691 case 0:
692 {
693 // linear
694 float offset_ = -float(min);
695 float scale_ = 255/float(max)-float(min);
696 vigra::transformImage(img, dest,
698 );
699 break;
700 }
701 case 1:
702 {
703 // log
704 ApplyLogFunctor logfunc(min, max);
705 transformImage(img, dest,
706 logfunc);
707 break;
708 }
709 case 2:
710 {
711 // gamma
712 ApplyGammaFunctor<T> logfunc(min, max, 1/2.2f);
713 transformImage(img, dest,
714 logfunc);
715 break;
716 }
717 default:
718 vigra_fail("Unknown image mapping mode");
719 }
720}
721
722template <class SrcImageIterator, class SrcAccessor,
723class DestImageIterator, class DestAccessor, class Functor>
724void
728 Functor const & f, vigra::Diff2D ul)
729{
730 vigra::Diff2D destSize = src_lowerright - src_upperleft;
731
732 int offsetX=ul.x;
734 {
735 typename SrcImageIterator::row_iterator s(src_upperleft.rowIterator());
736 typename SrcImageIterator::row_iterator send(s+ destSize.x);
737 typename DestImageIterator::row_iterator d(dest_upperleft.rowIterator());
738 ul.x=offsetX;
739 for(; s != send; ++s, ++d, ++ul.x) {
740 da.set(f(sa(s), ul), d);
741 }
742 }
743}
744
745template <class SrcImageIterator, class SrcAccessor,
746class DestImageIterator, class DestAccessor, class Functor>
747void
748transformImageSpatial(vigra::triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
749 vigra::pair<DestImageIterator, DestAccessor> dest,
750 Functor const & f, vigra::Diff2D ul)
751{
752 transformImageSpatial(src.first, src.second, src.third, dest.first, dest.second, f, ul);
753}
754
756template <class ImageType>
758{
759 typedef vigra::NumericTraits<typename ImageType::PixelType> DestTraits;
760 double maxVal = vigra::NumericTraits<typename DestTraits::ValueType>::max();
761 double minVal = vigra::NumericTraits<typename DestTraits::ValueType>::min();
762 const std::string pixelType = vigra::TypeAsString<typename DestTraits::ValueType>::result();
763 int mapping = 0;
764 if (pixelType == "FLOAT" || pixelType == "DOUBLE")
765 {
766 vigra::FindMinMax<typename ImageType::PixelType> minmax;
767 vigra::inspectImage(srcImageRange(image), minmax);
770 mapping = 1;
771 }
772 if (minVal != 0 || maxVal != 255)
773 {
775 };
776};
777
778} // namespace
779
780#endif // VIGRA_EXT_UTILS_H
FindComponentsMinMax()
init min and max
Definition utils.h:312
void reset()
(re-)init functor (clear min, max)
Definition utils.h:316
void operator()(argument_type const &v)
update min and max
Definition utils.h:322
VALUETYPE argument_type
the functor's argument type
Definition utils.h:305
unsigned int count
the number of values processed so far
Definition utils.h:366
VALUETYPE max
the current max
Definition utils.h:364
VALUETYPE result_type
the functor's result type
Definition utils.h:307
void operator()(vigra::RGBValue< VALUETYPE > const &v)
update min and max with components of RGBValue<VALUETYPE>
Definition utils.h:338
VALUETYPE min
the current min
Definition utils.h:362
vigra::FRGBImage ImageType
misc math function & classes used by other parts of the program
int roundi(T x)
Definition hugin_math.h:73
void transformImage(vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, vigra::triple< DestImageIterator, DestImageIterator, DestAccessor > dest, std::pair< AlphaImageIterator, AlphaAccessor > alpha, vigra::Diff2D destUL, TRANSFORM &transform, PixelTransform &pixelTransform, bool warparound, Interpolator interpol, AppBase::ProgressDisplay *progress, bool singleThreaded=false)
Transform an image into the panorama.
V getMaxComponent(vigra::RGBValue< V > const &v)
get the maximum component of a vector (also works for single pixel types...)
Definition utils.h:268
vigra::RGBValue< V1, R, G, B > & operator+=(vigra::RGBValue< V1, R, G, B > &l, V2 const &r)
add a scalar to all components
Definition utils.h:197
vigra::NumericTraits< T >::RealPromote normalizeValue(T v, vigra::VigraTrueType)
normalize a pixel to 0..1 Only has an effect on integer pixel types
Definition utils.h:551
PointPairT< float > PointPair
Definition utils.h:130
void ConvertTo8Bit(ImageType &image)
converts to given image to fit into 0..255
Definition utils.h:757
vigra::pair< typename ROIImage< Image, Alpha >::image_traverser, typename ROIImage< Image, Alpha >::ImageAccessor > destImage(ROIImage< Image, Alpha > &img)
Definition ROIImage.h:324
void transformImageSpatial(SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor sa, DestImageIterator dest_upperleft, DestAccessor da, Functor const &f, vigra::Diff2D ul)
Definition utils.h:725
V getMinComponent(vigra::RGBValue< V > const &v)
get the maximum component of a vector (also works for single pixel types...)
Definition utils.h:286
static const double A(-0.75)
float pow(float a, double b)
Definition utils.h:181
vigra::triple< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImageRange(const ROIImage< Image, Mask > &img)
helper function for ROIImages
Definition ROIImage.h:287
vigra::RGBValue< T, RIDX, GIDX, BIDX > log(vigra::RGBValue< T, RIDX, GIDX, BIDX > const &v)
component-wise logarithm
Definition utils.h:209
double getMaxValForPixelType(const std::string &v)
Definition utils.h:89
void applyExposureClipMask(vigra::triple< ImgIter, ImgIter, ImgAccessor > image, vigra::triple< AlphaIter, AlphaIter, AlphaAccessor > mask, double lowerLimit, double upperLimit)
Definition utils.h:370
void applyMapping(vigra::triple< SrcIterator, SrcIterator, SrcAccessor > img, vigra::pair< DestIterator, DestAccessor > dest, T min, T max, int mapping)
Definition utils.h:685
PointPairT< vigra::RGBValue< float > > PointPairRGB
Definition utils.h:131
void circularCrop(vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > img, hugin_utils::FDiff2D middle, double radius)
Apply a circular crop to img.
Definition utils.h:495
vigra::PromoteTraits< vigra::RGBValue< V1, R, G, B >, V2 >::Promote operator+(vigra::RGBValue< V1, R, G, B > const &r1, V2 const &r2)
add a scalar to all components
Definition utils.h:229
vigra::RGBValue< T, RIDX, GIDX, BIDX > log10(vigra::RGBValue< T, RIDX, GIDX, BIDX > const &v)
component-wise logarithm
Definition utils.h:218
Implementation of fast vector type with support of linear algebra operations Copyright (C) 2009 Lukáš...
RGBValue< typename PromoteTraits< T1, T2 >::Promote > Promote
Definition utils.h:40
vigra::RGBValue< vigra::UInt8 > operator()(const vigra::RGBValue< vigra::UInt16 > &v) const
Definition utils.h:678
ApplyGammaFunctor(vigra::UInt16 min, vigra::UInt16 max, float gamma)
Definition utils.h:665
vigra::UInt8 operator()(vigra::UInt16 v) const
Definition utils.h:673
ApplyGammaFunctor(TIn min_, TIn max_, float gamma_)
Definition utils.h:637
TOut operator()(TIn v) const
Definition utils.h:645
vigra::RGBValue< TOut > operator()(const vigra::RGBValue< TIn > &v) const
Definition utils.h:651
unsigned char operator()(T v) const
Definition utils.h:613
vigra::RGBValue< vigra::UInt8, 0, 1, 2 > operator()(const vigra::RGBValue< T, R, G, B > &v) const
Definition utils.h:620
ApplyLogFunctor(float min_, float max_)
Definition utils.h:601
result_type operator()(SrcValueType const &s) const
Definition utils.h:584
LinearTransform(float scale, float offset)
Definition utils.h:580
DestValueType result_type
Definition utils.h:576
DestValueType argument_type
Definition utils.h:572
count pixels that are > 0 in a single image
Definition utils.h:467
void operator()(PIXEL const &img1)
Definition utils.h:473
functor to combine two functors: result = f1( f2(v) )
Definition utils.h:432
result_type operator()(T1 const &v) const
Definition utils.h:444
result_type operator()(T1 const &v1, T2 const &v2, T3 const &v3) const
if F2 takes 3 arguments
Definition utils.h:458
F1::result_type result_type
the functor's second argument type
Definition utils.h:441
result_type operator()(T1 const &v1, T2 const &v2) const
if F2 takes 2 arguments
Definition utils.h:451
NestFunctor(const F1 &fu1, const F2 &fu2)
Definition utils.h:435
count pixels that are > 0 in both images
Definition utils.h:401
void operator()(PIXEL const &img1, PIXEL const &img2)
Definition utils.h:407
unsigned int getSize()
Definition utils.h:414
T2 operator()(const T2 &a, const hugin_utils::FDiff2D &p) const
Definition utils.h:531
A hdrWeight(T2 v, A a) const
Definition utils.h:538
T operator()(const T &a) const
Definition utils.h:525
PointPairT(short img1, VALUE val1, const hugin_utils::FDiff2D &p1, float r1, short img2, VALUE val2, const hugin_utils::FDiff2D &p2, float r2)
Definition utils.h:114
hugin_utils::FDiff2D p2
Definition utils.h:126
hugin_utils::FDiff2D p1
Definition utils.h:122
T1::value_type value_type
Definition utils.h:153
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41
#define VT_TRAITS_VEC(T1)
Definition utils.h:136
#define VT_TRAITS(T1)
Definition utils.h:143
#define LUT_TRAITS(T1, Smin, Smax)
Traits to define the maximum value for all types.
Definition utils.h:49