| 1 |
#ifndef CVD_INCLUDE_COLOURSPACE_CONVERT_H |
| 2 |
#define CVD_INCLUDE_COLOURSPACE_CONVERT_H |
| 3 |
#include <cvd/byte.h> |
| 4 |
#include <cvd/colourspaces.h> |
| 5 |
#include <cvd/convert_image.h> |
| 6 |
#include <cvd/rgb.h> |
| 7 |
|
| 8 |
namespace CVD |
| 9 |
{ |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
template <> |
| 16 |
void convert_image(const BasicImage<bayer_bggr>& from, BasicImage<byte>& to); |
| 17 |
template <> |
| 18 |
void convert_image(const BasicImage<bayer_grbg>& from, BasicImage<byte>& to); |
| 19 |
template <> |
| 20 |
void convert_image(const BasicImage<bayer_gbrg>& from, BasicImage<byte>& to); |
| 21 |
template <> |
| 22 |
void convert_image(const BasicImage<bayer_rggb>& from, BasicImage<byte>& to); |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
template <> |
| 29 |
void convert_image(const BasicImage<bayer_bggr>& from, BasicImage<Rgb<byte>>& to); |
| 30 |
template <> |
| 31 |
void convert_image(const BasicImage<bayer_grbg>& from, BasicImage<Rgb<byte>>& to); |
| 32 |
template <> |
| 33 |
void convert_image(const BasicImage<bayer_gbrg>& from, BasicImage<Rgb<byte>>& to); |
| 34 |
template <> |
| 35 |
void convert_image(const BasicImage<bayer_rggb>& from, BasicImage<Rgb<byte>>& to); |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
template <> |
| 42 |
void convert_image(const BasicImage<bayer_bggr16>& from, BasicImage<unsigned short>& to); |
| 43 |
template <> |
| 44 |
void convert_image(const BasicImage<bayer_grbg16>& from, BasicImage<unsigned short>& to); |
| 45 |
template <> |
| 46 |
void convert_image(const BasicImage<bayer_gbrg16>& from, BasicImage<unsigned short>& to); |
| 47 |
template <> |
| 48 |
void convert_image(const BasicImage<bayer_rggb16>& from, BasicImage<unsigned short>& to); |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
template <> |
| 55 |
void convert_image(const BasicImage<bayer_bggr16>& from, BasicImage<Rgb<unsigned short>>& to); |
| 56 |
template <> |
| 57 |
void convert_image(const BasicImage<bayer_grbg16>& from, BasicImage<Rgb<unsigned short>>& to); |
| 58 |
template <> |
| 59 |
void convert_image(const BasicImage<bayer_gbrg16>& from, BasicImage<Rgb<unsigned short>>& to); |
| 60 |
template <> |
| 61 |
void convert_image(const BasicImage<bayer_rggb16>& from, BasicImage<Rgb<unsigned short>>& to); |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
template <> |
| 68 |
void convert_image(const BasicImage<bayer_bggr16be>& from, BasicImage<unsigned short>& to); |
| 69 |
template <> |
| 70 |
void convert_image(const BasicImage<bayer_grbg16be>& from, BasicImage<unsigned short>& to); |
| 71 |
template <> |
| 72 |
void convert_image(const BasicImage<bayer_gbrg16be>& from, BasicImage<unsigned short>& to); |
| 73 |
template <> |
| 74 |
void convert_image(const BasicImage<bayer_rggb16be>& from, BasicImage<unsigned short>& to); |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
template <> |
| 81 |
void convert_image(const BasicImage<bayer_bggr16be>& from, BasicImage<Rgb<unsigned short>>& to); |
| 82 |
template <> |
| 83 |
void convert_image(const BasicImage<bayer_grbg16be>& from, BasicImage<Rgb<unsigned short>>& to); |
| 84 |
template <> |
| 85 |
void convert_image(const BasicImage<bayer_gbrg16be>& from, BasicImage<Rgb<unsigned short>>& to); |
| 86 |
template <> |
| 87 |
void convert_image(const BasicImage<bayer_rggb16be>& from, BasicImage<Rgb<unsigned short>>& to); |
| 88 |
|
| 89 |
template <> |
| 90 |
void convert_image(const BasicImage<MJPEG>& from, BasicImage<Rgb<byte>>& to); |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
template <> |
| 109 |
void convert_image(const BasicImage<yuv422>& from, BasicImage<Rgb<byte>>& to); |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
template <> |
| 116 |
void convert_image(const BasicImage<yuv422>& from, BasicImage<byte>& to); |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
template <> |
| 131 |
void convert_image(const BasicImage<vuy422>& from, BasicImage<Rgb<byte>>& to); |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
template <> |
| 138 |
void convert_image(const BasicImage<vuy422>& from, BasicImage<byte>& to); |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
template <> |
| 145 |
void convert_image(const BasicImage<yuv420p>& from, BasicImage<Rgb<byte>>& to); |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
template <> |
| 152 |
void convert_image(const BasicImage<yuv420p>& from, BasicImage<byte>& to); |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
template <> |
| 157 |
struct IsConvertible<yuv420p, Rgb<byte>> |
| 158 |
{ |
| 159 |
static const bool is = 1; |
| 160 |
}; |
| 161 |
template <> |
| 162 |
struct IsConvertible<yuv420p, byte> |
| 163 |
{ |
| 164 |
static const bool is = 1; |
| 165 |
}; |
| 166 |
template <> |
| 167 |
struct IsConvertible<yuv422, Rgb<byte>> |
| 168 |
{ |
| 169 |
static const bool is = 1; |
| 170 |
}; |
| 171 |
template <> |
| 172 |
struct IsConvertible<yuv422, byte> |
| 173 |
{ |
| 174 |
static const bool is = 1; |
| 175 |
}; |
| 176 |
template <> |
| 177 |
struct IsConvertible<bayer_bggr, byte> |
| 178 |
{ |
| 179 |
static const bool is = 1; |
| 180 |
}; |
| 181 |
template <> |
| 182 |
struct IsConvertible<bayer_grbg, byte> |
| 183 |
{ |
| 184 |
static const bool is = 1; |
| 185 |
}; |
| 186 |
template <> |
| 187 |
struct IsConvertible<bayer_gbrg, byte> |
| 188 |
{ |
| 189 |
static const bool is = 1; |
| 190 |
}; |
| 191 |
template <> |
| 192 |
struct IsConvertible<bayer_rggb, byte> |
| 193 |
{ |
| 194 |
static const bool is = 1; |
| 195 |
}; |
| 196 |
template <> |
| 197 |
struct IsConvertible<bayer_bggr, Rgb<byte>> |
| 198 |
{ |
| 199 |
static const bool is = 1; |
| 200 |
}; |
| 201 |
template <> |
| 202 |
struct IsConvertible<bayer_grbg, Rgb<byte>> |
| 203 |
{ |
| 204 |
static const bool is = 1; |
| 205 |
}; |
| 206 |
template <> |
| 207 |
struct IsConvertible<bayer_gbrg, Rgb<byte>> |
| 208 |
{ |
| 209 |
static const bool is = 1; |
| 210 |
}; |
| 211 |
template <> |
| 212 |
struct IsConvertible<bayer_rggb, Rgb<byte>> |
| 213 |
{ |
| 214 |
static const bool is = 1; |
| 215 |
}; |
| 216 |
template <> |
| 217 |
struct IsConvertible<bayer_bggr16, unsigned short> |
| 218 |
{ |
| 219 |
static const bool is = 1; |
| 220 |
}; |
| 221 |
template <> |
| 222 |
struct IsConvertible<bayer_grbg16, unsigned short> |
| 223 |
{ |
| 224 |
static const bool is = 1; |
| 225 |
}; |
| 226 |
template <> |
| 227 |
struct IsConvertible<bayer_gbrg16, unsigned short> |
| 228 |
{ |
| 229 |
static const bool is = 1; |
| 230 |
}; |
| 231 |
template <> |
| 232 |
struct IsConvertible<bayer_rggb16, unsigned short> |
| 233 |
{ |
| 234 |
static const bool is = 1; |
| 235 |
}; |
| 236 |
template <> |
| 237 |
struct IsConvertible<bayer_bggr16, Rgb<unsigned short>> |
| 238 |
{ |
| 239 |
static const bool is = 1; |
| 240 |
}; |
| 241 |
template <> |
| 242 |
struct IsConvertible<bayer_grbg16, Rgb<unsigned short>> |
| 243 |
{ |
| 244 |
static const bool is = 1; |
| 245 |
}; |
| 246 |
template <> |
| 247 |
struct IsConvertible<bayer_gbrg16, Rgb<unsigned short>> |
| 248 |
{ |
| 249 |
static const bool is = 1; |
| 250 |
}; |
| 251 |
template <> |
| 252 |
struct IsConvertible<bayer_rggb16, Rgb<unsigned short>> |
| 253 |
{ |
| 254 |
static const bool is = 1; |
| 255 |
}; |
| 256 |
template <> |
| 257 |
struct IsConvertible<bayer_bggr16be, unsigned short> |
| 258 |
{ |
| 259 |
static const bool is = 1; |
| 260 |
}; |
| 261 |
template <> |
| 262 |
struct IsConvertible<bayer_grbg16be, unsigned short> |
| 263 |
{ |
| 264 |
static const bool is = 1; |
| 265 |
}; |
| 266 |
template <> |
| 267 |
struct IsConvertible<bayer_gbrg16be, unsigned short> |
| 268 |
{ |
| 269 |
static const bool is = 1; |
| 270 |
}; |
| 271 |
template <> |
| 272 |
struct IsConvertible<bayer_rggb16be, unsigned short> |
| 273 |
{ |
| 274 |
static const bool is = 1; |
| 275 |
}; |
| 276 |
template <> |
| 277 |
struct IsConvertible<bayer_bggr16be, Rgb<unsigned short>> |
| 278 |
{ |
| 279 |
static const bool is = 1; |
| 280 |
}; |
| 281 |
template <> |
| 282 |
struct IsConvertible<bayer_grbg16be, Rgb<unsigned short>> |
| 283 |
{ |
| 284 |
static const bool is = 1; |
| 285 |
}; |
| 286 |
template <> |
| 287 |
struct IsConvertible<bayer_gbrg16be, Rgb<unsigned short>> |
| 288 |
{ |
| 289 |
static const bool is = 1; |
| 290 |
}; |
| 291 |
template <> |
| 292 |
struct IsConvertible<bayer_rggb16be, Rgb<unsigned short>> |
| 293 |
{ |
| 294 |
static const bool is = 1; |
| 295 |
}; |
| 296 |
template <> |
| 297 |
struct IsConvertible<MJPEG, Rgb<byte>> |
| 298 |
{ |
| 299 |
static const bool is = 1; |
| 300 |
}; |
| 301 |
} |
| 302 |
|
| 303 |
#endif |