def fromConfig(cls, config): if 'camera' not in config: return None camera = PinholeCamera.fromConfig(config['camera']) if camera: monocular = MonocularWrapper() if 'calibrator' in config: calibrator = Calibrator.fromConfig(camera, monocular, config['calibrator']) else: calibrator = Calibrator(camera, monocular) if calibrator: for key in cls.CONFIG_KEYS: if key not in config: return None roi = config['roi'] velocitaCrociera = config['velocitaCrociera'] #Parametri opzionali distanzaMinima = config[ 'distanzaMinima'] if 'distanzaMinima' in config else None distanzaLimite = config[ 'distanzaLimite'] if 'distanzaLimite' in config else None windowSize = config[ 'windowSize'] if 'windowSize' in config else None skipThreshold = config[ 'skipThreshold'] if 'skipThreshold' in config else None return cls(camera, monocular, calibrator, roi, velocitaCrociera, distanzaMinima, distanzaLimite, windowSize, skipThreshold)