MCPcopy Create free account
hub / github.com/TARTRL/Deepfake_Detection / padding_image

Function padding_image

dfd/params.py:58–68  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

56
57
58def padding_image(image):
59 height_o, width_o = image.shape[0:2]
60 if height_o == image_max_height and width_o == image_max_width:
61 return image
62 h_pad_len_top = int((image_max_height - height_o) / 2)
63 h_pad_len_bottom = image_max_height - height_o - h_pad_len_top
64 w_pad_len_left = int((image_max_width - width_o) / 2)
65 h_pad_len_right = image_max_width - width_o - w_pad_len_left
66
67 return np.pad(image, ((h_pad_len_top, h_pad_len_bottom), (w_pad_len_left, h_pad_len_right), (0, 0)), 'constant',
68 constant_values=0)

Callers 1

test_imgFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_imgFunction · 0.72