(angular_points, pano, scale=1, degrees=False, z_rotate=0, as_float=True)
| 582 | return image_x, image_y |
| 583 | |
| 584 | def angular_lookup(angular_points, pano, scale=1, degrees=False, z_rotate=0, as_float=True): |
| 585 | if degrees: |
| 586 | angular_points = np.deg2rad(angular_points) # degrees to radians |
| 587 | |
| 588 | image_height, image_width, _ = pano.shape |
| 589 | pano_RGB = cv2.cvtColor(pano, cv2.COLOR_BGR2RGB) |
| 590 | |
| 591 | if scale != 1: |
| 592 | image_height = int(image_height * scale) |
| 593 | image_width = int(image_height * 2) # spherical map aspect ratio is 2:1 |
| 594 | pano_RGB = cv2.resize(pano_RGB, (image_width, image_height), interpolation=cv2.INTER_AREA) |
| 595 | |
| 596 | image_x, image_y = get_sampling_coordinates(angular_points, (image_height, image_width), z_rotate=z_rotate) |
| 597 | colors = pano_RGB[image_y, image_x] |
| 598 | |
| 599 | if as_float: |
| 600 | colors = colors.astype(np.float32) / 255 |
| 601 | return colors |
| 602 | |
| 603 | |
| 604 | if __name__ == "__main__": |
no test coverage detected