create_pyramid
函数可用于创建图像的金字塔图像序列。
def create_pyramid(image: open3d.geometry.Image, levels: Optional[int] = None, scale: Optional[float] = None) -> List[open3d.geometry.Image]:
image
:输入的 Open3D 图像对象。levels
:(可选)金字塔的级数。 如果未提供,则根据图像分辨率自动计算。scale
:(可选)每个级别的图像大小相对于前一个级别的比例因子。 如果未提供,则默认为0.5
。pyramid
:一个 Open3D 图像对象列表,依次存储金字塔图像序列中的每个级别。import open3d
# Load the input image
image = open3d.io.read_image("input_image.png")
# Generate the pyramid image sequence with 4 levels and scale factor of 0.8
pyramid = open3d.geometry.Image.create_pyramid(image=image, levels=4, scale=0.8)
# Display the first and last image level of the pyramid sequence
open3d.visualization.draw_geometries([pyramid[0], pyramid[3]], window_name="Pyramid Sequence")
open3d.io.write_image
函数将创建的图像对象保存为图像文件。