52 #ifndef __PCL_HistogramTransformation_h
53 #define __PCL_HistogramTransformation_h
68 class PCL_CLASS Histogram;
104 double sc = 0,
double hc = 1,
105 double lr = 0,
double hr = 1 )
107 PCL_PRECONDITION( mb >= 0 && mb <= 1 )
108 PCL_PRECONDITION( sc >= 0 && sc <= 1 )
109 PCL_PRECONDITION( hc >= 0 && hc <= 1 )
110 PCL_PRECONDITION( lr <= 0 )
111 PCL_PRECONDITION( hr >= 1 )
112 m_midtonesBalance =
pcl::Range( mb, 0.0, 1.0 );
115 if ( m_clipHigh < m_clipLow )
117 m_expandLow =
Min( lr, 0.0 );
118 m_expandHigh =
Max( 1.0, hr );
154 return 1 + m_transformChain.Length();
163 return (index == 0) ? *this : m_transformChain[index-1];
172 return (index == 0) ? *this : m_transformChain[index-1];
201 m_transformChain.Add( H );
208 return m_midtonesBalance;
243 return m_midtonesBalance == 0.5
244 && m_clipLow == 0 && m_clipHigh == 1
245 && m_expandLow == 0 && m_expandHigh == 1;
256 PCL_PRECONDITION( b >= 0 && b <= 1 )
257 m_midtonesBalance =
pcl::Range( b, 0.0, 1.0 );
265 PCL_PRECONDITION( c >= 0 && c <= 1 )
267 if ( m_clipHigh < m_clipLow )
276 PCL_PRECONDITION( c >= 0 && c <= 1 )
278 if ( m_clipHigh < m_clipLow )
287 PCL_PRECONDITION( sc >= 0 && sc <= 1 )
288 PCL_PRECONDITION( hc >= 0 && hc <= 1 )
291 if ( m_clipHigh < m_clipLow )
300 PCL_PRECONDITION( r <= 0 )
301 m_expandLow =
Min( 0.0, r );
309 PCL_PRECONDITION( r >= 1 )
310 m_expandHigh =
Max( 1.0, r );
318 PCL_PRECONDITION( lr <= 0 )
319 PCL_PRECONDITION( hr >= 1 )
320 m_expandLow =
Min( 0.0, lr );
321 m_expandHigh =
Max( 1.0, hr );
331 m_midtonesBalance = 0.5;
336 m_transformChain.Clear();
415 return m1*x/((m + m1)*x - m);
425 static double MTF(
double m,
double x )
427 return MidtonesTransferFunction( m, x );
435 if ( m_flags.hasClipping )
436 value = m_flags.hasDelta ? ((value <= m_clipLow) ? 0.0 : ((value >= m_clipHigh) ? 1.0 : (value - m_clipLow)/m_flags.d)) : m_clipLow;
437 if ( m_flags.hasMTF )
439 if ( m_flags.hasRange )
440 value = (value - m_expandLow)/m_flags.dr;
452 bool hasClipping =
false;
454 bool hasRange =
false;
455 bool hasDelta =
false;
473 hasClipping = H.m_clipLow != 0 || H.m_clipHigh != 1;
474 hasMTF = H.m_midtonesBalance != 0.5;
475 hasRange = H.m_expandLow != 0 || H.m_expandHigh != 1;
479 d = H.m_clipHigh - H.m_clipLow;
480 hasDelta = 1 + d != 1;
483 dr = H.m_expandHigh - H.m_expandLow;
497 double m_midtonesBalance = 0.5;
498 double m_clipLow = 0;
499 double m_clipHigh = 1;
500 double m_expandLow = 0;
501 double m_expandHigh = 1;
503 transformation_list m_transformChain;
510 m_flags =
Flags( *
this );
519 friend class LUT2408Thread;
520 friend class LUT2416Thread;
A type-safe collection of enumerated flags.
Implements a generic, two-dimensional, shared or local image.
Discrete image histogram function.
A process using multiple concurrent execution threads.
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2) noexcept
constexpr const T & Min(const T &a, const T &b) noexcept
constexpr const T & Range(const T &x, const T &a, const T &b) noexcept
constexpr const T & Max(const T &a, const T &b) noexcept
void Apply(FI i, FI j, F f) noexcept(noexcept(f))