Ejemplo n.º 1
0
Archivo: main.py Proyecto: Enomiss/MSc
 def run_image_learn(self):
     is_manual_train  = VARIABLE['hand_border']
     
     self.tree = P2DHMMFactory.make(P2DHMM.P2DHMM_TYPE_TREE)
     self.background = P2DHMMFactory.make(P2DHMM.P2DHMM_TYPE_BACKGROUND)
     
     for root, dirs, files in os.walk(VARIABLE['directory']):
         for file in files:
             if file.endswith('.bmp'):
                 print(root+"/"+file)
                 self.piximage = piximage2.PixImage(root+"/"+file)
                 self.display()
                 
                 if is_manual_train:
                     self.tree.manual_train(self.piximage)
                 else:
                     self.tree.auto_train(self.piximage.image_ycrcb)
                 self.tree.summarize()
       
     self.tree.from_summaries()
     
     self.background.train(self.piximage.image_ycrcb)
     for ss_state in self.background.model.states:
         if ss_state.name == self.background.superstate_names[0]:
             for s_state in ss_state.distribution.model.states:
                 if s_state.name == ss_state.distribution.state_names[0]:
                     s_state.distribution = self.tree.backgorund_state.distribution
Ejemplo n.º 2
0
Archivo: main.py Proyecto: Enomiss/MSc
 def run_image_denoise(self):
     self.tree = P2DHMMFactory.make(P2DHMM.P2DHMM_TYPE_TREE)
     self.tree.manual_train(self.piximage)