diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dbe9c82 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode/ \ No newline at end of file diff --git a/python_scripts/main.py b/python_scripts/main.py index 6299e9d..e44b0b1 100755 --- a/python_scripts/main.py +++ b/python_scripts/main.py @@ -1,6 +1,8 @@ import numpy as np import cv2 from sklearn.externals import joblib +import pandas as pd +import joblib import argparse # from time import gmtime, strftime @@ -32,9 +34,11 @@ def calc_hist(img): # # Load model clf = None try: + print(args["name"]) clf = joblib.load(args["name"]) + # clf = pd.read_pickle(args["name"]) except IOError as e: - print "Error loading model <"+args["name"]+">: {0}".format(e.strerror) + print ("Error loading model <"+args["name"]+">: {0}".format(e.strerror)) exit(0) # # Open the camera @@ -43,7 +47,7 @@ def calc_hist(img): else: cap = cv2.VideoCapture(int(args["device"])) if not cap.isOpened(): - print "Error opening camera" + print ("Error opening camera") exit(0) width = 320 @@ -63,7 +67,7 @@ def calc_hist(img): while True: ret, img_bgr = cap.read() if ret is False: - print "Error grabbing frame from camera" + print ("Error grabbing frame from camera") break img_gray = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2GRAY) @@ -95,7 +99,7 @@ def calc_hist(img): point = (x, y-5) - print measures, np.mean(measures) + print (measures, np.mean(measures)) if 0 not in measures: text = "True" if np.mean(measures) >= 0.7: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..95b3379 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +scikit-learn==0.22 +numpy +opencv-python \ No newline at end of file