def get_perspective_transform(
    img: np.ndarray,
    angle: float,
    width: int,
    height: int,
    focal: float,
    dist: float,
    crop_percent: float,
    crop_off_x: float,
    crop_off_y: float,
    pts: np.ndarray | None = None,
) -> np.ndarray:
    """
    Computes parameters for perspective transform for blackbox attack.

    :param img: Input image.
    :param angle: Angle to rotate.
    :param width: Width of image.
    :param height: Height of image.
    :param focal: Focal length.
    :param dist: Distance for transform.
    :param crop_percent: Percentage for cropping.
    :param crop_off_x: Cropping x offset.
    :param crop_off_y: Cropping y offset.
    :param pts: pts to include in the crop.
    :return: Transformed image.
    """
    import cv2

    perspective_mat, crop_x, crop_y = _get_perspective_transform(
        angle, width, height, focal, dist, crop_percent, crop_off_x, crop_off_y, pts
    )
    dst = cv2.warpPerspective(img, perspective_mat, (crop_x, crop_y), borderMode=cv2.BORDER_REPLICATE)
    return dst

    Computes parameters for perspective transform for blackbox attack.

    :param img: Input image.
    :param angle: Angle to rotate.
    :param width: Width of image.
    :param height: Height of image.
    :param focal: Focal length.
    :param dist: Distance for transform.
    :param crop_percent: Percentage for cropping.
    :param crop_off_x: Cropping x offset.
    :param crop_off_y: Cropping y offset.
    :param pts: pts to include in the crop.
    :return: Transformed image.
    
art/attacks/evasion/graphite/utils.py