6 :
Image (image_meta_data)
21 unsigned src_step =
image_md_->XRes () / width;
24 if (gray_line_step == 0)
25 gray_line_step = width;
27 unsigned dst_skip = gray_line_step - width;
29 unsigned char* dst_line = gray_buffer;
30 const XnRGB24Pixel* src_line =
image_md_->RGB24Data();
32 for (
unsigned yIdx = 0; yIdx < height; ++yIdx, src_line += src_skip, dst_line += dst_skip)
34 for (
unsigned xIdx = 0; xIdx < width; ++xIdx, src_line += src_step, dst_line ++)
36 *dst_line = (
unsigned char)(((
int)src_line->nRed * 299 + (
int)src_line->nGreen * 587 + (
int)src_line->nBlue * 114) * 0.001);
53 unsigned line_size = width * 3;
54 if (rgb_line_step == 0 || rgb_line_step == line_size)
60 unsigned char* rgb_line = rgb_buffer;
61 const unsigned char* src_line = (
const unsigned char*)
image_md_->WritableData();
62 for (
unsigned yIdx = 0; yIdx < height; ++yIdx, rgb_line += rgb_line_step, src_line += line_size)
64 memcpy (rgb_line, src_line, line_size);
70 unsigned src_step =
image_md_->XRes () / width;
73 if (rgb_line_step == 0)
74 rgb_line_step = width * 3;
76 unsigned dst_skip = rgb_line_step - width * 3;
78 XnRGB24Pixel* dst_line = (XnRGB24Pixel*)rgb_buffer;
79 const XnRGB24Pixel* src_line =
image_md_->RGB24Data();
81 for (
unsigned yIdx = 0; yIdx < height; ++yIdx, src_line += src_skip)
83 for (
unsigned xIdx = 0; xIdx < width; ++xIdx, src_line += src_step, dst_line ++)
85 *dst_line = *src_line;
91 unsigned char* temp = (
unsigned char*) dst_line;
92 dst_line = (XnRGB24Pixel*) (temp + dst_skip);
#define THROW_OPENNI_EXCEPTION(format,...)
virtual void fillRGB(unsigned width, unsigned height, unsigned char *rgb_buffer, unsigned rgb_line_step=0) const
Image class containing just a reference to image meta data. Thus this class just provides an interfac...
virtual void fillGrayscale(unsigned width, unsigned height, unsigned char *gray_buffer, unsigned gray_line_step=0) const
ImageRGB24(boost::shared_ptr< xn::ImageMetaData > image_meta_data)
boost::shared_ptr< xn::ImageMetaData > image_md_
virtual bool isResizingSupported(unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const
static bool resizingSupported(unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height)