// --- close down --- void Close(void){ NuiShutdown( ); if( m_hNextSkeletonEvent && ( m_hNextSkeletonEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextSkeletonEvent ); m_hNextSkeletonEvent = NULL; } if( m_hNextDepthFrameEvent && ( m_hNextDepthFrameEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextDepthFrameEvent ); m_hNextDepthFrameEvent = NULL; } if( m_hNextVideoFrameEvent && ( m_hNextVideoFrameEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextVideoFrameEvent ); m_hNextVideoFrameEvent = NULL; } // free buffers if(video_data != NULL) free(video_data); if(depth_data != NULL) free(depth_data); }
RTC::ReturnCode_t RTCKinect::onDeactivated(RTC::UniqueId ec_id) { NuiShutdown( ); if (m_enable_microphone) { HRESULT hr; if (m_AudioShutdownEvent) { SetEvent(m_AudioShutdownEvent); } hr = m_pAudioClient->Stop(); if (FAILED(hr)) { std::cout << "Unable to stop audio client." << std::endl; } if (m_AudioCaptureThread) { WaitForSingleObject(m_AudioCaptureThread, INFINITE); CloseHandle(m_AudioCaptureThread); m_AudioCaptureThread = NULL; } SafeRelease(&m_pAudioEndpoint); SafeRelease(&m_pAudioClient); SafeRelease(&m_pAudioCaptureClient); CoTaskMemFree(m_pAudioMixFormat); delete [] m_pAudioCaptureBuffer; } return RTC::RTC_OK; }
void KinectGrabber::Kinect_UnInit( ) { // Shut down Nui and clean up data stream objects NuiShutdown( ); if( m_hNextVideoFrameEvent && ( m_hNextVideoFrameEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextVideoFrameEvent ); m_hNextVideoFrameEvent = NULL; } if( m_hNextDepthFrameEvent && ( m_hNextDepthFrameEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextDepthFrameEvent ); m_hNextDepthFrameEvent = NULL; } if( m_hNextSkeletonFrameEvent && ( m_hNextSkeletonFrameEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextSkeletonFrameEvent ); m_hNextSkeletonFrameEvent = NULL; } if( m_hNextDepthPlayerFrameEvent && ( m_hNextDepthPlayerFrameEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextDepthPlayerFrameEvent ); m_hNextDepthPlayerFrameEvent = NULL; } // Shutdown of audio stuff SAFE_RELEASE(pDMO); SAFE_RELEASE(pPS); AvRevertMmThreadCharacteristics(mmHandle); CoUninitialize(); }
void KinectSensor::Release() { // Stop the Nui processing thread if(m_hEvNuiProcessStop!=NULL) { // Signal the thread SetEvent(m_hEvNuiProcessStop); // Wait for thread to stop if(m_hThNuiProcess!=NULL) { WaitForSingleObject(m_hThNuiProcess,INFINITE); CloseHandle(m_hThNuiProcess); m_hThNuiProcess = NULL; } CloseHandle(m_hEvNuiProcessStop); m_hEvNuiProcessStop = NULL; } if (m_bNuiInitialized) { NuiShutdown(); } m_bNuiInitialized = false; if (m_hNextSkeletonEvent && m_hNextSkeletonEvent != INVALID_HANDLE_VALUE) { CloseHandle(m_hNextSkeletonEvent); m_hNextSkeletonEvent = NULL; } if (m_hNextDepthFrameEvent && m_hNextDepthFrameEvent != INVALID_HANDLE_VALUE) { CloseHandle(m_hNextDepthFrameEvent); m_hNextDepthFrameEvent = NULL; } if (m_hNextVideoFrameEvent && m_hNextVideoFrameEvent != INVALID_HANDLE_VALUE) { CloseHandle(m_hNextVideoFrameEvent); m_hNextVideoFrameEvent = NULL; } if (m_VideoBuffer) { m_VideoBuffer->Release(); m_VideoBuffer = NULL; } if (m_DepthBuffer) { m_DepthBuffer->Release(); m_DepthBuffer = NULL; } }
void CSkeletalViewerApp::Nui_UnInit( ) { ::SelectObject( m_SkeletonDC, m_SkeletonOldObj ); DeleteDC( m_SkeletonDC ); DeleteObject( m_SkeletonBMP ); if( m_Pen[0] != NULL ) { DeleteObject(m_Pen[0]); DeleteObject(m_Pen[1]); DeleteObject(m_Pen[2]); DeleteObject(m_Pen[3]); DeleteObject(m_Pen[4]); DeleteObject(m_Pen[5]); ZeroMemory(m_Pen,sizeof(m_Pen)); } // Stop the Nui processing thread if(m_hEvNuiProcessStop!=NULL) { // Signal the thread SetEvent(m_hEvNuiProcessStop); // Wait for thread to stop if(m_hThNuiProcess!=NULL) { WaitForSingleObject(m_hThNuiProcess,INFINITE); CloseHandle(m_hThNuiProcess); } CloseHandle(m_hEvNuiProcessStop); } NuiShutdown( ); if( m_hNextSkeletonEvent && ( m_hNextSkeletonEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextSkeletonEvent ); m_hNextSkeletonEvent = NULL; } if( m_hNextDepthFrameEvent && ( m_hNextDepthFrameEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextDepthFrameEvent ); m_hNextDepthFrameEvent = NULL; } if( m_hNextVideoFrameEvent && ( m_hNextVideoFrameEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextVideoFrameEvent ); m_hNextVideoFrameEvent = NULL; } m_DrawDepth.DestroyDevice( ); m_DrawVideo.DestroyDevice( ); }
int Read_Kinect::control_finish() { int rtn = 0; //destroyWindow("depth image"); //cvDestroyWindow("color image"); //cvDestroyWindow("skeleton image"); //destroyWindow("Activity Recognition"); NuiShutdown(); return rtn; }
void KinectCam::Nui_UnInit() { // Reset camera angle char iniFile[MAX_PATH]; SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, iniFile); strcat(iniFile, "\\KinectCam"); strcat(iniFile, "\\config.ini"); char val[256]; GetPrivateProfileString("KinectCam", "CameraShutdownAngle", "999", val, 256, iniFile); int angle = atoi(val); if (angle != 999) NuiCameraElevationSetAngle(angle); NuiShutdown( ); if( m_hNextVideoFrameEvent && ( m_hNextVideoFrameEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextVideoFrameEvent ); m_hNextVideoFrameEvent = NULL; } }
//------------------------------------------------------------------- // Nui_UnInit // // Uninitialize Kinect //------------------------------------------------------------------- void SkeletalTracker::Nui_UnInit( ) { // Stop the Nui processing thread if ( NULL != m_hEvNuiProcessStop ) { // Signal the thread SetEvent(m_hEvNuiProcessStop); // Wait for thread to stop if ( NULL != m_hThNuiProcess ) { WaitForSingleObject( m_hThNuiProcess, INFINITE ); CloseHandle( m_hThNuiProcess ); } CloseHandle( m_hEvNuiProcessStop ); } // if ( m_pNuiSensor ) { // m_pNuiSensor->NuiShutdown( ); NuiShutdown( ); } if ( m_hNextSkeletonEvent && ( m_hNextSkeletonEvent != INVALID_HANDLE_VALUE ) ) { CloseHandle( m_hNextSkeletonEvent ); m_hNextSkeletonEvent = NULL; } // if ( m_pNuiSensor ) { // m_pNuiSensor->Release(); // m_pNuiSensor = NULL; } }
void Kinect::uninit() { NuiShutdown(); _initialized=false; }