class_docstr: Camera motion compensation.
  
  Args:
      warp_mode (str): Warp mode in opencv.
          Defaults to 'cv2.MOTION_EUCLIDEAN'.
      num_iters (int): Number of the iterations. Defaults to 50.
      stop_eps (float): Terminate threshold. Defaults to 0.001.
class_docstr_tok: ["Camera","motion","compensation",".","Args",":","warp_mode","(","str",")",":","Warp","mode","in","opencv",".","Defaults","to","'cv2.MOTION_EUCLIDEAN","'",".","num_iters","(","int",")",":","Number","of","the","iterations",".","Defaults","to","50.","stop_eps","(","float",")",":","Terminate","threshold",".","Defaults","to","0.001","."]
docstr: Calculate warping matrix between two images.
docstr_tok: ["Calculate","warping","matrix","between","two","images","."]
code: def get_warp_matrix(
      self, img: np.ndarray, ref_img: np.ndarray
  ) -> Tensor:
      """Calculate warping matrix between two images."""
      img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
      ref_img = cv2.cvtColor(ref_img, cv2.COLOR_BGR2GRAY)
  
      warp_matrix = np.eye(2, 3, dtype=np.float32)
      criteria = (
          cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT,
          self.num_iters,
          self.stop_eps,
      )
      cc, warp_matrix = cv2.findTransformECC(
          img, ref_img, warp_matrix, self.warp_mode, criteria, None, 1
      )
      warp_matrix = torch.from_numpy(warp_matrix)
      return warp_matrix
  
file_path: mmdetection/mmdet/models/task_modules/tracking/camera_motion_compensation.py
imports: import cv2
  import numpy
  import torch
  from torch import Tensor
  from mmdet.registry import TASK_UTILS
  from mmdet.structures.bbox import bbox_cxcyah_to_xyxy, bbox_xyxy_to_cxcyah
label_desc: Use image node_id 2 for calling the CameraMotionCompensation obj's underlying member method code with example usage: obj.get_warp_matrix(img, ref_img) and returns: warp_matrix