code: def _get_sparse_flow(
      gray_next,
      gray_prvs,
      prev_pts=None,
      max_points=300,
      min_distance=15,
      block_size=3,
      mask=None,
      quality_level=0.01,
  ):
      if prev_pts is None:
          # get points
          prev_pts = cv2.goodFeaturesToTrack(
              gray_prvs,
              maxCorners=max_points,
              qualityLevel=quality_level,
              minDistance=min_distance,
              blockSize=block_size,
              mask=mask,
          )
  
      # compute optical flow
      curr_pts, status, err = cv2.calcOpticalFlowPyrLK(
          gray_prvs, gray_next, prev_pts, None
      )
      # filter valid points
      idx = np.where(status == 1)[0]
      prev_pts = prev_pts[idx].reshape((-1, 2))
      curr_pts = curr_pts[idx].reshape((-1, 2))
      return curr_pts, prev_pts
  
imports: from abc import ABC, abstractmethod
  from typing import Optional, Tuple
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _get_sparse_flow(gray_next, gray_prvs, prev_pts, max_points, min_distance, block_size, mask, quality_level) and returns: curr_pts,  prev_pts