(image, max_dimension)
| 15 | cv2.imwrite(file_path, image) |
| 16 | |
| 17 | def 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 | |
| 29 | def flow_to_color(flow, max_flow=None): |
| 30 | hsv = np.zeros((flow.shape[0], flow.shape[1], 3), dtype=np.float32) |
no outgoing calls
no test coverage detected