Bounding Box Fitting Center
- tomni.bbox_fitting.bbox_fitting_center(img: numpy.ndarray, size, padding_value: int = 0) numpy.ndarray [source]
Creates an image of size ‘size’ in IMAGE-Coordinates by centering and padding the original image.
- Parameters
img (numpy.ndarray) – The original image.
size (List[int]) – The target size of the output image as [x, y].
padding_value (int, optional) – The value used for padding. Defaults to 0.
- Returns
The resulting image of the specified size.
- Return type
numpy.ndarray
- Raises
TypeError – If img is not a numpy.ndarray.
ValueError – If size elements are not positive integers.
Example:
img = np.zeros((100, 100)) size = [50, 50] result = bbox_fitting_center(img, size) result.shape (50, 50) # The resulting image size.