a.py - /usr/bin/python#Title Script to find emotion using...

This preview shows 1 out of 2 pages.

#!/usr/bin/python #Title: Script to find emotion using facial expression #Date:25/10/2015 #Author:Adithya Selvaprithiviraj #PS: Not trained for nuetral expression import argparse,sys try: from FeatureGen import* except ImportError: print "Make sure FeatureGen.pyc file is in the current directory" exit() try: import dlib from skimage import io import numpy import cv2 from sklearn.externals import joblib except ImportError: print "Make sure you have OpenCV, dLib, scikit learn and skimage libraries properly installed" exit() emotions={ 1:"Anger", 2:"Contempt", 3:"Disgust", 4:"Fear", 5:"Happy", 6:"Sadness", 7:"Surprise"} def Predict_Emotion(filename): print "Opening image .... " try: img=io.imread(filename) cvimg=cv2.imread(filename) except: print "Exception: File Not found." return win.clear_overlay() win.set_image(img) dets=detector(img,1) if len(dets)==0: print "Unable to find any face." return for k,d in enumerate(dets): shape=predictor(img,d) landmarks=[] for i in range(68): landmarks.append(shape.part(i).x) landmarks.append(shape.part(i).y) landmarks=numpy.array(landmarks)
Image of page 1

Subscribe to view the full document.

Image of page 2
You've reached the end of this preview.
  • Fall '13
  • Filename, Filename extension, Computer file, HTTP 404, trained facial shape

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern