Skip to content

Commit d19796f

Browse files
committed
docs(image.py): improve docstring formatting and clarity for better readability and consistency
1 parent 2f4d5ca commit d19796f

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

camtools/image.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,9 @@ def get_post_croppings_paddings_shapes(
168168
paddings: list of 4-tuples: [(pad_t, pad_b, pad_l, pad_r), ...]
169169
170170
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).
173174
"""
174175
dst_shapes = []
175176
for src_shape, cropping, padding in zip(src_shapes, croppings, paddings):
@@ -258,11 +259,9 @@ def ndc_coords_to_pixels(
258259
This function is commonly used in computer graphics to map normalized
259260
coordinates to specific pixel locations in an image.
260261
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.
266265
267266
The NDC space does not have a "pixels size", so we precisely align the
268267
extrema -1 and 1 to either the center or corner of the corner pixels.
@@ -299,7 +298,8 @@ def rotate(
299298
300299
Args:
301300
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.
303303
304304
Returns:
305305
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):
328328
Convert pixel coordinates from a rotated image back to the original image space.
329329
330330
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).
333333
src_wh: Width and height of the original image.
334334
ccw_degrees: Counter-clockwise rotation angle in degrees that was applied
335335
to create the rotated image. Must be one of: 0, 90, 180, or 270.
336336
337337
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).
339340
340341
Raises:
341342
ValueError: If ccw_degrees is not one of the allowed values.
342343
343344
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.
346347
"""
347348
# - src:
348349
# - src_wh : (w , h)

0 commit comments

Comments
 (0)