(input, range_low=-1, range_high=1, vis_height=-1, vis_width=-1, to_rgb=True)
| 18 | |
| 19 | |
| 20 | def get_vis_data(input, range_low=-1, range_high=1, vis_height=-1, vis_width=-1, to_rgb=True): |
| 21 | if input is None: |
| 22 | return None |
| 23 | |
| 24 | data = ((input.permute(1, 2, 0) - range_low) / ( |
| 25 | range_high - range_low) * 255.0).data.cpu().numpy() |
| 26 | if vis_height > 0 and vis_width > 0: |
| 27 | if data.shape[0] != vis_height or data.shape[1] != vis_width: |
| 28 | data = cv2.resize(data, (vis_width, vis_height)) |
| 29 | if len(data.shape) == 2: |
| 30 | data = cv2.cvtColor(data, cv2.COLOR_GRAY2RGB) |
| 31 | else: |
| 32 | if to_rgb: |
| 33 | data = cv2.cvtColor(data, cv2.COLOR_BGR2RGB) |
| 34 | return data |
| 35 | |
| 36 | |
| 37 | def vis_one_from_batch(vis_list, range_low=0, range_high=1, |
no test coverage detected