def mask_to_polygon(mask: np.ndarray, epsilon_multiplier: float = 0.005) -> List[List[int]]:
    """
    Convert a binary mask to a polygon by finding the largest contour and approximating it.

    Args:
        mask (np.ndarray): The input binary mask.
        epsilon_multiplier (float, optional): The multiplier to control the approximation (default is 0.005).

    Returns:
        List[List[int]]: List of polygon vertices represented as coordinate pairs.
    """
    # Find contours
    contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

    # Find the largest contour
    largest_contour = max(contours, key=cv2.contourArea)

    # Approximate the polygon
    epsilon = epsilon_multiplier * cv2.arcLength(largest_contour, True)
    approx_polygon = cv2.approxPolyDP(largest_contour, epsilon, True)

    # Get the vertices of the polygon
    approx_polygon = approx_polygon.reshape(-1, 2)

    return approx_polygon

    Convert a binary mask to a polygon by finding the largest contour and approximating it.

    Args:
        mask (np.ndarray): The input binary mask.
        epsilon_multiplier (float, optional): The multiplier to control the approximation (default is 0.005).

    Returns:
        List[List[int]]: List of polygon vertices represented as coordinate pairs.
    
scripts/easyphoto_utils/tryon_utils.py