<filename>engine/config.py<gh_stars>0
import os


DEBUG = False
DEBUG = os.getenv('ENV_DEBUG', DEBUG)
# ENV: ENV_DEBUG
if DEBUG is not False:
    if DEBUG is True or DEBUG.lower() in ['true', '1', 'yes', 'si', 'sí']:
        DEBUG = True

CROP_HEIGHT = 112
CROP_WIDTH = 92
CROP_HEIGHT = os.getenv('ENV_CROP_HEIGHT', CROP_HEIGHT)
CROP_WIDTH = os.getenv('ENV_CROP_WIDTH', CROP_WIDTH)
# ENV: ENV_CROP_HEIGHT
# ENV: ENV_CROP_WIDTH

try:
    CROP_HEIGHT = int(CROP_HEIGHT)
except Exception as e:
    CROP_HEIGHT = 112

try:
    CROP_WIDTH = int(CROP_WIDTH)
except Exception as e:
    CROP_WIDTH = 112

# We can select the recognizer algorithm. Fisher is LDA (Linear Discrimination
# Analysis).
LBPH_RECOGNIZER = 1
FISHER_RECOGNIZER = 2
EIGEN_RECOGNIZER = 3

RECOGNITION_ALGORITHM = 1
RECOGNITION_ALGORITHM = os.getenv('ENV_RECOGNITION_ALGORITHM', RECOGNITION_ALGORITHM)
DISTANCE_LIMIT = 90
DISTANCE_LIMIT = os.getenv('ENV_DISTANCE_LIMIT', DISTANCE_LIMIT)
POSITIVE_THRESHOLD = DISTANCE_LIMIT
# ENV: ENV_RECOGNITION_ALGORITHM
# ENV: ENV_DISTANCE_LIMIT

try:
    RECOGNITION_ALGORITHM = int(RECOGNITION_ALGORITHM)
except Exception as e:
    RECOGNITION_ALGORITHM = 1

try:
    DISTANCE_LIMIT = int(DISTANCE_LIMIT)
except Exception as e:
    DISTANCE_LIMIT = 90

BASE_CAPTURE_DIRECTORY = './images'
BASE_CAPTURE_DIRECTORY = os.getenv('ENV_BASE_CAPTURE_DIRECTORY', BASE_CAPTURE_DIRECTORY)
# ENV: ENV_BASE_CAPTURE_DIRECTORY

IMAGES_STATUS_FILE = 'status.json'
IMAGES_STATUS_FILE = os.getenv('ENV_IMAGES_STATUS_FILE', IMAGES_STATUS_FILE)
# ENV: ENV_IMAGES_STATUS_FILE

TRAINING_FILE = 'training.xml'
TRAINING_FILE = os.getenv('ENV_TRAINING_FILE', TRAINING_FILE)
# ENV: ENV_TRAINING_FILE

ERROR_OK = 0
ERROR_NO_ERROR = ERROR_OK
ERROR_INVALID_ARGUMENT_COUNT = 1
ERROR_NO_ACTION_SELECTED = 2
ERROR_PARSING_ARGUMENTS = 3
ERROR_USER_IS_REQUIRED_WHEN_CAPTURING = 4
ERROR_INVALID_USER_ID = 5
ERROR_PICAMERA_IMPORT_ERROR_IN_RPI = 6
ERROR_INVALID_RECOGNITION_ALGORITHM = 7
ERROR_READING_STATUS_FILE = 8
ERROR_READING_USER_ID_FILE = 9
ERROR_USER_ID_IS_NOT_INTEGER = 10
ERROR_LIMIT_IS_NOT_INTEGER = 11
ERROR_DEVICE_ID_IS_NOT_INTEGER = 12
ERROR_ALGORITHM_IS_NOT_INTEGER = 13
ERROR_ALGORITHM_VALUE_NOT_VALID = 14

<filename>engine/config.py<gh_stars>0
import os


DEBUG = False
DEBUG = os.getenv('ENV_DEBUG', DEBUG)
# ENV: ENV_DEBUG
if DEBUG is not False:
    if DEBUG is True or DEBUG.lower() in ['true', '1', 'yes', 'si', 'sí']:
        DEBUG = True

