colorize¶
occulus.colorize
¶
RGB colorization — drape orthoimagery onto point clouds.
Assigns RGB values to each point by sampling a georeferenced raster (orthoimage, satellite image, or classification map) at each point's XY position. Handles CRS mismatches transparently via pyproj.
colorize_from_array(cloud, image, transform, *, nodata_color=(0, 0, 0))
¶
Assign RGB to points by sampling a raster array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
Input point cloud. |
required |
image
|
NDArray[uint8]
|
RGB image array, shape (H, W, 3). |
required |
transform
|
tuple of 6 floats
|
Affine geotransform (x_origin, x_res, x_skew, y_origin, y_skew, y_res). Same convention as GDAL/rasterio. |
required |
nodata_color
|
tuple[int, int, int]
|
RGB value for points outside the image extent. |
(0, 0, 0)
|
Returns:
| Type | Description |
|---|---|
PointCloud
|
Cloud with |
Raises:
| Type | Description |
|---|---|
OcculusValidationError
|
If image shape or transform is invalid. |
Source code in src/occulus/colorize/__init__.py
colorize_from_raster(cloud, image_path, *, band_order=(1, 2, 3), nodata_color=(0, 0, 0))
¶
Assign RGB to points by sampling a georeferenced raster file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
Input point cloud. |
required |
image_path
|
str or Path
|
Path to a GeoTIFF or other rasterio-readable image. |
required |
band_order
|
tuple[int, int, int]
|
1-based band indices for R, G, B channels. |
(1, 2, 3)
|
nodata_color
|
tuple[int, int, int]
|
RGB value for points outside the image or on nodata pixels. |
(0, 0, 0)
|
Returns:
| Type | Description |
|---|---|
PointCloud
|
Cloud with |
Raises:
| Type | Description |
|---|---|
OcculusValidationError
|
If the raster cannot be read or has insufficient bands. |