mirror of
https://github.com/jlengrand/Ivolution.git
synced 2026-03-10 08:21:18 +00:00
Ends first version of the console based user interface
This commit is contained in:
@@ -6,6 +6,8 @@ Created on 30 mars 2012
|
||||
import cv
|
||||
import os
|
||||
|
||||
import training_types
|
||||
|
||||
class FaceParams(object):
|
||||
'''
|
||||
Simple class used to store parameters used for Face detection
|
||||
@@ -16,36 +18,8 @@ class FaceParams(object):
|
||||
'''
|
||||
# Creates dictionary for all types of training files
|
||||
# some of them shall never be used. Perhaps would it be good to lower the dict size, or hide some of them
|
||||
self.training_types = {#eyes
|
||||
'eyes':"haarcascade_eye",
|
||||
'glasses':"haarcascade_eye_tree_eyeglasses",
|
||||
'left eye splits':"haarcascade_lefteye_2splits",
|
||||
'eye pair big':"haarcascade_mcs_eyepair_big",
|
||||
'eye pair small':"haarcascade_mcs_eyepair_small",
|
||||
'left eye':"haarcascade_mcs_lefteye",
|
||||
'right eye':"haarcascade_mcs_righteye",
|
||||
'right eye splits':"haarcascade_righteye_2splits",
|
||||
# frontal faces
|
||||
'frontal face alt':"haarcascade_frontalface_alt",
|
||||
'frontal face alt2':"haarcascade_frontalface_alt2",
|
||||
'frontal face':"haarcascade_frontalface_default",
|
||||
#profile face
|
||||
'profile face':"haarcascade_profileface",
|
||||
#body
|
||||
'full body':"haarcascade_fullbody",
|
||||
'lower body':"haarcascade_lowerbody",
|
||||
'upper body mcs':"haarcascade_mcs_upperbody",
|
||||
'upper body':"haarcascade_upperbody",
|
||||
#ear
|
||||
'left ear':"haarcascade_mcs_leftear",
|
||||
'right ear':"haarcascade_mcs_rightear",
|
||||
#mouth
|
||||
'mouth':"haarcascade_mcs_mouth",
|
||||
#nose
|
||||
'nose':"haarcascade_mcs_nose"
|
||||
}
|
||||
# postpend .xml
|
||||
cascade_name = self.training_types[training_type] + ".xml"
|
||||
cascade_name = training_types.simple_set[training_type] + ".xml"
|
||||
# Setting up some default parameters for Face Detection
|
||||
print os.path.join(xml_folder, cascade_name)
|
||||
self.face_cascade = cv.Load(os.path.join(xml_folder, cascade_name))
|
||||
|
||||
@@ -11,15 +11,14 @@ import argparse
|
||||
|
||||
import Facemovie
|
||||
import FaceParams
|
||||
import training_types
|
||||
|
||||
class Facemoviefier():
|
||||
"""
|
||||
Class defining the interactions with the end user.
|
||||
Should be used as point of entry for all end users.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
#inits Command Line Parser
|
||||
self.args = self.initCLParser()
|
||||
print self.args
|
||||
@@ -27,7 +26,7 @@ class Facemoviefier():
|
||||
# par folder should be known (contained somewhere in the installation)
|
||||
root_fo = "C:\Users\jll\perso\workspace\FaceMovie"
|
||||
par_fo = os.path.join(root_fo, "facemovie/haarcascades")
|
||||
self.face_params = FaceParams.FaceParams(par_fo, "frontal face alt")
|
||||
self.face_params = FaceParams.FaceParams(par_fo, self.args['param'])
|
||||
|
||||
self.facemovie = Facemovie.FaceMovie(self.args['input'], self.args['output'], self.face_params)
|
||||
|
||||
@@ -55,7 +54,16 @@ class Facemoviefier():
|
||||
choices='vis',
|
||||
help='Selects the kind of output desired. Valid choices are v (video), i (images), s (show)',
|
||||
default='v')
|
||||
|
||||
|
||||
# TODO: Integrate face params file choice, with list of possibilities.
|
||||
parser.add_argument('-p',
|
||||
'--param',
|
||||
choices=training_types.simple_set,
|
||||
help='Choose the desired file for training the recognition phaze. Should be chosen depending on the face presentation (profile, whole body, ...)',
|
||||
default='frontal face alt')
|
||||
|
||||
|
||||
|
||||
args = vars(parser.parse_args())
|
||||
|
||||
return args
|
||||
@@ -80,7 +88,6 @@ class Facemoviefier():
|
||||
elif self.arg['type'] == 'v':
|
||||
self.facemovie.save_movie(self.args['output'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
my_job = Facemoviefier()
|
||||
my_job.run()
|
||||
|
||||
44
facemovie/training_types.py
Normal file
44
facemovie/training_types.py
Normal file
@@ -0,0 +1,44 @@
|
||||
'''
|
||||
Created on 25 avr. 2012
|
||||
|
||||
@author: jll
|
||||
'''
|
||||
# File used only to store a dictionary off all xml files used to train the classifier
|
||||
complete_set = {#eyes
|
||||
'eyes':"haarcascade_eye",
|
||||
'glasses':"haarcascade_eye_tree_eyeglasses",
|
||||
'left eye splits':"haarcascade_lefteye_2splits",
|
||||
'eye pair big':"haarcascade_mcs_eyepair_big",
|
||||
'eye pair small':"haarcascade_mcs_eyepair_small",
|
||||
'left eye':"haarcascade_mcs_lefteye",
|
||||
'right eye':"haarcascade_mcs_righteye",
|
||||
'right eye splits':"haarcascade_righteye_2splits",
|
||||
# frontal faces
|
||||
'frontal face alt':"haarcascade_frontalface_alt",
|
||||
'frontal face alt2':"haarcascade_frontalface_alt2",
|
||||
'frontal face':"haarcascade_frontalface_default",
|
||||
#profile face
|
||||
'profile face':"haarcascade_profileface",
|
||||
#body
|
||||
'full body':"haarcascade_fullbody",
|
||||
'lower body':"haarcascade_lowerbody",
|
||||
'upper body mcs':"haarcascade_mcs_upperbody",
|
||||
'upper body':"haarcascade_upperbody",
|
||||
#ear
|
||||
'left ear':"haarcascade_mcs_leftear",
|
||||
'right ear':"haarcascade_mcs_rightear",
|
||||
#mouth
|
||||
'mouth':"haarcascade_mcs_mouth",
|
||||
#nose
|
||||
'nose':"haarcascade_mcs_nose"
|
||||
}
|
||||
|
||||
simple_set = {# frontal faces
|
||||
'frontal face alt':"haarcascade_frontalface_alt",
|
||||
#profile face
|
||||
'profile face':"haarcascade_profileface",
|
||||
#body
|
||||
'full body':"haarcascade_fullbody",
|
||||
'lower body':"haarcascade_lowerbody",
|
||||
'upper body':"haarcascade_upperbody",
|
||||
}
|
||||
Reference in New Issue
Block a user