docstr: 从scales中随机选择一个尺度，对图片和文本框进行缩放
  :param data: {'img':,'text_polys':,'texts':,'ignore_tags':}
  :return:
docstr_tok: ["\u4ecescales\u4e2d\u968f\u673a\u9009\u62e9\u4e00\u4e2a\u5c3a\u5ea6\uff0c\u5bf9\u56fe\u7247\u548c\u6587\u672c\u6846\u8fdb\u884c\u7f29\u653e",":","param","data",":","{","'img","'",":",",'text_polys","'",":",",'texts","'",":",",'ignore_tags","'",":","}",":","return",":"]
code: def __call__(self, data: dict) -> dict:
      """
      从scales中随机选择一个尺度，对图片和文本框进行缩放
      :param data: {'img':,'text_polys':,'texts':,'ignore_tags':}
      :return:
      """
      if random.random() > self.random_rate:
          return data
      im = data["img"]
      text_polys = data["text_polys"]
  
      # ---------------------- 旋转图像 ----------------------
      w = im.shape[1]
      h = im.shape[0]
      angle = np.random.uniform(self.degrees[0], self.degrees[1])
  
      if self.same_size:
          nw = w
          nh = h
      else:
          # 角度变弧度
          rangle = np.deg2rad(angle)
          # 计算旋转之后图像的w, h
          nw = abs(np.sin(rangle) * h) + abs(np.cos(rangle) * w)
          nh = abs(np.cos(rangle) * h) + abs(np.sin(rangle) * w)
      # 构造仿射矩阵
      rot_mat = cv2.getRotationMatrix2D((nw * 0.5, nh * 0.5), angle, 1)
      # 计算原图中心点到新图中心点的偏移量
      rot_move = np.dot(
          rot_mat, np.array([(nw - w) * 0.5, (nh - h) * 0.5, 0])
      )
      # 更新仿射矩阵
      rot_mat[0, 2] += rot_move[0]
      rot_mat[1, 2] += rot_move[1]
      # 仿射变换
      rot_img = cv2.warpAffine(
          im,
          rot_mat,
          (int(math.ceil(nw)), int(math.ceil(nh))),
          flags=cv2.INTER_LANCZOS4,
      )
  
      # ---------------------- 矫正bbox坐标 ----------------------
      # rot_mat是最终的旋转矩阵
      # 获取原始bbox的四个中点，然后将这四个点转换到旋转后的坐标系下
      rot_text_polys = list()
      for bbox in text_polys:
          point1 = np.dot(
              rot_mat, np.array([bbox[0, 0], bbox[0, 1], 1])
          )
          point2 = np.dot(
              rot_mat, np.array([bbox[1, 0], bbox[1, 1], 1])
          )
          point3 = np.dot(
              rot_mat, np.array([bbox[2, 0], bbox[2, 1], 1])
          )
          point4 = np.dot(
              rot_mat, np.array([bbox[3, 0], bbox[3, 1], 1])
          )
          rot_text_polys.append([point1, point2, point3, point4])
      data["img"] = rot_img
      data["text_polys"] = np.array(rot_text_polys)
      return data
  
imports: import math
  import numbers
  import random
  import cv2
  import numpy
  from skimage.util import random_noise
label_desc: Use image node_id 2 for calling the RandomRotateImgBox obj's underlying member method code with example usage: obj.__call__(data) and returns: data, data