Ejemplo n.º 1
0
	void Kinect::pixelToDepthSurface( uint16_t *buffer )
	{
		int32_t height		= mDepthSurface.getHeight();
		int32_t width		= mDepthSurface.getWidth();
		int32_t size		= width * height * 6; // 6 is 3 color channels * sizeof( uint16_t )

		Pixel16u* rgbRun	= mRgbDepth;
		uint16_t* bufferRun	= buffer;

		if ( mFlipped ) {
			for ( int32_t y = 0; y < height; y++ ) {
				for ( int32_t x = 0; x < width; x++ ) {
					bufferRun		= buffer + ( y * width + ( ( width - x ) - 1 ) );
					rgbRun			= mRgbDepth + ( y * width + x );
					*rgbRun			= shortToPixel( *bufferRun );
				}
			}
		} else {
			for ( int32_t i = 0; i < width * height; i++ ) {
				Pixel16u pixel = shortToPixel( *bufferRun );
				bufferRun++;
				*rgbRun = pixel;
				rgbRun++;
			}
		}

		memcpy( mDepthSurface.getData(), mRgbDepth, size );
	}
Ejemplo n.º 2
0
	void Kinect::pixelToDepthSurface( Surface16u &surface, uint16_t *buffer )
	{
		if ( mNewDepthFrame ) {
			return;
		}

		int32_t height = surface.getHeight();
		int32_t width = surface.getWidth();
		int32_t size = width * height * 3 * 2;

		Pixel16u* rgbRun = mRgbDepth;
		uint16_t* bufferRun = buffer;
		for ( int32_t i = 0; i < width * height; i++ ) {
			Pixel16u pixel = shortToPixel( *bufferRun );
			bufferRun++;
			*rgbRun = pixel;
			rgbRun++;
		}

		memcpy( surface.getData(), mRgbDepth, size );
		mNewDepthFrame = true;
	}