From 355e564dea6808f778150c198c26d8567e30486a Mon Sep 17 00:00:00 2001 From: tihmels Date: Tue, 6 Feb 2018 11:43:21 +0100 Subject: [PATCH] Projekt abgabebereit gemacht --- README.rst | 3 +++ projectmood/WebcamVideoStream.py | 1 + projectmood/process_model.py | 3 ++- projectmood/sorted_set_facedetector.py | 1 + projectmood/webcam.py | 9 ++++----- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 3a456b1..a6a25f4 100644 --- a/README.rst +++ b/README.rst @@ -37,6 +37,9 @@ Setup + + + *************** Model Injection *************** diff --git a/projectmood/WebcamVideoStream.py b/projectmood/WebcamVideoStream.py index 4e63e9b..f65efe1 100644 --- a/projectmood/WebcamVideoStream.py +++ b/projectmood/WebcamVideoStream.py @@ -2,6 +2,7 @@ from threading import Thread import cv2 + class WebcamVideoStream: def __init__(self, src=0): diff --git a/projectmood/process_model.py b/projectmood/process_model.py index e86e677..a523b22 100644 --- a/projectmood/process_model.py +++ b/projectmood/process_model.py @@ -15,9 +15,10 @@ import argparse import glob import logging import random +import sys + import cv2 import numpy as np -import sys from email_service import sendMail diff --git a/projectmood/sorted_set_facedetector.py b/projectmood/sorted_set_facedetector.py index 60b8f4a..2331c85 100644 --- a/projectmood/sorted_set_facedetector.py +++ b/projectmood/sorted_set_facedetector.py @@ -19,6 +19,7 @@ import shutil import sys import cv2 + from email_service import sendMail from face_detect import locate_faces diff --git a/projectmood/webcam.py b/projectmood/webcam.py index 794df3c..932db71 100644 --- a/projectmood/webcam.py +++ b/projectmood/webcam.py @@ -14,13 +14,12 @@ import argparse import cv2 -import cv2.face +from cv2 import * import numpy as np - from RingBuffer import RingBuffer from WebcamVideoStream import WebcamVideoStream from face_detect import extract_faces -from image_commons import nparray_as_image, draw_with_alpha, draw_img +from image_commons import nparray_as_image, draw_alpha_3dim, draw_2dim parser = argparse.ArgumentParser(description='ProjectMood Emotion Detection') parser.add_argument('-0', action='append_const', dest='emotions', const='neutral', help='neutral') @@ -88,7 +87,7 @@ def show_webcam_and_run(model, emoticons, window_size=(600, 600), window_name=pa processed_image = nparray_as_image(normalized_face[:, :], mode='L') w, h = vc.size() # And print it to the frame - draw_img(frame, processed_image, (w - 300, h - 300, 250, 250)) + draw_2dim(frame, processed_image, (w - 300, h - 300, 250, 250)) # No entry in the ring buffer is None if not (any(x is None for x in predictions)): @@ -97,7 +96,7 @@ def show_webcam_and_run(model, emoticons, window_size=(600, 600), window_name=pa # Most frequent value is displayed image_to_draw = emoticons[unique[0]] - draw_with_alpha(frame, image_to_draw, (40, 40, 200, 200)) + draw_alpha_3dim(frame, image_to_draw, (40, 40, 200, 200)) cv2.imshow(window_name, frame) frame = vc.read() -- 2.22.0