Beispiel #1
0
            gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
            faces = face_detector.detectMultiScale(gray, 1.3, 5)
            for (x, y, w, h) in faces:
                cv2.rectangle(gray, (x, y), (x + w, y + h), (255, 0, 0), 2)
                count += 1
                dir1 = os.path.join(dir, face_id)
                if not os.path.exists(dir1):
                    os.makedirs(dir1)
                # Save the captured image into the datasets folder
                cv2.imwrite(dir1 + "/" + str(count) + ".jpg", gray[y:y + h,
                                                                   x:x + w])
                cv2.imshow('frame', gray)
            if count >= 10:
                print("10 face sample and stop dataset")
                break
        else:
            break
    capt.release()
    cv2.destroyAllWindows()
    encode_faces.encoding()
    print("encoded images")


def custom_action():
    capture_encode_faces()


watch1 = Watcher(watch_file, custom_action)  # also call custom action function
watch1.watch()  # start the watch going
watch1.look()
Beispiel #2
0
from logging import getLogger, INFO, basicConfig

logger = getLogger(__name__)
format_ = "[%(asctime)s]:%(filename)s:%(lineno)s:%(message)s"
basicConfig(format=format_, level=INFO, filename="c4N4Re.log", filemode='w')

if __name__ == "__main__":
    config = ConfigParser()
    config.read("config.ini")

    if (not config.has_section("login")
            or not config.has_option("login", "email")
            or not config.has_option("login", "app_pass")):
        login = Login(config=config)
        try:
            login.env_login()
        except:
            logger.critical(
                "Unable to retrieve email or app password values from config file."
            )

    try:
        watcher = Watcher(config=config)
        watcher.watch()
    except KeyboardInterrupt:
        logger.info("Captured KeyboardInterrupt exception. Exiting program")
        exit(1)
    except Exception as e:
        logger.critical(f"Exception -> {e}")
        exit(1)
Beispiel #3
0
Datei: main.py Projekt: rozap/arb
def main():
    args = parse()
    settings = load_settings(args.settings)
    w = Watcher(settings)
    w.watch()