clear
函数用于清空图像对象所存储的数据。
image.clear()
无
无
import open3d as o3d
import numpy as np
# 创建一个空的图像对象
img = o3d.geometry.Image()
# 将其填充为2x2的彩色图像
img.preallocate_image(2, 2, 3)
img.data = np.array([[255, 0, 0], [0, 255, 0], [0, 0, 255], [255, 255, 255]], dtype=np.uint8)
# 清空图像
img.clear()
# 输出清空后的图像数据
print(img.data)
输出:
[]
preallocate_image
或load_from_file
等方法为图像重新分配大小和数据。无