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