std::shared_ptr<CameraDriverInterface> GetDevice(const Uri& uri) { const Uri input_uri = Uri(uri.url); // Create input camera std::shared_ptr<CameraDriverInterface> input = DeviceRegistry<hal::CameraDriverInterface>::I().Create(input_uri); std::string filename = ExpandTildePath( uri.properties.Get<std::string>("file", "cameras.xml") ); if(!FileExists(filename)) { std::string dir = input->GetDeviceProperty(hal::DeviceDirectory); while(!dir.empty() && !FileExists(dir+"/"+filename)) { dir = DirUp(dir); } filename = (dir.empty() ? "" : dir + "/") + filename; } std::shared_ptr<calibu::Rig<double>> rig = calibu::ReadXmlRig( filename ); UndistortDriver* pDriver = new UndistortDriver( input, rig ); return std::shared_ptr<CameraDriverInterface>( pDriver ); }
std::shared_ptr<CameraDriverInterface> GetDevice(const Uri& uri) { const Uri input_uri = Uri(uri.url); // Create input camera std::shared_ptr<CameraDriverInterface> input = DeviceRegistry<hal::CameraDriverInterface>::I().Create(input_uri); std::string filename = ExpandTildePath( uri.properties.Get<std::string>("file", "cameras.xml") ); if(!FileExists(filename)) { std::string dir = input->GetDeviceProperty(hal::DeviceDirectory); while(!dir.empty() && !FileExists(dir+"/"+filename)) { dir = DirUp(dir); } filename = (dir.empty() ? "" : dir + "/") + filename; } calibu::CameraRig rig = calibu::ReadXmlRig( filename ); if(rig.cameras.size() != 2) { throw DeviceException("Unable to find 2 cameras in file '" + filename + "'"); } RectifyDriver* rectify = new RectifyDriver( input, rig ); return std::shared_ptr<CameraDriverInterface>( rectify ); }
std::shared_ptr<CameraDriverInterface> GetDevice(const Uri& uri) { const std::string file = ExpandTildePath(uri.url); size_t startframe = uri.properties.Get("startframe", 0); int camId = uri.properties.Get("id", -1); bool realtime = uri.properties.Get("realtime", 0); ProtoReaderDriver* driver = new ProtoReaderDriver(file, camId, startframe, realtime); return std::shared_ptr<CameraDriverInterface>( driver ); }
std::shared_ptr<CameraDriverInterface> GetDevice(const Uri& uri) { bool bGrey = uri.properties.Get<bool>("grey", false); unsigned int nCamId = uri.properties.Get<unsigned int>("id", 0); const std::string path = ExpandTildePath(uri.url); if(path.empty()){ std::string sName = uri.properties.Get<std::string>("name", "OpenCVCam"); return std::shared_ptr<CameraDriverInterface>( new OpenCVDriver(nCamId, bGrey)); }else{ std::string sName = uri.properties.Get<std::string>("name", "OpenCVVideoFile"); return std::shared_ptr<CameraDriverInterface>( new OpenCVDriver(path, bGrey)); } }