MCPcopy
hub / github.com/CiaraStrawberry/TemporalKit / resize_image

Function resize_image

scripts/optical_flow_simple.py:17–27  ·  view source on GitHub ↗
(image, max_dimension)

Source from the content-addressed store, hash-verified

15 cv2.imwrite(file_path, image)
16
17def resize_image(image, max_dimension):
18 h, w = image.shape[:2]
19 aspect_ratio = float(w) / float(h)
20 if h > w:
21 new_height = max_dimension
22 new_width = int(new_height * aspect_ratio)
23 else:
24 new_width = max_dimension
25 new_height = int(new_width / aspect_ratio)
26 resized_image = cv2.resize(image, (new_width, new_height), interpolation=cv2.INTER_LINEAR)
27 return resized_image
28
29def flow_to_color(flow, max_flow=None):
30 hsv = np.zeros((flow.shape[0], flow.shape[1], 3), dtype=np.float32)

Callers 3

process_image_basicFunction · 0.70
process_imageFunction · 0.70
process_imagesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected