@@ -168,8 +168,9 @@ def get_post_croppings_paddings_shapes(
168
168
paddings: list of 4-tuples: [(pad_t, pad_b, pad_l, pad_r), ...]
169
169
170
170
Returns:
171
- List[Tuple[int, int, int]]: List of resulting image shapes after cropping and padding
172
- in the format (height_cropped, width_cropped, channels).
171
+ List[Tuple[int, int, int]]: List of resulting image shapes after
172
+ cropping and padding in the format (height_cropped, width_cropped,
173
+ channels).
173
174
"""
174
175
dst_shapes = []
175
176
for src_shape , cropping , padding in zip (src_shapes , croppings , paddings ):
@@ -258,11 +259,9 @@ def ndc_coords_to_pixels(
258
259
This function is commonly used in computer graphics to map normalized
259
260
coordinates to specific pixel locations in an image.
260
261
261
- In general image interpolation:
262
- When align_corners=True: src and dst images are aligned by the center
263
- point of their corner pixels.
264
- When align_corners=False: src and dst images are aligned by the corner
265
- points of the corner pixels.
262
+ When align_corners is True, src and dst images are aligned by the center
263
+ point of their corner pixels; when align_corners is False, src and dst
264
+ images are aligned by the corner points of the corner pixels.
266
265
267
266
The NDC space does not have a "pixels size", so we precisely align the
268
267
extrema -1 and 1 to either the center or corner of the corner pixels.
@@ -299,7 +298,8 @@ def rotate(
299
298
300
299
Args:
301
300
im: Input image as a float array with shape (height, width, channels).
302
- ccw_degrees: Counter-clockwise rotation angle in degrees. Must be one of: 0, 90, 180, or 270.
301
+ ccw_degrees: Counter-clockwise rotation angle in degrees. Must be one
302
+ of: 0, 90, 180, or 270.
303
303
304
304
Returns:
305
305
Rotated image as a float array. The shape will depend on the rotation angle:
@@ -328,21 +328,22 @@ def recover_rotated_pixels(dst_pixels, src_wh, ccw_degrees):
328
328
Convert pixel coordinates from a rotated image back to the original image space.
329
329
330
330
Args:
331
- dst_pixels: Pixel coordinates in the rotated image as a float array with shape (num_points, 2).
332
- Each row is (col, row).
331
+ dst_pixels: Pixel coordinates in the rotated image as a float array with
332
+ shape (num_points, 2). Each row is (col, row).
333
333
src_wh: Width and height of the original image.
334
334
ccw_degrees: Counter-clockwise rotation angle in degrees that was applied
335
335
to create the rotated image. Must be one of: 0, 90, 180, or 270.
336
336
337
337
Returns:
338
- Pixel coordinates in the original image space as a float array with shape (num_points, 2).
338
+ Pixel coordinates in the original image space as a float array with
339
+ shape (num_points, 2).
339
340
340
341
Raises:
341
342
ValueError: If ccw_degrees is not one of the allowed values.
342
343
343
344
Notes:
344
- This function is the inverse operation of image rotation. It maps coordinates
345
- from the rotated image back to the original image space.
345
+ This function is the inverse operation of image rotation. It maps
346
+ coordinates from the rotated image back to the original image space.
346
347
"""
347
348
# - src:
348
349
# - src_wh : (w , h)
0 commit comments