1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
5 #ifndef __CPPLUGINS__EXTENSIONS__ALGORITHMS__RGBTOYPBPRFUNCTION__H__
6 #define __CPPLUGINS__EXTENSIONS__ALGORITHMS__RGBTOYPBPRFUNCTION__H__
10 #include <vnl/vnl_math.h>
11 #include <vnl/vnl_matrix.h>
13 #include <itkRGBPixel.h>
14 #include <itkMatrix.h>
15 #include <itkVector.h>
26 struct RGBToYPbPrFunction
28 typedef RGBToYPbPrFunction Self;
29 typedef itk::Vector< O, 3 > TOutPixel;
31 template< class Tr, class Tg, class Tb >
32 TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
36 O( 0.2126 ), O( 0.7152 ), O( 0.0722 ),
37 O( -0.2126 ), O( -0.7152 ), O( 0.9278 ),
38 O( 0.7874 ), O( -0.7152 ), O( -0.0722 )
40 static const vnl_matrix< O > vM( M, 3, 3 );
41 static const itk::Matrix< O, 3, 3 > iM( vM );
51 TOutPixel operator()( const itk::RGBPixel< C >& rgb ) const
55 rgb.GetRed( ), rgb.GetGreen( ), rgb.GetBlue( )
67 #endif // __CPPLUGINS__EXTENSIONS__ALGORITHMS__RGBTOYPBPRFUNCTION__H__