libcvd
colourspace_convert.h
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 
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 
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 
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 
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 
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 
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 
96 //template<> void convert_image(const BasicImage<yuv411>& from, BasicImage<Rgb<byte> >& to);
97 
102 // template<> void convert_image(const BasicImage<yuv411>& from, BasicImage<byte>& to);
103 
108 template <>
109 void convert_image(const BasicImage<yuv422>& from, BasicImage<Rgb<byte>>& to);
110 
115 template <>
116 void convert_image(const BasicImage<yuv422>& from, BasicImage<byte>& to);
117 
118 // Name changed from 'convert_image' to prevent conflict with previous convert_image
119 // with same method signature.
120 
124 //template<> std::pair<Image<byte>,Image<Rgb<byte> > > convert_image_pair(const BasicImage<yuv411>& from);
125 
130 template <>
131 void convert_image(const BasicImage<vuy422>& from, BasicImage<Rgb<byte>>& to);
132 
137 template <>
138 void convert_image(const BasicImage<vuy422>& from, BasicImage<byte>& to);
139 
144 template <>
145 void convert_image(const BasicImage<yuv420p>& from, BasicImage<Rgb<byte>>& to);
146 
151 template <>
152 void convert_image(const BasicImage<yuv420p>& from, BasicImage<byte>& to);
153 
154 // template<> struct IsConvertible<yuv411, Rgb<byte> > { static const bool is=1; };
155 // template<> struct IsConvertible<yuv411, byte> { static const bool is=1; };
156 template <>
158 {
159  static const bool is = 1;
160 };
161 template <>
163 {
164  static const bool is = 1;
165 };
166 template <>
168 {
169  static const bool is = 1;
170 };
171 template <>
173 {
174  static const bool is = 1;
175 };
176 template <>
178 {
179  static const bool is = 1;
180 };
181 template <>
183 {
184  static const bool is = 1;
185 };
186 template <>
188 {
189  static const bool is = 1;
190 };
191 template <>
193 {
194  static const bool is = 1;
195 };
196 template <>
198 {
199  static const bool is = 1;
200 };
201 template <>
203 {
204  static const bool is = 1;
205 };
206 template <>
208 {
209  static const bool is = 1;
210 };
211 template <>
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 <>
298 {
299  static const bool is = 1;
300 };
301 }
302 
303 #endif
Can two types be converted with CVD::convert_image?
Definition: convert_image.h:170
A datatype to represent yuv420p (yy...u...v) data.
Definition: colourspaces.h:202
A colour consisting of red, green and blue components.
Definition: rgb.h:25
All classes and functions are within the CVD namespace.
Definition: argb.h:6
16bit Bayer datatype representing the colour filter pattern GRBG
Definition: colourspaces.h:92
16bit big endian Bayer datatype representing the colour filter pattern RGGB
Definition: colourspaces.h:157
A datatype to represent MJPEG data.
Definition: colourspaces.h:185
16bit Bayer datatype representing the colour filter pattern GBRG
Definition: colourspaces.h:79
16bit Bayer datatype representing the colour filter pattern RGGB
Definition: colourspaces.h:105
16 bit Bayer datatype representing the colour filter pattern BGGR
Definition: colourspaces.h:66
Bayer datatype representing the colour filter pattern GRBG.
Definition: colourspaces.h:40
Bayer datatype representing the colour filter pattern GBRG.
Definition: colourspaces.h:27
unsigned char byte
An 8-bit datatype.
Definition: byte.h:8
16 bit big endian Bayer datatype representing the colour filter pattern BGGR
Definition: colourspaces.h:118
void convert_image(const BasicImage< bayer_bggr > &from, BasicImage< byte > &to)
Convert Bayer pattern of various forms to greyscale data.
16bit big endian Bayer datatype representing the colour filter pattern GRBG
Definition: colourspaces.h:144
Bayer datatype representing the colour filter pattern BGGR.
Definition: colourspaces.h:14
A datatype to represent yuv422 (yuyv) data.
Definition: colourspaces.h:192
Bayer datatype representing the colour filter pattern RGGB.
Definition: colourspaces.h:53
16bit big endian Bayer datatype representing the colour filter pattern GBRG
Definition: colourspaces.h:131