MCPcopy Create free account
hub / github.com/Francis-Rings/FlashPortrait / resize_frame

Function resize_frame

wan/data/utils.py:127–141  ·  view source on GitHub ↗
(frame, target_short_side)

Source from the content-addressed store, hash-verified

125 return frames
126
127def resize_frame(frame, target_short_side):
128 h, w, _ = frame.shape
129 if h < w:
130 if target_short_side > h:
131 return frame
132 new_h = target_short_side
133 new_w = int(target_short_side * w / h)
134 else:
135 if target_short_side > w:
136 return frame
137 new_w = target_short_side
138 new_h = int(target_short_side * h / w)
139
140 resized_frame = cv2.resize(frame, (new_w, new_h))
141 return resized_frame
142
143def padding_image(images, new_width, new_height):
144 new_image = Image.new('RGB', (new_width, new_height), (255, 255, 255))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected