diff --git a/ivolution/FaceParams.py b/ivolution/FaceParams.py index 3508f73..d6f3e14 100644 --- a/ivolution/FaceParams.py +++ b/ivolution/FaceParams.py @@ -13,6 +13,7 @@ import logging import training_types + class FaceParams(object): ''' Simple class used to store parameters used for Face detection @@ -27,35 +28,35 @@ class FaceParams(object): :type xml_folder: string :param training_type: the type of profile we are going to use :type training_type: string - + :param input_folder: the location where images are located :type input_folder: string :param output_folder: the location where the video will be saved :type output_folder: string :param speed: the time delay between frames in the video - :type speed: int + :type speed: int :param mode: the creation mode of the video. Defines whether images are cropped, or black borders are added. :type mode: string :param sort: the method used to sort images chronologically - :type sort: string + :type sort: string """ self.input_folder = input_folder self.output_folder = output_folder - self.speed = 1 # between 0 and 2 - self.mode = mode # conservative or crop - self.sort = sort # name or exif + self.speed = speed + self.mode = mode # conservative or crop + self.sort = sort # name or exif cascade_name = training_types.simple_set[training_type] + ".xml" # Setting up some default parameters for Face Detection self.face_cascade = cv.Load(os.path.join(xml_folder, cascade_name)) # To be defined more precisely - self.min_size = (20,20) - self.image_scale = 2 # Image scaling chosen for classification (2) - self.haar_scale = 1.2 # Haar scaling chosen for classification (1.2) - self.min_neighbors = 2 # the Minimum number of neighbors to be defined (2) - self.haar_flags = 0 # the chosen number of haar flags (0) + self.min_size = (20, 20) + self.image_scale = 2 # Image scaling chosen for classification (2) + self.haar_scale = 1.2 # Haar scaling chosen for classification (1.2) + self.min_neighbors = 2 # the Minimum number of neighbors to be defined (2) + self.haar_flags = 0 # the chosen number of haar flags (0) self.log() @@ -82,7 +83,7 @@ class FaceParams(object): def log(self): """ - Log configuration + Log configuration """ my_logger = logging.getLogger('FileLog') params_str = "---------" @@ -100,6 +101,5 @@ class FaceParams(object): params_str += "Haar scaling: %f" % (self.haar_scale) params_str += "Number of Haar flags: %d" % (self.haar_flags) params_str += "Minimum number of neighbors: %d" % (self.min_neighbors) - params_str += "---------" + params_str += "---------" my_logger.debug(params_str) - \ No newline at end of file diff --git a/ivolution/Facemovie_lib.py b/ivolution/Facemovie_lib.py index b24f9ba..f41d4ef 100644 --- a/ivolution/Facemovie_lib.py +++ b/ivolution/Facemovie_lib.py @@ -66,7 +66,7 @@ class FaceMovie(object, Observable, Observer): self.depth = 0 # depth of the set of images self.weight_steps = 5 # number of images to be inserted between each frame to reduce violent switch - self.speed = [2, 5, 9] # this one should be internal. Number of fps for the video + self.speed = [3, 6, 9] # this one should be internal. Number of fps for the video self.run = True # command used to stop the processing if needed def update(self, message): @@ -402,8 +402,6 @@ class FaceMovie(object, Observable, Observer): #frameSize = (652, 498) pace = ["slow", "normal", "fast"] - self.console_logger.info("Speed is set to %s" % (pace[speedrate])) - self.my_logger.info("Speed is set to %s" % (pace[speedrate])) my_video = cv.CreateVideoWriter(self.get_out_file(), fourcc, self.speed[speedrate], diff --git a/ivolution/gui_wx/IvolutionTemplate.py b/ivolution/gui_wx/IvolutionTemplate.py index f8069e0..607c53b 100644 --- a/ivolution/gui_wx/IvolutionTemplate.py +++ b/ivolution/gui_wx/IvolutionTemplate.py @@ -24,7 +24,7 @@ helpid = 1004 class IvolutionTemplate ( wx.Frame ): def __init__( self, parent ): - wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 368,472 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) + wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 416,471 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) diff --git a/ivolution/gui_wx/IvolutionWindow.py b/ivolution/gui_wx/IvolutionWindow.py index 94a1872..8914693 100644 --- a/ivolution/gui_wx/IvolutionWindow.py +++ b/ivolution/gui_wx/IvolutionWindow.py @@ -240,22 +240,8 @@ either expressed or implied, of the FreeBSD Project.""" """ Retrieves all parameters needed for the algorithm to run """ - #self.in_fo = self.inputtextbox.GetLabel() + "/" - # self.in_fo = "C:\Users\jll\perso\Ivolution\ivolution\data\samples" + "/" - # self.out_fo = "C:\Users\jll\Videos" + "/" - # #self.out_fo = self.outputchoosertext.GetLabel() + "/" - # self.param = "frontal_face" - # #self.param = self.typefacelist.GetValue() - # #self.speed = self.videospeedlistChoices.index(self.videospeedlist.GetValue()) # We need and integer between 0 and 2 - # self.speed = self.videospeedlistChoices[1] - - # self.mode = "crop" - # self.sort = "name" - #self.mode = self.get_current_mode() - #self.sort = self.get_current_sort() - self.print_parameters() - # Instantiating the face_params object that will be needed by the facemovie + self.out_fo += "/" #FIXME: enhance that par_fo = os.path.join(self.root_fo, get_data("haarcascades")) self.face_params = FaceParams.FaceParams(par_fo, self.in_fo, diff --git a/ivolution/gui_wx/SettingsTemplate.py b/ivolution/gui_wx/SettingsTemplate.py index 80cb11a..9f9b330 100644 --- a/ivolution/gui_wx/SettingsTemplate.py +++ b/ivolution/gui_wx/SettingsTemplate.py @@ -77,7 +77,7 @@ class SettingsTemplate ( wx.Frame ): fgSizer8.SetFlexibleDirection( wx.BOTH ) fgSizer8.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) - self.outputText = wx.TextCtrl( self.basicPage, wx.ID_ANY, u"Ivolution", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.outputText = wx.TextCtrl( self.basicPage, wx.ID_ANY, u"Ivolution", wx.DefaultPosition, wx.DefaultSize, wx.TE_READONLY ) fgSizer8.Add( self.outputText, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) self.extentLabel = wx.StaticText( self.basicPage, wx.ID_ANY, u".avi", wx.DefaultPosition, wx.DefaultSize, 0 ) @@ -108,7 +108,7 @@ class SettingsTemplate ( wx.Frame ): speedSizer.Add( self.speedLabel, 0, wx.ALL, 5 ) speedComboChoices = [ u"Slow", u"Medium", u"Fast" ] - self.speedCombo = wx.ComboBox( self.advancedPage, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, speedComboChoices, 0 ) + self.speedCombo = wx.ComboBox( self.advancedPage, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, speedComboChoices, wx.CB_READONLY ) speedSizer.Add( self.speedCombo, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer11.Add( speedSizer, 1, wx.EXPAND, 10 ) @@ -151,7 +151,7 @@ class SettingsTemplate ( wx.Frame ): typeSizer.Add( self.typeLabel, 0, wx.ALL, 5 ) typeComboChoices = [ u"frontal_face", u"profile_face" ] - self.typeCombo = wx.ComboBox( self.advancedPage, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, typeComboChoices, 0 ) + self.typeCombo = wx.ComboBox( self.advancedPage, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, typeComboChoices, wx.CB_READONLY ) typeSizer.Add( self.typeCombo, 0, wx.ALL, 5 ) fgSizer11.Add( typeSizer, 1, wx.EXPAND, 5 )