Debian Codegraph @

cvd/colourspace_convert.h

raw symbols SCIP
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 /// Convert Bayer pattern of various forms to greyscale data
12 /// @param from The input data
13 /// @param to The output data
14 /// @ingroup gImageIO
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 /// Convert Bayer pattern of various forms to rgb data
25 /// @param from The input data
26 /// @param to The output data
27 /// @ingroup gImageIO
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 /// Convert 16bit Bayer pattern of various forms to greyscale data
38 /// @param from The input data
39 /// @param to The output data
40 /// @ingroup gImageIO
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 /// Convert 16bit Bayer pattern of various forms to rgb data
51 /// @param from The input data
52 /// @param to The output data
53 /// @ingroup gImageIO
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 /// Convert 16bit big endian Bayer pattern of various forms to greyscale data
64 /// @param from The input data
65 /// @param to The output data
66 /// @ingroup gImageIO
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 /// Convert 16bit big endian Bayer pattern of various forms to rgb data
77 /// @param from The input data
78 /// @param to The output data
79 /// @ingroup gImageIO
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 /// Convert YUV 411 pixel data to RGB
93 /// @param from The input data
94 /// @param to The output data
95 /// @ingroup gImageIO
96 //template<> void convert_image(const BasicImage<yuv411>& from, BasicImage<Rgb<byte> >& to);
97
98 /// Convert YUV 411 pixel data to Y only
99 /// @param from The input data
100 /// @param to The output data
101 /// @ingroup gImageIO
102 // template<> void convert_image(const BasicImage<yuv411>& from, BasicImage<byte>& to);
103
104 /// Convert YUV 422 pixel data to RGB
105 /// @param from The input data
106 /// @param to The output data
107 /// @ingroup gImageIO
108 template <>
109 void convert_image(const BasicImage<yuv422>& from, BasicImage<Rgb<byte>>& to);
110
111 /// Convert YUV 422 pixel data to Y only
112 /// @param from The input data
113 /// @param to The output data
114 /// @ingroup gImageIO
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
121 /// Convert YUV 411 pixel data to both Y and RGB
122 /// @param from The input data
123 /// @ingroup gImageIO
124 //template<> std::pair<Image<byte>,Image<Rgb<byte> > > convert_image_pair(const BasicImage<yuv411>& from);
125
126 /// Convert VUY 422 pixel data to RGB
127 /// @param from The input data
128 /// @param to The output data
129 /// @ingroup gImageIO
130 template <>
131 void convert_image(const BasicImage<vuy422>& from, BasicImage<Rgb<byte>>& to);
132
133 /// Convert VUY 422 pixel data to Y only
134 /// @param from The input data
135 /// @param to The output data
136 /// @ingroup gImageIO
137 template <>
138 void convert_image(const BasicImage<vuy422>& from, BasicImage<byte>& to);
139
140 /// Convert YUV420p pixel data to RGB
141 /// @param from The input data
142 /// @param to The output data
143 /// @ingroup gImageIO
144 template <>
145 void convert_image(const BasicImage<yuv420p>& from, BasicImage<Rgb<byte>>& to);
146
147 /// Convert YUV420p pixel data to Y only
148 /// @param from The input data
149 /// @param to The output data
150 /// @ingroup gImageIO
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 <>
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