forked from edrosten/libcvd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolourspace_convert.cxx
65 lines (52 loc) · 2.18 KB
/
colourspace_convert.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//FIXME!!
#include <cvd/image_convert_fwd.h>
#include <cvd/colourspaces.h>
#include <cvd/colourspace.h>
#include <cvd/colourspace_convert.h>
#include <cvd/byte.h>
#include <cvd/rgb.h>
namespace CVD
{
/*
template<> void convert_image(const BasicImage<yuv411>& from, BasicImage<Rgb<byte> >& to)
{
ColourSpace::yuv411_to_rgb(reinterpret_cast<const unsigned char*>(from.data()),
from.totalsize(),
reinterpret_cast<unsigned char*>(to.data()));
}
template<> void convert_image(const BasicImage<yuv411>& from, BasicImage<byte>& to)
{
ColourSpace::yuv411_to_y(reinterpret_cast<const unsigned char*>(from.data()),
from.totalsize(),
reinterpret_cast<unsigned char*>(to.data()));
}
template<> void convert_image(const BasicImage<yuv422>& from, BasicImage<Rgb<byte> >& to)
{
ColourSpace::yuv422_to_rgb(reinterpret_cast<const byte*>(from.data()), reinterpret_cast<byte*>(to.data()), from.size().x, from.size().y);
}
template<> void convert_image(const BasicImage<yuv422>& from, BasicImage<byte>& to)
{
ColourSpace::yuv422_to_grey(reinterpret_cast<const byte*>(from.data()), to.data(), from.size().x, from.size().y);
}
// Name changed from 'convert_image' to prevent conflict with previous convert_image
// with same method signature.
template<> std::pair<Image<byte>,Image<Rgb<byte> > > convert_image_pair(const BasicImage<yuv411>& from)
{
Image<byte> rety(from.size());
Image<Rgb<byte> > retc(from.size());
ColourSpace::yuv411_to_rgb_y(reinterpret_cast<const unsigned char*>(from.data()),
from.totalsize(),
reinterpret_cast<unsigned char*>(retc.data()),
reinterpret_cast<unsigned char*>(rety.data()));
return std::pair<Image<byte>,Image<Rgb<byte> > >(rety, retc);
}
template<> void convert_image(const BasicImage<vuy422>& from, BasicImage<Rgb<byte> >& to)
{
ColourSpace::vuy422_to_rgb(reinterpret_cast<const byte*>(from.data()), reinterpret_cast<byte*>(to.data()), from.size().x, from.size().y);
}
template<> void convert_image(const BasicImage<vuy422>& from, BasicImage<byte>& to)
{
ColourSpace::vuy422_to_grey(reinterpret_cast<const byte*>(from.data()), to.data(), from.size().x, from.size().y);
}
*/
}