Common methods for point cloud compression include sampling, geometric shape fitting, and the octree method. This topic describes how to compress point cloud data using the octree method.
Overview
A point cloud is a collection of many points. Storing point clouds consumes a large amount of memory and is not ideal for transmission. The available bandwidth is often insufficient to directly transmit uncompressed point clouds at the network layer. Therefore, point clouds must be compressed. The point cloud compression feature of Intelligent Media Management (IMM) analyzes and processes the spatiotemporal information of point cloud data. This significantly reduces the data volume and storage costs, providing a high-quality, real-time encoding and decoding solution for point cloud data.
Scenarios
Point cloud compression can be used in the following scenarios.
Scenario | Description |
Autonomous driving | Compresses point cloud data generated by radar scans in autonomous driving scenarios. |
Digital cultural heritage | Provides a compression solution for point cloud information of cultural relics in digital heritage scenarios. |
Smart city | Effectively compresses point cloud information from 3D city reconstruction to enable smooth data rendering and display. |
Mixed reality | Provides real-time encoding and decoding capabilities for point cloud data in mixed reality scenarios. |
Prerequisites
An AccessKey pair is created and obtained. For more information, see Create an AccessKey pair.
OSS is activated, a bucket is created, and objects are uploaded to the bucket. For more information, see Upload objects.
IMM is activated. For more information, see Activate IMM.
A project is created in the IMM console. For more information about how to create a project by using the IMM console, see Create a project.
NoteYou can also call the CreateProject operation to create a project. For more information, see CreateProject.
You can call the ListProjects operation to query existing projects in a specific region. For more information, see ListProjects.
Procedure
Call the CreateCompressPointCloudTask operation to compress point cloud data.
The task information is retained for seven days after the task starts. Task information cannot be obtained after the seven-day window ends. You can use one of the following methods to query task information:
In the region in which the IMM project is located, configure a Simple Message Queue (SMQ) subscription to receive task information notifications.. For more information, see Asynchronous message examples. For information about the MNS SDK, see Step 4: Receive and delete the message.
In the region in which the IMM project is located, create an ApsaraMQ for RocketMQ 4.0 instance, a topic, and a group to receive task notifications. For more information, see Asynchronous message examples. For information about how to use ApsaraMQ for RocketMQ, see Use HTTP client SDKs to send and subscribe to normal messages.
In the region in which the IMM project is located, use EventBridge to receive task information notifications. For more information, see IMM events.
Compression information
Project name: test-project
OSS URI of the point cloud file: oss://test-bucket/test-object.pcd
Compression algorithm: Octree
OSS URI of the output file: oss://test-bucket/test-target-object
Compression algorithm overview
Octree is a common compression algorithm that is mainly used for the compression and representation of 3D data. It divides a 3D space into a series of equally sized cubes. Each cube is divided into eight sub-cubes, which can be further divided into smaller sub-cubes, and so on.
By storing only the nodes that contain valid data, the octree method can significantly reduce storage space. It is often used for the compression and representation of 3D data, such as point cloud data and volumetric data. By selecting appropriate division and merging strategies, you can reduce storage and transmission overhead while maintaining data precision.
Request example
{
"ProjectName": "test-project",
"SourceURI": "oss://test-bucket/test-object.pcd",
"UserData": "{\"ID\":\"testuid\",\"Name\": \"test-user\",\"Avatar\": \"http://test.com/testuid\"}",
"TargetURI": "oss://test-bucket/test-target-object",
"PointCloudFileFormat": "pcd",
"CompressMethod": "octree",
"PointCloudFields": "[\"xyz\"]",
"OctreeOption": "{\"PointResolution\": 0.001, \"OctreeResolution\": 0.01, \"DoVoxelGridDownDownSampling\": false, \"LibraryName\": \"pcl\"}",
"KdtreeOption": "{\"CompressionLevel\": 8, \"QuantizationBits\": 10, \"LibraryName\": \"draco\"}"
}Response example
{
"TaskId": "PointCloudCompress-091d9b4a-8726-47bf-b699-d24c7daff63c",
"RequestId": "8B0EEA2E-35FE-500F-BCDB-E2E7CA11DF7A",
"EventId": "180-1S7Q8gHbVXJf2lekgesKvlNM1VR"
}Sample code
The following sample code shows how to compress a point cloud using the Python SDK.
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import os
import sys
from typing import List
from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient
class Sample:
def __init__(self):
pass
@staticmethod
def create_client(
access_key_id: str,
access_key_secret: str,
) -> imm20200930Client:
"""
Initializes a client using an AccessKey ID and an AccessKey secret.
@param access_key_id:
@param access_key_secret:
@return: Client
@throws Exception
"""
config = open_api_models.Config(
access_key_id=access_key_id,
access_key_secret=access_key_secret
)
# Specify the endpoint of IMM.
config.endpoint = f'imm.cn-beijing.aliyuncs.com'
return imm20200930Client(config)
@staticmethod
def main(
args: List[str],
) -> None:
# An Alibaba Cloud account AccessKey has permissions to call all API operations. We recommend that you use a Resource Access Management (RAM) user to call API operations or perform routine O&M.
# We strongly recommend that you do not save your AccessKey ID and AccessKey secret in your project code. This may cause an AccessKey leak and threaten the security of all resources in your account.
# This example shows how to obtain an AccessKey from an environment variable for identity verification when you call an API operation.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
octree_option = imm_20200930_models.OctreeOption(
point_resolution=0.001,
octree_resolution=0.01,
do_voxel_grid_down_down_sampling=False,
library_name='pcl'
)
create_compress_point_cloud_task_request = imm_20200930_models.CreateCompressPointCloudTaskRequest(
source_uri='oss://test-bucket/test-object.pcd',
target_uri='oss://test-bucket/test-target-object',
point_cloud_file_format='pcd',
compress_method='octree',
point_cloud_fields=[
'[\"xyz\"]'
],
project_name='test-project',
octree_option=octree_option
)
runtime = util_models.RuntimeOptions()
try:
# If you copy the code to run it, print the return value of the API operation.
client.create_compress_point_cloud_task_with_options(create_compress_point_cloud_task_request, runtime)
except Exception as error:
# If an error occurs, print the error message.
UtilClient.assert_as_string(error.message)
@staticmethod
async def main_async(
args: List[str],
) -> None:
# An Alibaba Cloud account AccessKey has permissions to call all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M.
# We strongly recommend that you do not save your AccessKey ID and AccessKey secret in your project code. This may cause an AccessKey leak and threaten the security of all resources in your account.
# This example shows how to obtain an AccessKey from an environment variable for identity verification when you call an API operation.
imm_access_key_id = os.getenv("AccessKeyId")
imm_access_key_secret = os.getenv("AccessKeySecret")
client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
octree_option = imm_20200930_models.OctreeOption(
point_resolution=0.001,
octree_resolution=0.01,
do_voxel_grid_down_down_sampling=False,
library_name='pcl'
)
create_compress_point_cloud_task_request = imm_20200930_models.CreateCompressPointCloudTaskRequest(
source_uri='oss://test-bucket/test-object.pcd',
target_uri='oss://test-bucket/test-target-object',
point_cloud_file_format='pcd',
compress_method='octree',
point_cloud_fields=[
'[\"xyz\"]'
],
project_name='test-project',
octree_option=octree_option
)
runtime = util_models.RuntimeOptions()
try:
# If you copy the code to run it, print the return value of the API operation.
await client.create_compress_point_cloud_task_with_options_async(create_compress_point_cloud_task_request, runtime)
except Exception as error:
# If an error occurs, print the error message.
UtilClient.assert_as_string(error.message)
if __name__ == '__main__':
Sample.main(sys.argv[1:])
Billing
During point cloud compression, the following billable items are generated for OSS and IMM:
For OSS: For detailed pricing, see OSS Pricing.
API
Billable item
Description
GetObject
GET requests
Fees are calculated based on the number of successful requests.
Outbound traffic over the internet
If you call the GetObject operation using a public endpoint (for example, oss-cn-hangzhou.aliyuncs.com) or an acceleration endpoint (for example, oss-accelerate.aliyuncs.com), fees are charged for outbound traffic over the internet. These fees are based on the data volume.
Volume of retrieved Infrequent Access data
If the retrieved data is Infrequent Access data, fees are charged for the volume of retrieved Infrequent Access data. These fees are based on the volume of retrieved data.
Volume of data retrieved using real-time access of Archive objects
If you read an Archive object from a bucket for which real-time access of Archive objects is enabled, fees are charged for the volume of data retrieved. These fees are based on the volume of retrieved data.
Transfer acceleration
If you enable transfer acceleration and use an acceleration endpoint to access your bucket, fees are charged for transfer acceleration. These fees are based on the data volume.
For IMM: For detailed pricing, see IMM billable items.
ImportantStarting from 11:00 on July 28, 2025 (UTC+8), the point cloud compression feature of IMM will become a paid service. For more information, see IMM Billing Adjustment Announcement.
API
Billable item
Description
CreateCompressPointCloudTask
PointCloudCompress
Fees are calculated based on the number of successful requests.