{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "nbsphinx": "hidden" }, "outputs": [], "source": [ "import open3d as o3d\n", "import numpy as np\n", "import copy\n", "import os\n", "import sys\n", "\n", "# monkey patches visualization and provides helpers to load geometries\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": [ "# ICP Registration\n", "This tutorial demonstrates the ICP (Iterative Closest Point) registration algorithm. It has been a mainstay of geometric registration in both research and industry for many years. The input are two point clouds and an initial transformation that roughly aligns the source point cloud to the target point cloud. The output is a refined transformation that tightly aligns the two point clouds. A helper function draw_registration_result visualizes the alignment during the registration process. In this tutorial, we show two ICP variants, the point-to-point ICP and the point-to-plane ICP [Rusinkiewicz2001]_." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Helper visualization function\n", "The function below visualizes a target point cloud, and a source point cloud transformed with an alignment transformation. The target point cloud and the source point cloud are painted with cyan and yellow colors respectively. The more and tighter the two point clouds overlap with each other, the better the alignment result is." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def draw_registration_result(source, target, transformation):\n", " source_temp = copy.deepcopy(source)\n", " target_temp = copy.deepcopy(target)\n", " source_temp.paint_uniform_color([1, 0.706, 0])\n", " target_temp.paint_uniform_color([0, 0.651, 0.929])\n", " source_temp.transform(transformation)\n", " o3d.visualization.draw_geometries([source_temp, target_temp], \n", " zoom=0.4459,\n", " front=[0.9288, -0.2951, -0.2242],\n", " lookat=[1.6784, 2.0612, 1.4451],\n", " up=[-0.3402, -0.9189, -0.1996])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "