Exemplo n.º 1
0
void HiKinectApp::update()
{
	if( mKinect.checkNewDepthFrame() ) {
		mDepthTexture = mKinect.getDepthImage();
		mDepthSurface = Surface32f( mKinect.getDepthImage() );
		mKinectReady = true;
		if ( !mKinectIR ) {
			mKinectIR = true;
			mKinect.setVideoInfrared( true );
		}
		
		ci::Surface captureSurface = Surface8u( mKinect.getDepthImage() );
		ci::Surface outputSurface = captureSurface;
		mContours->clear();
		mSilhouetteDetector->processSurface(&captureSurface, mContours, &outputSurface);
	}
	
	if( mKinect.checkNewColorFrame() )
		mColorTexture = mKinect.getVideoImage();
	
	if( mIsMouseDown ) // using small number instead of 0.0 because lights go black after a few seconds when going to 0.0f
		mDirectional -= ( mDirectional - 0.00001f ) * 0.1f;  
	else 
		mDirectional -= ( mDirectional - 1.0f ) * 0.1f;
	
	if (mKinectReady)
		mGridMesh.updateKinect(mKinect);
	else
		mGridMesh.update();
}
Exemplo n.º 2
0
void ContoursApp::update()
{
	if ( mKinectReady && !mKinectIR )
		mKinect.setVideoInfrared( true );
	
	if( mKinect.checkNewDepthFrame() ) {
		mDepthTexture = mKinect.getDepthImage();
		mDepthSurface = Surface8u( mKinect.getDepthImage() );
		mKinectReady = true;
		
		ci::Surface captureSurface = Surface8u( mKinect.getDepthImage() );
		ci::Surface outputSurface = captureSurface;
		
		contours->clear();
		
		silhouetteDetector->processSurface(&captureSurface, contours, &outputSurface);
		
		console() << contours->size() << " is the size " << endl;
		
		
		mTexture1 = outputSurface;
	}
	
	if( mKinect.checkNewColorFrame() ) {
		mTexture2 = gl::Texture( mKinect.getVideoImage() );
	}
}