MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / populateFrame

Method populateFrame

src/openni2/ColorStream.cpp:61–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void ColorStream::populateFrame(libfreenect2::Frame* srcFrame, int srcX, int srcY, OniFrame* dstFrame, int dstX, int dstY, int width, int height) const
62{
63 dstFrame->sensorType = getSensorType();
64 dstFrame->stride = dstFrame->width * 3;
65
66 // copy stream buffer from freenect
67 switch (video_mode.pixelFormat)
68 {
69 default:
70 LogError("Pixel format " + to_string(video_mode.pixelFormat) + " not supported by populateFrame()");
71 return;
72
73 case ONI_PIXEL_FORMAT_RGB888:
74 if (reg->isEnabled()) {
75 libfreenect2::Frame registered(512, 424, 4);
76
77 reg->colorFrameRGB888(srcFrame, &registered);
78
79 copyFrame(static_cast<uint8_t*>(registered.data), srcX, srcY, registered.width * registered.bytes_per_pixel,
80 static_cast<uint8_t*>(dstFrame->data), dstX, dstY, dstFrame->stride,
81 width, height, mirroring);
82 } else {
83 copyFrame(static_cast<uint8_t*>(srcFrame->data), srcX, srcY, srcFrame->width * srcFrame->bytes_per_pixel,
84 static_cast<uint8_t*>(dstFrame->data), dstX, dstY, dstFrame->stride,
85 width, height, mirroring);
86 }
87 return;
88 }
89}
90
91void ColorStream::copyFrame(uint8_t* srcPix, int srcX, int srcY, int srcStride, uint8_t* dstPix, int dstX, int dstY, int dstStride, int width, int height, bool mirroring)
92{

Callers

nothing calls this directly

Calls 3

to_stringFunction · 0.85
isEnabledMethod · 0.80
colorFrameRGB888Method · 0.80

Tested by

no test coverage detected