const AstraVideoMode astra_convert(const openni::VideoMode& input) { AstraVideoMode output; output.x_resolution_ = input.getResolutionX(); output.y_resolution_ = input.getResolutionY(); output.frame_rate_ = input.getFps(); output.pixel_format_ = static_cast<PixelFormat>(input.getPixelFormat()); return output; }
static void dumpVM( const openni::VideoMode& vm ){ std::cout << "VideoMode: [" << vm.getResolutionX() << ", " << vm.getResolutionY() << "] @ " << vm.getFps(); switch( vm.getPixelFormat() ){ case openni::PIXEL_FORMAT_DEPTH_100_UM: std::cout << " DEPTH_100_UM" << std::endl; return; case openni::PIXEL_FORMAT_DEPTH_1_MM: std::cout << " DEPTH_1_MM" << std::endl; return; case openni::PIXEL_FORMAT_GRAY8: std::cout << " GRAY_U8" << std::endl; return; case openni::PIXEL_FORMAT_GRAY16: std::cout << " GRAY_U16" << std::endl; return; case openni::PIXEL_FORMAT_RGB888: std::cout << " RGB_888" << std::endl; return; case openni::PIXEL_FORMAT_YUYV: std::cout << " YUYV" << std::endl; return; case openni::PIXEL_FORMAT_YUV422: std::cout << " YUV422" << std::endl; return; default: std::cout << " unknown pxformat" << std::endl; } }
bool OpenNI2Interface::isModeSupported(const openni::VideoStream& stream,const openni::VideoMode& mode) { const auto& modes = stream.getSensorInfo().getSupportedVideoModes(); for(int i = 0; i < modes.getSize(); i++) { if(modes[i].getResolutionX() == mode.getResolutionX() && modes[i].getResolutionY() == mode.getResolutionY() && modes[i].getFps() == mode.getFps() && modes[i].getPixelFormat() == mode.getPixelFormat()) { return true; } } return false; }
void OpenNI2Interface::printMode(const openni::VideoMode& mode) { std::map<int,std::string> formatNames; formatNames[openni::PIXEL_FORMAT_DEPTH_1_MM] = "1mm"; formatNames[openni::PIXEL_FORMAT_DEPTH_100_UM] = "100um"; formatNames[openni::PIXEL_FORMAT_SHIFT_9_2] = "Shift 9 2"; formatNames[openni::PIXEL_FORMAT_SHIFT_9_3] = "Shift 9 3"; formatNames[openni::PIXEL_FORMAT_RGB888] = "RGB888"; formatNames[openni::PIXEL_FORMAT_YUV422] = "YUV422"; formatNames[openni::PIXEL_FORMAT_GRAY8] = "GRAY8"; formatNames[openni::PIXEL_FORMAT_GRAY16] = "GRAY16"; formatNames[openni::PIXEL_FORMAT_JPEG] = "JPEG"; cout << "(" << mode.getResolutionX() << "x" << mode.getResolutionY() << ", " << mode.getFps() << " fps, " << formatNames[mode.getPixelFormat()] << ")\n"; }
void KinectInterfacePrimesense::printMode(const openni::VideoMode& mode) { std::cout << "Res: " << mode.getResolutionX() << "x"; std::cout << mode.getResolutionY() << ", fps = " << mode.getFps(); std::cout << ", format = " << formatToString(mode.getPixelFormat()); std::cout << std::endl; }