/// <summary> /// Handle a completed frame from the Kinect Fusion processor. /// </summary> /// <returns>S_OK on success, otherwise failure code</returns> void CKinectFusionExplorer::HandleCompletedFrame() { KinectFusionProcessorFrame const* pFrame = nullptr; // Flush any extra WM_FRAMEREADY messages from the queue MSG msg; while (PeekMessage(&msg, m_hWnd, WM_FRAMEREADY, WM_FRAMEREADY, PM_REMOVE)) {} m_processor.LockFrame(&pFrame); if (!m_bSavingMesh) // don't render while a mesh is being saved { if (m_processor.IsVolumeInitialized()) { m_pDrawDepth->Draw(pFrame->m_pDepthRGBX, pFrame->m_cbImageSize); m_pDrawReconstruction->Draw(pFrame->m_pReconstructionRGBX, pFrame->m_cbImageSize); m_pDrawTrackingDataAssociation->Draw(pFrame->m_pTrackingDataRGBX, pFrame->m_cbImageSize); } SetStatusMessage(pFrame->m_statusMessage); SetFramesPerSecond(pFrame->m_fFramesPerSecond); } if (pFrame->m_bIntegrationResumed) { m_params.m_bPauseIntegration = false; CheckDlgButton(m_hWnd, IDC_CHECK_PAUSE_INTEGRATION, BST_UNCHECKED); m_processor.SetParams(m_params); } m_processor.UnlockFrame(); }
/// <summary> /// Handle a completed frame from the Kinect Fusion processor. /// </summary> /// <returns>S_OK on success, otherwise failure code</returns> void CKinectFusionExplorer::HandleCompletedFrame() { KinectFusionProcessorFrame const* pFrame = nullptr; // Flush any extra WM_FRAMEREADY messages from the queue MSG msg; while (PeekMessage(&msg, m_hWnd, WM_FRAMEREADY, WM_FRAMEREADY, PM_REMOVE)) {} m_processor.LockFrame(&pFrame); if (!m_bSavingMesh) // don't render while a mesh is being saved { if (m_processor.IsVolumeInitialized()) { m_pDrawDepth->Draw(pFrame->m_pDepthRGBX, pFrame->m_cbImageSize); m_pDrawReconstruction->Draw(pFrame->m_pReconstructionRGBX, pFrame->m_cbImageSize); m_pDrawTrackingResiduals->Draw(pFrame->m_pTrackingDataRGBX, pFrame->m_cbImageSize); } SetStatusMessage(pFrame->m_statusMessage); SetFramesPerSecond(pFrame->m_fFramesPerSecond); } if (pFrame->m_bIntegrationResumed) { m_params.m_bPauseIntegration = false; CheckDlgButton(m_hWnd, IDC_CHECK_PAUSE_INTEGRATION, BST_UNCHECKED); m_processor.SetParams(m_params); } else if (m_processor.IsCameraPoseFinderAvailable() && !m_params.m_bPauseIntegration) { m_params.m_bPauseIntegration = true; CheckDlgButton(m_hWnd, IDC_CHECK_PAUSE_INTEGRATION, BST_CHECKED); m_processor.SetParams(m_params); } if (!m_bUIUpdated && m_processor.IsVolumeInitialized()) { const int Mebi = 1024 * 1024; // We now create both a color and depth volume, doubling the required memory, so we restrict // which resolution settings the user can choose when the graphics card is limited in memory. if (pFrame->m_deviceMemory <= 1 * Mebi) // 1GB { // Disable 640 voxel resolution in all axes - cards with only 1GB cannot handle this HWND hButton = GetDlgItem(m_hWnd, IDC_VOXELS_X_640); EnableWindow(hButton, FALSE); hButton = GetDlgItem(m_hWnd, IDC_VOXELS_Y_640); EnableWindow(hButton, FALSE); hButton = GetDlgItem(m_hWnd, IDC_VOXELS_Z_640); EnableWindow(hButton, FALSE); if (Is64BitApp() == FALSE) { // Also disable 512 voxel resolution in one arbitrary axis on 32bit machines hButton = GetDlgItem(m_hWnd, IDC_VOXELS_Y_512); EnableWindow(hButton, FALSE); } } else if (pFrame->m_deviceMemory <= 2 * Mebi) // 2GB { if (Is64BitApp() == FALSE) { // Disable 640 voxel resolution in one arbitrary axis on 32bit machines HWND hButton = GetDlgItem(m_hWnd, IDC_VOXELS_Y_640); EnableWindow(hButton, FALSE); } // True 64 bit apps seem to be more able to cope with large volume sizes. } m_bUIUpdated = true; } m_bColorCaptured = pFrame->m_bColorCaptured; m_processor.UnlockFrame(); }