code: def applySparseOptFlow(self, raw_frame, detections=None):
      t0 = time.time()
  
      # Initialize
      height, width, _ = raw_frame.shape
      frame = cv2.cvtColor(raw_frame, cv2.COLOR_BGR2GRAY)
      H = np.eye(2, 3)
  
      # Downscale image
      if self.downscale > 1.0:
          # frame = cv2.GaussianBlur(frame, (3, 3), 1.5)
          frame = cv2.resize(
              frame, (width // self.downscale, height // self.downscale)
          )
  
      # find the keypoints
      keypoints = cv2.goodFeaturesToTrack(
          frame, mask=None, **self.feature_params
      )
  
      # Handle first frame
      if not self.initializedFirstFrame:
          # Initialize data
          self.prevFrame = frame.copy()
          self.prevKeyPoints = copy.copy(keypoints)
  
          # Initialization done
          self.initializedFirstFrame = True
  
          return H
  
      if self.prevFrame.shape != frame.shape:
          self.prevFrame = frame.copy()
          self.prevKeyPoints = copy.copy(keypoints)
          return H
  
      # find correspondences
      matchedKeypoints, status, err = cv2.calcOpticalFlowPyrLK(
          self.prevFrame, frame, self.prevKeyPoints, None
      )
  
      # leave good correspondences only
      prevPoints = []
      currPoints = []
  
      for i in range(len(status)):
          if status[i]:
              prevPoints.append(self.prevKeyPoints[i])
              currPoints.append(matchedKeypoints[i])
  
      prevPoints = np.array(prevPoints)
      currPoints = np.array(currPoints)
  
      # Find rigid matrix
      if (np.size(prevPoints, 0) > 4) and (
          np.size(prevPoints, 0) == np.size(prevPoints, 0)
      ):
          H, inliesrs = cv2.estimateAffinePartial2D(
              prevPoints, currPoints, cv2.RANSAC
          )
  
          # Handle downscale
          if self.downscale > 1.0:
              H[0, 2] *= self.downscale
              H[1, 2] *= self.downscale
      else:
          print("Warning: not enough matching points")
  
      # Store to next iteration
      self.prevFrame = frame.copy()
      self.prevKeyPoints = copy.copy(keypoints)
  
      t1 = time.time()
  
      # gmc_line = str(1000 * (t1 - t0)) + "\t" + str(H[0, 0]) + "\t" + str(H[0, 1]) + "\t" + str(
      #     H[0, 2]) + "\t" + str(H[1, 0]) + "\t" + str(H[1, 1]) + "\t" + str(H[1, 2]) + "\n"
      # self.gmc_file.write(gmc_line)
  
      return H
  
file_path: PaddleDetection/ppdet/modeling/mot/motion/gmc.py
imports: import cv2
  import matplotlib.pyplot
  import numpy
  import copy
  import time
  from ppdet.core.workspace import register, serializable
label_desc: Use image node_id 5 for calling the GMC obj's underlying member method code with example usage: obj.applySparseOptFlow(raw_frame, detections) and returns: H, H, H