CROP_HEIGHT = 112
CROP_WIDTH = 92
CROP_HEIGHT = os.getenv('ENV_CROP_HEIGHT', CROP_HEIGHT)
CROP_WIDTH = os.getenv('ENV_CROP_WIDTH', CROP_WIDTH)
# ENV: ENV_CROP_HEIGHT
# ENV: ENV_CROP_WIDTH

try:
    CROP_HEIGHT = int(CROP_HEIGHT)
except Exception as e:
    CROP_HEIGHT = 112

try:
    CROP_WIDTH = int(CROP_WIDTH)
except Exception as e:
    CROP_WIDTH = 112

# We can select the recognizer algorithm. Fisher is LDA (Linear Discrimination
# Analysis).
LBPH_RECOGNIZER = 1
FISHER_RECOGNIZER = 2
EIGEN_RECOGNIZER = 3

RECOGNITION_ALGORITHM = 1
RECOGNITION_ALGORITHM = os.getenv('ENV_RECOGNITION_ALGORITHM', RECOGNITION_ALGORITHM)
DISTANCE_LIMIT = 90
DISTANCE_LIMIT = os.getenv('ENV_DISTANCE_LIMIT', DISTANCE_LIMIT)
POSITIVE_THRESHOLD = DISTANCE_LIMIT
# ENV: ENV_RECOGNITION_ALGORITHM
# ENV: ENV_DISTANCE_LIMIT

try:
    RECOGNITION_ALGORITHM = int(RECOGNITION_ALGORITHM)
except Exception as e:
    RECOGNITION_ALGORITHM = 1

try:
    DISTANCE_LIMIT = int(DISTANCE_LIMIT)
except Exception as e:
    DISTANCE_LIMIT = 90

BASE_CAPTURE_DIRECTORY = './images'
BASE_CAPTURE_DIRECTORY = os.getenv('ENV_BASE_CAPTURE_DIRECTORY', BASE_CAPTURE_DIRECTORY)
# ENV: ENV_BASE_CAPTURE_DIRECTORY

IMAGES_STATUS_FILE = 'status.json'
IMAGES_STATUS_FILE = os.getenv('ENV_IMAGES_STATUS_FILE', IMAGES_STATUS_FILE)
# ENV: ENV_IMAGES_STATUS_FILE

TRAINING_FILE = 'training.xml'
TRAINING_FILE = os.getenv('ENV_TRAINING_FILE', TRAINING_FILE)
# ENV: ENV_TRAINING_FILE

ERROR_OK = 0
ERROR_NO_ERROR = ERROR_OK
ERROR_INVALID_ARGUMENT_COUNT = 1
ERROR_NO_ACTION_SELECTED = 2
ERROR_PARSING_ARGUMENTS = 3
ERROR_USER_IS_REQUIRED_WHEN_CAPTURING = 4
ERROR_INVALID_USER_ID = 5
ERROR_PICAMERA_IMPORT_ERROR_IN_RPI = 6
ERROR_INVALID_RECOGNITION_ALGORITHM = 7
ERROR_READING_STATUS_FILE = 8
ERROR_READING_USER_ID_FILE = 9
ERROR_USER_ID_IS_NOT_INTEGER = 10
ERROR_LIMIT_IS_NOT_INTEGER = 11
ERROR_DEVICE_ID_IS_NOT_INTEGER = 12
ERROR_ALGORITHM_IS_NOT_INTEGER = 13
ERROR_ALGORITHM_VALUE_NOT_VALID = 14

# ENV: ENV_DEBUG # ENV: ENV_CROP_HEIGHT # ENV: ENV_CROP_WIDTH # We can select the recognizer algorithm. Fisher is LDA (Linear Discrimination # Analysis). # ENV: ENV_RECOGNITION_ALGORITHM # ENV: ENV_DISTANCE_LIMIT # ENV: ENV_BASE_CAPTURE_DIRECTORY # ENV: ENV_IMAGES_STATUS_FILE # ENV: ENV_TRAINING_FILE