OpenNI2CameraImpl::OpenNI2CameraImpl( const std::vector< StreamConfig >& streamConfig, const char* uri ) { // TODO: do more validation: you can't have RGB and IR at the same // time, etc. // Then move it into a function and re-introduce const. for( int i = 0; i < static_cast< int >( streamConfig.size() ); ++i ) { if( streamConfig[ i ].type == StreamType::COLOR ) { m_colorConfig = streamConfig[ i ]; break; } } for( int i = 0; i < static_cast< int >( streamConfig.size() ); ++i ) { if( streamConfig[ i ].type == StreamType::DEPTH ) { m_depthConfig = streamConfig[ i ]; break; } } for( int i = 0; i < static_cast< int >( streamConfig.size() ); ++i ) { if( streamConfig[ i ].type == StreamType::INFRARED ) { m_infraredConfig = streamConfig[ i ]; break; } } const bool enableSync = true; if( !OpenNI2CameraImpl::s_isOpenNIInitialized ) { Status rc = OpenNI::initialize(); if( rc == STATUS_OK ) { OpenNI2CameraImpl::s_isOpenNIInitialized = true; } } if( OpenNI2CameraImpl::s_isOpenNIInitialized ) { Status rc = m_device.open( uri ); if( rc == STATUS_OK ) { rc = m_device.setDepthColorSyncEnabled( enableSync ); if( rc == STATUS_OK ) { m_isValid = initializeStreams(); } } } }
SpecificWorker::SpecificWorker(MapPrx& mprx) : GenericWorker(mprx) { openDevice(); initializeStreams(); ///INICIALIZACION ATRIBUTOS GENERALES registration=RoboCompRGBD::None; //A QUE INICIALIZO REGISTRATION???? ///INICIALIZACION MUTEX usersMutex = new QMutex(); RGBMutex = new QMutex(); depthMutex = new QMutex(); pointsMutex = new QMutex(); ///INICIALIZACION ATRIBUTOS PARA PINTAR mColor = new uint16_t [IMAGE_WIDTH*IMAGE_HEIGHT*3]; auxDepth = new uint8_t [IMAGE_WIDTH*IMAGE_HEIGHT*3]; qImgDepth = new QImage(IMAGE_WIDTH,IMAGE_HEIGHT,QImage::Format_Indexed8); printf("\nStart moving around to get detected...\n(PSI pose may be required for skeleton calibration, depending on the configuration)\n"); setPeriod(15); }