class_docstr: Estimator of the motion of the camera.
  
  Uses optical flow to estimate the motion of the camera from frame to frame.
  The optical flow is calculated on a sample of strong points (corners).
  
  Parameters
  ----------
  max_points : int, optional
      Maximum amount of points sampled.
      More points make the estimation process slower but more precise
  min_distance : int, optional
      Minimum distance between the sample points.
  block_size : int, optional
      Size of an average block when finding the corners. More info in links below.
  transformations_getter : TransformationGetter, optional
      An instance of TransformationGetter. By default [`HomographyTransformationGetter`][norfair.camera_motion.HomographyTransformationGetter]
  draw_flow : bool, optional
      Draws the optical flow on the frame for debugging.
  flow_color : Optional[Tuple[int, int, int]], optional
      Color of the drawing, by default blue.
  quality_level : float, optional
      Parameter characterizing the minimal accepted quality of image corners.
  
  Examples
  --------
  >>> from norfair import Tracker, Video
  >>> from norfair.camera_motion MotionEstimator
  >>> video = Video("video.mp4")
  >>> tracker = Tracker(...)
  >>> motion_estimator = MotionEstimator()
  >>> for frame in video:
  >>>    detections = get_detections(frame)  # runs detector and returns Detections
  >>>    coord_transformation = motion_estimator.update(frame)
  >>>    tracked_objects = tracker.update(detections, coord_transformations=coord_transformation)
  
  See Also
  --------
  For more infor on how the points are sampled: [OpenCV.goodFeaturesToTrack](https://docs.opencv.org/3.4/dd/d1a/group__imgproc__feature.html#ga1d6bb77486c8f92d79c8793ad995d541)
docstr: Estimate camera motion for each frame
  
  Parameters
  ----------
  frame : np.ndarray
      The frame.
  mask : np.ndarray, optional
      An optional mask to avoid areas of the frame when sampling the corner.
      Must be an array of shape `(frame.shape[0], frame.shape[1])`, dtype same as frame,
      and values in {0, 1}.
  
      In general, the estimation will work best when it samples many points from the background;
      with that intention, this parameters is usefull for masking out the detections/tracked objects,
      forcing the MotionEstimator ignore the moving objects.
      Can be used to mask static areas of the image, such as score overlays in sport transmisions or
      timestamps in security cameras.
  
  Returns
  -------
  CoordinatesTransformation
      The CoordinatesTransformation that can transform coordinates on this frame to absolute coordinates
      or vice versa.
docstr_tok: ["Estimate","camera","motion","for","each","frame","Parameters","--","--","--","--","--","frame",":","np.ndarray","The","frame",".","mask",":","np.ndarray",",","optional","An","optional","mask","to","avoid","areas","of","the","frame","when","sampling","the","corner",".","Must","be","an","array","of","shape","`","(","frame.shape","[","0","]",",","frame.shape","[","1","]",")","`",",","dtype","same","as","frame",",","and","values","in","{","0",",","1","}",".","In","general",",","the","estimation","will","work","best","when","it","samples","many","points","from","the","background",";","with","that","intention",",","this","parameters","is","usefull","for","masking","out","the","detections\/tracked","objects",",","forcing","the","MotionEstimator","ignore","the","moving","objects",".","Can","be","used","to","mask","static","areas","of","the","image",",","such","as","score","overlays","in","sport","transmisions","or","timestamps","in","security","cameras",".","Returns","--","--","--","-","CoordinatesTransformation","The","CoordinatesTransformation","that","can","transform","coordinates","on","this","frame","to","absolute","coordinates","or","vice","versa","."]
code: def update(
      self, frame: np.ndarray, mask: np.ndarray = None
  ) -> CoordinatesTransformation:
      """
      Estimate camera motion for each frame
  
      Parameters
      ----------
      frame : np.ndarray
          The frame.
      mask : np.ndarray, optional
          An optional mask to avoid areas of the frame when sampling the corner.
          Must be an array of shape `(frame.shape[0], frame.shape[1])`, dtype same as frame,
          and values in {0, 1}.
  
          In general, the estimation will work best when it samples many points from the background;
          with that intention, this parameters is usefull for masking out the detections/tracked objects,
          forcing the MotionEstimator ignore the moving objects.
          Can be used to mask static areas of the image, such as score overlays in sport transmisions or
          timestamps in security cameras.
  
      Returns
      -------
      CoordinatesTransformation
          The CoordinatesTransformation that can transform coordinates on this frame to absolute coordinates
          or vice versa.
      """
      self.gray_next = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      if self.gray_prvs is None:
          self.gray_prvs = self.gray_next
          self.prev_mask = mask
  
      curr_pts, self.prev_pts = _get_sparse_flow(
          self.gray_next,
          self.gray_prvs,
          self.prev_pts,
          self.max_points,
          self.min_distance,
          self.block_size,
          self.prev_mask,
          quality_level=self.quality_level,
      )
      if self.draw_flow:
          for curr, prev in zip(curr_pts, self.prev_pts):
              c = tuple(curr.astype(int).ravel())
              p = tuple(prev.astype(int).ravel())
              cv2.line(frame, c, p, self.flow_color, 2)
              cv2.circle(frame, c, 3, self.flow_color, -1)
  
      update_prvs, coord_transformations = self.transformations_getter(
          curr_pts,
          self.prev_pts,
      )
  
      if update_prvs:
          self.gray_prvs = self.gray_next
          self.prev_pts = None
          self.prev_mask = mask
  
      return coord_transformations
  
imports: from abc import ABC, abstractmethod
  from typing import Optional, Tuple
  import numpy
label_desc: Use image node_id 2 for calling the MotionEstimator obj's underlying member method code with example usage: obj.update(frame, mask) and returns: coord_transformations