{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "nbsphinx": "hidden" }, "outputs": [], "source": [ "import open3d as o3d\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import copy\n", "import os\n", "import sys\n", "\n", "# only needed for tutorial, monkey patches visualization\n", "sys.path.append('..')\n", "import open3d_tutorial as o3dtut\n", "# change to True if you want to interact with the visualization windows\n", "o3dtut.interactive = not \"CI\" in os.environ" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Point Cloud\n", "This tutorial demonstrates basic usage of a point cloud.\n", "\n", "## Visualize point cloud\n", "The first part of the tutorial reads a point cloud and visualizes it." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\"Load a ply point cloud, print it, and render it\")\n", "pcd = o3d.io.read_point_cloud(\"../../TestData/fragment.ply\")\n", "print(pcd)\n", "print(np.asarray(pcd.points))\n", "o3d.visualization.draw_geometries([pcd], zoom=0.3412, \n", " front=[0.4257, -0.2125, -0.8795],\n", " lookat=[2.6172, 2.0475, 1.532],\n", " up=[-0.0694, -0.9768, 0.2024])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`read_point_cloud` reads a point cloud from a file. It tries to decode the file based on the extension name. The supported extension names are: `pcd`, `ply`, `xyz`, `xyzrgb`, `xyzn`, `pts`.\n", "\n", "`draw_geometries` visualizes the point cloud. Use mouse/trackpad to see the geometry from different view point.\n", "\n", "It looks like a dense surface, but it is actually a point cloud rendered as surfels. The GUI supports various keyboard functions. One of them, the - key reduces the size of the points (surfels).\n", "\n", "