diff --git a/Modules/ToFHardware/CMakeLists.txt b/Modules/ToFHardware/CMakeLists.txt index 3f55224dda..efce2913ba 100644 --- a/Modules/ToFHardware/CMakeLists.txt +++ b/Modules/ToFHardware/CMakeLists.txt @@ -1,39 +1,39 @@ include(mitkToFHardware.cmake) if(MITK_USE_TOF_PMDCAMCUBE) set(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_PMD_SDK_DIR}/include) set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${MITK_PMD_LIB}) endif(MITK_USE_TOF_PMDCAMCUBE) if(MITK_USE_TOF_O3) set(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_PMD_SDK_DIR}/include) set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${MITK_PMD_LIB}) endif(MITK_USE_TOF_O3) if(MITK_USE_TOF_PMDCAMBOARD) set(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_PMD_SDK_DIR}/include) set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${MITK_PMD_LIB}) endif(MITK_USE_TOF_PMDCAMBOARD) if(MITK_USE_TOF_MESASR4000) set(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_MESA_SDK_DIR}/include) set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${MITK_MESA_LIB}) endif(MITK_USE_TOF_MESASR4000) IF(MITK_USE_TOF_KINECT) - SET(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_KINECT_SDK_DIR}/Include) + SET(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_KINECT_INCLUDE_DIR}) SET(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${MITK_KINECT_LIB}) ENDIF(MITK_USE_TOF_KINECT) MITK_CREATE_MODULE(mitkToFHardware SUBPROJECTS MITK-ToF INCLUDE_DIRS ${MITK_BIN_DIR} INTERNAL_INCLUDE_DIRS ${INCLUDE_DIRS_INTERNAL} DEPENDS Mitk MitkExt mitkOpenCVVideoSupport MitkIGT LegacyAdaptors EXPORT_DEFINE MITK_TOFHARDWARE_EXPORT ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ) add_subdirectory(Testing) diff --git a/Modules/ToFHardware/mitkKinectController.cpp b/Modules/ToFHardware/mitkKinectController.cpp index a327271bc6..137725b7b0 100644 --- a/Modules/ToFHardware/mitkKinectController.cpp +++ b/Modules/ToFHardware/mitkKinectController.cpp @@ -1,267 +1,267 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Module: $RCSfile$ Language: C++ Date: $Date: 2010-05-27 16:06:53 +0200 (Do, 27 Mai 2010) $ Version: $Revision: $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkKinectController.h" namespace mitk { KinectController::KinectController(): m_Context(NULL), m_DepthGenerator(NULL), m_ImageGenerator(NULL), m_IRGenerator(NULL), m_ConnectionCheck(false), m_UseIR(false), m_CaptureWidth(640), m_CaptureHeight(480) { } KinectController::~KinectController() { } bool KinectController::OpenCameraConnection() { if (!m_ConnectionCheck) { // Initialize the OpenNI status m_ConnectionCheck = !ErrorText(m_Context.Init()); // Create a depth generator and set its resolution XnMapOutputMode DepthMode; m_ConnectionCheck = !ErrorText(m_DepthGenerator.Create(m_Context)); m_DepthGenerator.GetMapOutputMode(DepthMode); DepthMode.nXRes = xn::Resolution((XnResolution)XN_RES_VGA).GetXResolution(); DepthMode.nYRes = xn::Resolution((XnResolution)XN_RES_VGA).GetYResolution(); m_ConnectionCheck = !ErrorText(m_DepthGenerator.SetMapOutputMode(DepthMode)); { XnUInt32 NumModes = 10; XnMapOutputMode *SupportedModes = new XnMapOutputMode[NumModes]; m_ConnectionCheck = !ErrorText(m_DepthGenerator.GetSupportedMapOutputModes(SupportedModes, NumModes)); for ( unsigned int i = 0; i < NumModes; i++ ) { std::cout << "DepthModes #" << i << std::endl; - std::cout << " Nx=" << SupportedModes[i].nXRes << std::endl; - std::cout << " Ny=" << SupportedModes[i].nYRes << std::endl; - std::cout << " FPS=" << SupportedModes[i].nFPS << std::endl; + std::cout << "Nx=" << SupportedModes[i].nXRes << std::endl; + std::cout << "Ny=" << SupportedModes[i].nYRes << std::endl; + std::cout << "FPS=" << SupportedModes[i].nFPS << std::endl; } delete[] SupportedModes; } if (m_UseIR) { // Create the IR generator and set its resolution m_ConnectionCheck = !ErrorText(m_IRGenerator.Create(m_Context)); XnMapOutputMode IRMode; m_IRGenerator.GetMapOutputMode(IRMode); IRMode.nXRes = XN_VGA_X_RES; IRMode.nYRes = XN_VGA_Y_RES; IRMode.nFPS = 30; m_ConnectionCheck = !ErrorText(m_IRGenerator.SetMapOutputMode(IRMode)); XnUInt32 NumModes = 10; XnMapOutputMode *SupportedModes = new XnMapOutputMode[NumModes]; m_ConnectionCheck = !ErrorText(m_IRGenerator.GetSupportedMapOutputModes(SupportedModes, NumModes)); for ( unsigned int i = 0; i < NumModes; i++ ) { std::cout << "Mode #" << i << std::endl; - std::cout << " Nx=" << SupportedModes[i].nXRes << std::endl; - std::cout << " Ny=" << SupportedModes[i].nYRes << std::endl; - std::cout << " FPS=" << SupportedModes[i].nFPS << std::endl; + std::cout << "Nx=" << SupportedModes[i].nXRes << std::endl; + std::cout << "Ny=" << SupportedModes[i].nYRes << std::endl; + std::cout << "FPS=" << SupportedModes[i].nFPS << std::endl; } delete[] SupportedModes; } else { // Create an image generator and set its resolution XnMapOutputMode ImageMode; m_ConnectionCheck = !ErrorText(m_ImageGenerator.Create(m_Context)); m_ImageGenerator.GetMapOutputMode(ImageMode); ImageMode.nXRes = xn::Resolution((XnResolution)XN_RES_VGA).GetXResolution(); ImageMode.nYRes = xn::Resolution((XnResolution)XN_RES_VGA).GetYResolution(); m_ConnectionCheck = !ErrorText(m_ImageGenerator.SetMapOutputMode(ImageMode)); { XnUInt32 NumModes = 10; XnMapOutputMode *SupportedModes = new XnMapOutputMode[NumModes]; m_ConnectionCheck = !ErrorText(m_ImageGenerator.GetSupportedMapOutputModes(SupportedModes, NumModes)); for ( unsigned int i = 0; i < NumModes; i++ ) { std::cout << "ImageModes #" << i << std::endl; - std::cout << " Nx=" << SupportedModes[i].nXRes << std::endl; - std::cout << " Ny=" << SupportedModes[i].nYRes << std::endl; - std::cout << " FPS=" << SupportedModes[i].nFPS << std::endl; + std::cout << "Nx=" << SupportedModes[i].nXRes << std::endl; + std::cout << "Ny=" << SupportedModes[i].nYRes << std::endl; + std::cout << "FPS=" << SupportedModes[i].nFPS << std::endl; } delete[] SupportedModes; } } // Camera registration if ( m_DepthGenerator.IsCapabilitySupported(XN_CAPABILITY_ALTERNATIVE_VIEW_POINT) ) { if (m_UseIR) { m_ConnectionCheck = !ErrorText(m_DepthGenerator.GetAlternativeViewPointCap().SetViewPoint(m_IRGenerator)); } else { m_ConnectionCheck = !ErrorText(m_DepthGenerator.GetAlternativeViewPointCap().SetViewPoint(m_ImageGenerator)); } } else { std::cout << "Alternative view point not supported by the depth generator..." << std::endl; } if (m_UseIR) { if ( m_IRGenerator.IsCapabilitySupported(XN_CAPABILITY_ALTERNATIVE_VIEW_POINT) ) { m_ConnectionCheck = !ErrorText(m_IRGenerator.GetAlternativeViewPointCap().SetViewPoint(m_DepthGenerator)); } else { std::cout << "Alternative view point not supported by the depth generator..." << std::endl; } } // Mirror data m_ConnectionCheck = ErrorText(m_Context.SetGlobalMirror(!m_Context.GetGlobalMirror())); // Start data generation m_ConnectionCheck = ErrorText(m_Context.StartGeneratingAll()); // // Update the connected flag // m_ConnectionCheck = true; } MITK_INFO<<"Controller connect?"<