Skip to content

Commit 4f02b16

Browse files
clarifying comment when padding
1 parent bff3e64 commit 4f02b16

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/aspire/utils/coor_trans.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ def crop_pad_2d(im, size, fill_value=0):
325325
elif size >= max(im_y, im_x):
326326
# ensure that we return in the same dtype as the input
327327
to_return = fill_value * np.ones((size, size), dtype=im.dtype)
328+
# when padding, start_x and start_y are negative since size is larger
329+
# than im_x and im_y; the below line calculates where the original image
330+
# is placed in relation to the (now-larger) box size
328331
to_return[-start_y : im_y - start_y, -start_x : im_x - start_x] = im
329332
return to_return
330333
else:

0 commit comments

Comments
 (0)