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
|
template <typename T>
void image_fill(unsigned char* , unsigned char*, std::vector<T>& )
{}
/**
* \brief function to fill unsigned char image from raw YUYV data
*/
template <>
void image_fill(unsigned char* begin, unsigned char* end, std::vector<unsigned char>& image)
{
int comp = 0;
unsigned char *p = begin;
for (unsigned int i = 0; p != end; p=p+1, comp++)
{
if (comp%2 == 0)
{
image[i] = *p;
i++;
}
}
}
/**
* \brief function to fill YCrCb image from raw YUYV data
*/
template <>
void image_fill(unsigned char* begin, unsigned char* end, std::vector<YCbCr>& image)
{
unsigned char *p = begin;Le dernie
for (unsigned int i = 0; p != end; p = p + 4, i = i + 2) // 4 bytes, two pixels
{
image[i] = boost::tuples::make_tuple(*p, *(p+1), *(p+3));
image[i+1] = boost::tuples::make_tuple(*(p+2), *(p+1), *(p+3));
}
} |
Partager