code: def skybox_tracking(self, frame, frame_prev, skymask):
      if np.mean(skymask) < 0.05:
          print("sky area is too small")
          return np.array([[1, 0, 0], [0, 1, 0]], dtype=np.float32)
  
      prev_gray = cv2.cvtColor(frame_prev, cv2.COLOR_RGB2GRAY)
      prev_gray = np.array(255 * prev_gray, dtype=np.uint8)
      curr_gray = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
      curr_gray = np.array(255 * curr_gray, dtype=np.uint8)
  
      mask = np.array(skymask[:, :, 0] > 0.99, dtype=np.uint8)
  
      template_size = int(0.05 * mask.shape[0])
      mask = cv2.erode(mask, np.ones([template_size, template_size]))
  
      # ShiTomasi corner detection
      prev_pts = cv2.goodFeaturesToTrack(
          prev_gray,
          mask=mask,
          maxCorners=200,
          qualityLevel=0.01,
          minDistance=30,
          blockSize=3,
      )
  
      if prev_pts is None:
          print("no feature point detected")
          return np.array([[1, 0, 0], [0, 1, 0]], dtype=np.float32)
  
      # Calculate optical flow (i.e. track feature points)
      curr_pts, status, err = cv2.calcOpticalFlowPyrLK(
          prev_gray, curr_gray, prev_pts, None
      )
      # Filter only valid points
      idx = np.where(status == 1)[0]
      if idx.size == 0:
          print("no good point matched")
          return np.array([[1, 0, 0], [0, 1, 0]], dtype=np.float32)
  
      prev_pts, curr_pts = removeOutliers(prev_pts, curr_pts)
  
      if curr_pts.shape[0] < 10:
          print("no good point matched")
          return np.array([[1, 0, 0], [0, 1, 0]], dtype=np.float32)
  
      # limit the motion to translation + rotation
      dxdyda = estimate_partial_transform(
          (np.array(prev_pts), np.array(curr_pts))
      )
      m = build_transformation_matrix(dxdyda)
  
      return m
  
file_path: PaddleHub/modules/video/Video_editing/SkyAR/skybox.py
imports: import cv2
  import numpy
  from .rain import Rain
  from .utils import build_transformation_matrix, update_transformation_matrix, estimate_partial_transform, removeOutliers, guidedfilter
label_desc: Use image node_id 6 for calling the SkyBox obj's underlying member method code with example usage: obj.skybox_tracking(frame, frame_prev, skymask) and returns: m, np, np, np, np