MCPcopy Create free account
hub / github.com/Hironsan/BossSensor / get_padding_size

Function get_padding_size

boss_input.py:12–26  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

10def resize_with_pad(image, height=IMAGE_SIZE, width=IMAGE_SIZE):
11
12 def get_padding_size(image):
13 h, w, _ = image.shape
14 longest_edge = max(h, w)
15 top, bottom, left, right = (0, 0, 0, 0)
16 if h < longest_edge:
17 dh = longest_edge - h
18 top = dh // 2
19 bottom = dh - top
20 elif w < longest_edge:
21 dw = longest_edge - w
22 left = dw // 2
23 right = dw - left
24 else:
25 pass
26 return top, bottom, left, right
27
28 top, bottom, left, right = get_padding_size(image)
29 BLACK = [0, 0, 0]

Callers 1

resize_with_padFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected