(source_img, scale_factor=1.0, output_stride=16)
| 14 | |
| 15 | |
| 16 | def _process_input(source_img, scale_factor=1.0, output_stride=16): |
| 17 | target_width, target_height = valid_resolution( |
| 18 | source_img.shape[1] * scale_factor, source_img.shape[0] * scale_factor, output_stride=output_stride) |
| 19 | scale = np.array([source_img.shape[0] / target_height, source_img.shape[1] / target_width]) |
| 20 | |
| 21 | input_img = cv2.resize(source_img, (target_width, target_height), interpolation=cv2.INTER_LINEAR) |
| 22 | input_img = cv2.cvtColor(input_img, cv2.COLOR_BGR2RGB).astype(np.float32) |
| 23 | input_img = input_img * (2.0 / 255.0) - 1.0 |
| 24 | input_img = input_img.reshape(1, target_height, target_width, 3) |
| 25 | return input_img, source_img, scale |
| 26 | |
| 27 | |
| 28 | def read_cap(img, scale_factor=1.0, output_stride=16): |
no test coverage detected