MCPcopy
hub / github.com/PiLiDAR/PiLiDAR / angular_lookup

Function angular_lookup

lib/pointcloud.py:584–601  ·  view source on GitHub ↗
(angular_points, pano, scale=1, degrees=False, z_rotate=0, as_float=True)

Source from the content-addressed store, hash-verified

582 return image_x, image_y
583
584def 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
604if __name__ == "__main__":

Callers 1

postprocess_3DFunction · 0.85

Calls 1

get_sampling_coordinatesFunction · 0.85

Tested by

no test coverage detected