Exemplo n.º 1
0
 def onmouse(self, event, x, y, flags, param):
     if self.lock:
         if event == cv2.EVENT_RBUTTONDOWN:
             self.pop_camshift()
             return
         if event == cv2.EVENT_LBUTTONDOWN:
             self.drag_start = (x, y)
             self.newcamshift=mycamshift()
         if self.drag_start:                  
             xmin = min(x, self.drag_start[0])
             ymin = min(y, self.drag_start[1])
             xmax = max(x, self.drag_start[0])
             ymax = max(y, self.drag_start[1])
             self.selection=(xmin, ymin, xmax, ymax)
         if event == cv2.EVENT_LBUTTONUP:
             self.fps.reset()
             self.drag_start = None
             if self.newcamshift is not None and self.newcamshift.getHist() is not None:
                 self.newcamshift.ID=len(self.list_camshift)
                 self.list_camshift.append(self.newcamshift)
             self.newcamshift=None
             self.selection=None
Exemplo n.º 2
0
 def get_light(self):
     temp = mycamshift()
     temp.prProcess_light(self.frame)
     temp.ID = 99
     return temp
Exemplo n.º 3
0
 def creat_camshift_from_img(hsv):
     camshift = mycamshift()
     mask = np.ones((hsv.shape[0], hsv.shape[1]), dtype=np.uint8)
     camshift.preProcess(hsv, mask, (0, 0, hsv.shape[1], hsv.shape[0]), 32)
     return camshift