def load_env_var(self): """Read input parameters from JSON in environment variable.""" self.parameters = ENV.load(self.env_var_name) if not isinstance(self.parameters, dict): self.load_defaults_for_env_var() message = "Warning: Environment variable parameters load failed." else: self._add_missing() message = "" return message
def load_calibration_data_from_env(self): """Load calibration parameters from environment variable.""" self.calibration_params = ENV.load(self.env_var_name) if self.calibration_params is None: raise ValueError("ENV load failed.")
#!/usr/bin/env python """Plant Detection Image Capture. For Plant Detection. """ import sys import os from time import sleep from subprocess import call import cv2 from PD import ENV CAMERA = ENV.load('camera', get_json=False) if CAMERA is None: CAMERA = 'USB' # default camera else: if 'RPI' in CAMERA: CAMERA = 'RPI' # Raspberry Pi Camera else: CAMERA = 'USB' class Capture(object): """Capture image for Plant Detection.""" def __init__(self): """Set initial attributes.""" self.image = None self.ret = None self.camera_port = None self.image_captured = False self.silent = False