class_docstr: This class can be used either to change some parameters of the [KalmanFilter](https://filterpy.readthedocs.io/en/latest/kalman/KalmanFilter.html)
  that the tracker uses, or to fully customize the predictive filter implementation to use (as long as the methods and properties are compatible).
  
  The former case only requires changing the default parameters upon tracker creation: `tracker = Tracker(..., filter_factory=FilterPyKalmanFilterFactory(R=100))`,
  while the latter requires creating your own class extending `FilterPyKalmanFilterFactory`, and rewriting its `create_filter` method to return your own customized filter.
  
  Parameters
  ----------
  R : float, optional
      Multiplier for the sensor measurement noise matrix, by default 4.0
  Q : float, optional
      Multiplier for the process uncertainty, by default 0.1
  P : float, optional
      Multiplier for the initial covariance matrix estimation, only in the entries that correspond to position (not speed) variables, by default 10.0
  
  See Also
  --------
  [`filterpy.KalmanFilter`](https://filterpy.readthedocs.io/en/latest/kalman/KalmanFilter.html).
docstr: This method returns a new predictive filter instance with the current setup, to be used by each new [`TrackedObject`][norfair.tracker.TrackedObject] that is created.
  This predictive filter will be used to estimate speed and future positions of the object, to better match the detections during its trajectory.
  
  Parameters
  ----------
  initial_detection : np.ndarray
      numpy array of shape `(number of points per object, 2)`, corresponding to the [`Detection.points`][norfair.tracker.Detection] of the tracked object being born,
      which shall be used as initial position estimation for it.
  
  Returns
  -------
  KalmanFilter
      The kalman filter
docstr_tok: ["This","method","returns","a","new","predictive","filter","instance","with","the","current","setup",",","to","be","used","by","each","new","[","`","TrackedObject","`","]","[","norfair.tracker.TrackedObject","]","that","is","created",".","This","predictive","filter","will","be","used","to","estimate","speed","and","future","positions","of","the","object",",","to","better","match","the","detections","during","its","trajectory",".","Parameters","--","--","--","--","--","initial_detection",":","np.ndarray","numpy","array","of","shape","`","(","number","of","points","per","object",",","2",")","`",",","corresponding","to","the","[","`","Detection.points","`","]","[","norfair.tracker.Detection","]","of","the","tracked","object","being","born",",","which","shall","be","used","as","initial","position","estimation","for","it",".","Returns","--","--","--","-","KalmanFilter","The","kalman","filter"]
code: def create_filter(
      self, initial_detection: np.ndarray
  ) -> KalmanFilter:
      """
      This method returns a new predictive filter instance with the current setup, to be used by each new [`TrackedObject`][norfair.tracker.TrackedObject] that is created.
      This predictive filter will be used to estimate speed and future positions of the object, to better match the detections during its trajectory.
  
      Parameters
      ----------
      initial_detection : np.ndarray
          numpy array of shape `(number of points per object, 2)`, corresponding to the [`Detection.points`][norfair.tracker.Detection] of the tracked object being born,
          which shall be used as initial position estimation for it.
  
      Returns
      -------
      KalmanFilter
          The kalman filter
      """
      num_points = initial_detection.shape[0]
      dim_points = initial_detection.shape[1]
      dim_z = dim_points * num_points
      dim_x = 2 * dim_z  # We need to accommodate for velocities
  
      filter = KalmanFilter(dim_x=dim_x, dim_z=dim_z)
  
      # State transition matrix (models physics): numpy.array()
      filter.F = np.eye(dim_x)
      dt = 1  # At each step we update pos with v * dt
  
      filter.F[:dim_z, dim_z:] = dt * np.eye(dim_z)
  
      # Measurement function: numpy.array(dim_z, dim_x)
      filter.H = np.eye(
          dim_z,
          dim_x,
      )
  
      # Measurement uncertainty (sensor noise): numpy.array(dim_z, dim_z)
      filter.R *= self.R
  
      # Process uncertainty: numpy.array(dim_x, dim_x)
      # Don't decrease it too much or trackers pay too little attention to detections
      filter.Q[dim_z:, dim_z:] *= self.Q
  
      # Initial state: numpy.array(dim_x, 1)
      filter.x[:dim_z] = np.expand_dims(
          initial_detection.flatten(), 0
      ).T
      filter.x[dim_z:] = 0
  
      # Estimation uncertainty: numpy.array(dim_x, dim_x)
      filter.P[dim_z:, dim_z:] *= self.P
  
      return filter
  
imports: from abc import ABC, abstractmethod
  import numpy
  from filterpy.kalman import KalmanFilter
label_desc: Use image node_id 2 for calling the FilterPyKalmanFilterFactory obj's underlying member method code with example usage: obj.create_filter(initial_detection) and returns: filter