def track(self, prev_tracks, frame_num, image, mask=None): """ Extend a previous set of tracks using the given image. An optional mask image may be provided, where positive valued regions indicate regions of the input image to consider for feature tracking. The mask image must be of the same dimensions as the input image, other wise an exception is raised. :param prev_tracks: :param frame_num: :param image: :param mask: :return: """ tf_track_argtypes = [self.C_TYPE_PTR, TrackSet.C_TYPE_PTR, ctypes.c_uint, ImageContainer.C_TYPE_PTR] tf_track_args = [self, prev_tracks, frame_num, image] tf_track_restype = TrackSet.C_TYPE_PTR if mask: tf_track = self.VITAL_LIB['vital_algorithm_track_features_' 'track_with_mask'] tf_track_argtypes.append(ImageContainer.C_TYPE_PTR) tf_track_args.append(mask) else: tf_track = self.VITAL_LIB['vital_algorithm_track_features_track'] tf_track_argtypes.append(VitalErrorHandle.C_TYPE_PTR) tf_track.argtypes = tf_track_argtypes tf_track.restype = tf_track_restype with VitalErrorHandle() as eh: tf_track_args.append(eh) return TrackSet.from_c_pointer( tf_track(*tf_track_args) )