imageFormatTraits.h

Go to the documentation of this file.
00001 
00015 #ifndef _DLRCOMPUTERVISION_IMAGEFORMATTRAITS_H_
00016 #define _DLRCOMPUTERVISION_IMAGEFORMATTRAITS_H_
00017 
00018 #include <stdlib.h>
00019 #include <dlrCommon/types.h>
00020 #include <dlrComputerVision/imageFormat.h>
00021 #include <dlrComputerVision/pixelBGRA.h>
00022 #include <dlrComputerVision/pixelHSV.h>
00023 #include <dlrComputerVision/pixelRGB.h>
00024 #include <dlrComputerVision/pixelRGBA.h>
00025 #include <dlrComputerVision/pixelYIQ.h>
00026 
00027 namespace dlr {
00028 
00029   namespace computerVision {
00030   
00036     template <ImageFormat>
00037     class ImageFormatTraits {
00038     public:
00039       typedef UnsignedInt8 PixelType;
00040       typedef UnsignedInt8 ComponentType;
00041       static size_t getNumberOfComponents() {return 1;}
00042     };
00043 
00044 
00045     template<>
00046     class ImageFormatTraits<GRAY1> {
00047     public:
00048       typedef bool PixelType;
00049       typedef bool ComponentType;
00050       static size_t getNumberOfComponents() {return 1;}
00051     };
00052     
00053 
00054     template<>
00055     class ImageFormatTraits<GRAY8> {
00056     public:
00057       typedef UnsignedInt8 PixelType;
00058       typedef UnsignedInt8 ComponentType;
00059       static size_t getNumberOfComponents() {return 1;}
00060     };
00061     
00062 
00063     template<>
00064     class ImageFormatTraits<GRAY16> {
00065     public:
00066       typedef UnsignedInt16 PixelType;
00067       typedef UnsignedInt16 ComponentType;
00068       static size_t getNumberOfComponents() {return 1;}
00069     };
00070     
00071 
00072     template<>
00073     class ImageFormatTraits<GRAY32> {
00074     public:
00075       typedef UnsignedInt32 PixelType;
00076       typedef UnsignedInt32 ComponentType;
00077       static size_t getNumberOfComponents() {return 1;}
00078     };
00079     
00080 
00081     template<>
00082     class ImageFormatTraits<GRAY64> {
00083     public:
00084       typedef UnsignedInt64 PixelType;
00085       typedef UnsignedInt64 ComponentType;
00086       static size_t getNumberOfComponents() {return 1;}
00087     };
00088     
00089 
00090     template<>
00091     class ImageFormatTraits<GRAY_SIGNED16> {
00092     public:
00093       typedef Int16 PixelType;
00094       typedef Int16 ComponentType;
00095       static size_t getNumberOfComponents() {return 1;}
00096     };
00097     
00098 
00099     template<>
00100     class ImageFormatTraits<GRAY_SIGNED32> {
00101     public:
00102       typedef Int32 PixelType;
00103       typedef Int32 ComponentType;
00104       static size_t getNumberOfComponents() {return 1;}
00105     };
00106     
00107 
00108     template<>
00109     class ImageFormatTraits<GRAY_FLOAT32> {
00110     public:
00111       typedef Float32 PixelType;
00112       typedef Float32 ComponentType;
00113       static size_t getNumberOfComponents() {return 1;}
00114     };
00115     
00116 
00117     template<>
00118     class ImageFormatTraits<GRAY_FLOAT64> {
00119     public:
00120       typedef Float64 PixelType;
00121       typedef Float64 ComponentType;
00122       static size_t getNumberOfComponents() {return 1;}
00123     };
00124     
00125 
00126     template<>
00127     class ImageFormatTraits<RGB8> {
00128     public:
00129       typedef PixelRGB8 PixelType;
00130       typedef UnsignedInt8 ComponentType;
00131       static size_t getNumberOfComponents() {return 3;}
00132     };
00133     
00134 
00135     template<>
00136     class ImageFormatTraits<RGB16> {
00137     public:
00138       typedef PixelRGB16 PixelType;
00139       typedef UnsignedInt16 ComponentType;
00140       static size_t getNumberOfComponents() {return 3;}
00141     };
00142 
00143 
00144     template<>
00145     class ImageFormatTraits<RGB_SIGNED16> {
00146     public:
00147       typedef PixelRGBSigned16 PixelType;
00148       typedef Int16 ComponentType;
00149       static size_t getNumberOfComponents() {return 3;}
00150     };
00151 
00152   
00153     template<>
00154     class ImageFormatTraits<RGB_SIGNED32> {
00155     public:
00156       typedef PixelRGBSigned32 PixelType;
00157       typedef Int32 ComponentType;
00158       static size_t getNumberOfComponents() {return 3;}
00159     };
00160 
00161   
00162     template<>
00163     class ImageFormatTraits<RGB_FLOAT32> {
00164     public:
00165       typedef PixelRGBFloat32 PixelType;
00166       typedef Float32 ComponentType;
00167       static size_t getNumberOfComponents() {return 3;}
00168     };
00169 
00170 
00171     template<>
00172     class ImageFormatTraits<RGB_FLOAT64> {
00173     public:
00174       typedef PixelRGBFloat64 PixelType;
00175       typedef Float64 ComponentType;
00176       static size_t getNumberOfComponents() {return 3;}
00177     };
00178 
00179 
00180     template<>
00181     class ImageFormatTraits<HSV_FLOAT64> {
00182     public:
00183       typedef PixelHSVFloat64 PixelType;
00184       typedef Float64 ComponentType;
00185       static size_t getNumberOfComponents() {return 3;}
00186     };
00187   
00188   
00189     template<>
00190     class ImageFormatTraits<YIQ_FLOAT64> {
00191     public:
00192       typedef PixelYIQFloat64 PixelType;
00193       typedef Float64 ComponentType;
00194       static size_t getNumberOfComponents() {return 3;}
00195     };
00196   
00197   
00198     template<>
00199     class ImageFormatTraits<RGBA8> {
00200     public:
00201       typedef PixelRGBA8 PixelType;
00202       typedef UnsignedInt8 ComponentType;
00203       static size_t getNumberOfComponents() {return 4;}
00204     };
00205     
00206 
00207     template<>
00208     class ImageFormatTraits<BGRA8> {
00209     public:
00210       typedef PixelBGRA8 PixelType;
00211       typedef UnsignedInt8 ComponentType;
00212       static size_t getNumberOfComponents() {return 4;}
00213     };
00214     
00215   } // namespace computerVision
00216 
00217 } // namespace dlr
00218 
00219 #endif /* ifndef _DLRCOMPUTERVISION_IMAGEFORMATTRAITS_H_ */

Generated on Wed Nov 25 12:15:05 2009 for dlrComputerVision Utility Library by  doxygen 1.5.8