class_docstr: Rotate the input by an angle selected randomly from the uniform distribution.
  
  Args:
      limit ((int, int) or int): range from which a random angle is picked. If limit is a single int
          an angle is picked from (-limit, limit). Default: (-90, 90)
      interpolation (OpenCV flag): flag that is used to specify the interpolation algorithm. Should be one of:
          cv2.INTER_NEAREST, cv2.INTER_LINEAR, cv2.INTER_CUBIC, cv2.INTER_AREA, cv2.INTER_LANCZOS4.
          Default: cv2.INTER_LINEAR.
      border_mode (OpenCV flag): flag that is used to specify the pixel extrapolation method. Should be one of:
          cv2.BORDER_CONSTANT, cv2.BORDER_REPLICATE, cv2.BORDER_REFLECT, cv2.BORDER_WRAP, cv2.BORDER_REFLECT_101.
          Default: cv2.BORDER_REFLECT_101
      value (int, float, list of ints, list of float): padding value if border_mode is cv2.BORDER_CONSTANT.
      mask_value (int, float,
                  list of ints,
                  list of float): padding value if border_mode is cv2.BORDER_CONSTANT applied for masks.
      rotate_method (str): rotation method used for the bounding boxes. Should be one of "largest_box" or "ellipse".
          Default: "largest_box"
      crop_border (bool): If True would make a largest possible crop within rotated image
      p (float): probability of applying the transform. Default: 0.5.
  
  Targets:
      image, mask, bboxes, keypoints
  
  Image types:
      uint8, float32
docstr: Given a rectangle of size wxh that has been rotated by 'angle' (in
  degrees), computes the width and height of the largest possible
  axis-aligned rectangle (maximal area) within the rotated rectangle.
  
  Code from: https://stackoverflow.com/questions/16702966/rotate-image-and-crop-out-black-borders
docstr_tok: ["Given","a","rectangle","of","size","wxh","that","has","been","rotated","by","'angle","'","(","in","degrees",")",",","computes","the","width","and","height","of","the","largest","possible","axis-aligned","rectangle","(","maximal","area",")","within","the","rotated","rectangle",".","Code","from",":","https",":","\/\/stackoverflow.com\/questions\/16702966\/rotate-image-and-crop-out-black-borders"]
code: def _rotated_rect_with_max_area(h, w, angle):
      """
      Given a rectangle of size wxh that has been rotated by 'angle' (in
      degrees), computes the width and height of the largest possible
      axis-aligned rectangle (maximal area) within the rotated rectangle.
  
      Code from: https://stackoverflow.com/questions/16702966/rotate-image-and-crop-out-black-borders
      """
  
      angle = math.radians(angle)
      width_is_longer = w >= h
      side_long, side_short = (w, h) if width_is_longer else (h, w)
  
      # since the solutions for angle, -angle and 180-angle are all the same,
      # it is sufficient to look at the first quadrant and the absolute values of sin,cos:
      sin_a, cos_a = abs(math.sin(angle)), abs(math.cos(angle))
      if (
          side_short <= 2.0 * sin_a * cos_a * side_long
          or abs(sin_a - cos_a) < 1e-10
      ):
          # half constrained case: two crop corners touch the longer side,
          # the other two corners are on the mid-line parallel to the longer line
          x = 0.5 * side_short
          wr, hr = (
              (x / sin_a, x / cos_a)
              if width_is_longer
              else (x / cos_a, x / sin_a)
          )
      else:
          # fully constrained case: crop touches all 4 sides
          cos_2a = cos_a * cos_a - sin_a * sin_a
          wr, hr = (w * cos_a - h * sin_a) / cos_2a, (
              h * cos_a - w * sin_a
          ) / cos_2a
  
      return dict(
          x_min=max(0, int(w / 2 - wr / 2)),
          x_max=min(w, int(w / 2 + wr / 2)),
          y_min=max(0, int(h / 2 - hr / 2)),
          y_max=min(h, int(h / 2 + hr / 2)),
      )
  
imports: import math
  import random
  from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
  import cv2
  import numpy
  from ...core.transforms_interface import BoxInternalType, DualTransform, FillValueType, KeypointInternalType, to_tuple
  from ..crops import functional
  from .None import functional
label_desc: Use image node_id 6 for calling the Rotate obj's underlying member method code with example usage: obj._rotated_rect_with_max_area(h, w, angle) and returns: dict