(self, image, rect, data=None)
Add a new tracking target.
Add a new tracking target.
Add a new tracking target .
def add_target(self, image, rect, data=None):
        '''Add a new tracking target.'''
        x0, y0, x1, y1 = rect
        raw_points, raw_descrs = self.detect_features(image)
        points, descs = [], []
        for kp, desc in zip(raw_points, raw_descrs):
            x, y = kp.pt
            if x0 <= x <= x1 and y0 <= y <= y1:
                points.append(kp)
                descs.append(desc)
        descs = np.uint8(descs)
        self.matcher.add([descs])
        target = PlanarTarget(image = image, rect=rect, keypoints = points, descrs=descs, data=data)
        self.targets.append(target)
def add_target ( self , image , rect , data = None ) : x0 , y0 , x1 , y1 = rect raw_points , raw_descrs = self . detect_features ( image ) points , descs = [ ] , [ ] for kp , desc in zip ( raw_points , raw_descrs ) : x , y = kp . pt if x0 <= x <= x1 and y0 <= y <= y1 : points . append ( kp ) descs . append ( desc ) descs = np . uint8 ( descs ) self . matcher . add ( [ descs ] ) target = PlanarTarget ( image = image , rect = rect , keypoints = points , descrs = descs , data = data ) self . targets . append ( target )