def _load_emoticons(emotions): """ Loads emotions images from graphics folder. :param emotions: Array of emotions names. :return: Array of emotions graphics. """ l=[nparray_as_image(cv2.imread('graphics/%s.png' % emotion, -1), mode=None) for emotion in emotions] for emotion in emotions: print(emotion,nparray_as_image(cv2.imread('graphics/%s.png' % emotion, -1), mode=None)) return l
def _load_emoticons(emotions): """ Loads emotions images from graphics folder. :param emotions: Array of emotions names. :return: Array of emotions graphics. """ return [nparray_as_image(cv2.imread('graphics/%s.png' % emotion, -1), mode=None) for emotion in emotions]
def _load_emoticons(emotions): """ Loads emotions images from graphics folder. """ return [ nparray_as_image(cv2.imread('C:\\faceMoji\\graphics\\%s.png' % emotion, -1), mode=None) for emotion in emotions ] #emotions: Array of emotions names which returns Array of emotions graphics
def _load_emoticons(emotions): """ carga los emojis desde la carpeta. :param emotions: Lisa con el nombre de la emociones. :return: lista de los emojis. """ return [ nparray_as_image(cv2.imread('graphics/%s.png' % emotion, -1), mode=None) for emotion in emotions ]
emotion_dict = { 0: "Angry", 1: "Disgusted", 2: "Fearful", 3: "Happy", 4: "Neutral", 5: "Sad", 6: "Surprised" } # To load the emoticons emotions emotions = [ 'Angry', 'Disgusted', 'Fearful', 'Happy', 'Neutral', 'Sad', 'Surprised' ] emoticons = [ nparray_as_image(cv2.imread('graphics/%s.png' % emotion, -1), mode=None) for emotion in emotions ] # start the webcam feed print("Start") url = "http://10.12.139.207:8080/shot.jpg" #cap = cv2.VideoCapture(0) while True: img_resp = requests.get(url) img_arr = np.array(bytearray(img_resp.content), dtype=np.uint8) img = cv2.imdecode(img_arr, -1)
def _load_emoticons(emotions): return [ nparray_as_image(cv2.imread('graphics/%s.png' % emotion, -1), mode=None) for emotion in emotions ]
model.add(Dense(1024, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(7, activation='softmax')) # emotions will be displayed on your face from the webcam feed model.load_weights('model5.h5') # prevents openCL usage and unnecessary logging messages cv2.ocl.setUseOpenCL(False) # dictionary which assigns each label an emotion (alphabetical order) emotion_dict = {0: "Angry", 1: "Disgusted", 2: "Fearful", 3: "Happy", 4: "Neutral", 5: "Sad", 6: "Surprised"} # To load the emoticons emotions emotions = ['Angry', 'Disgusted', 'Fearful', 'Happy', 'Neutral', 'Sad', 'Surprised'] emoticons = [nparray_as_image(cv2.imread('graphics/%s.png' % emotion, -1), mode=None) for emotion in emotions] # start the webcam feed print("Start") url = "http://10.12.139.207:8080/shot.jpg" #cap = cv2.VideoCapture(0) while True: img_resp = requests.get(url) img_arr = np.array(bytearray(img_resp.content), dtype = np.uint8) img = cv2.imdecode(img_arr, -1) img = cv2.flip(img, 1) facecasc = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')