From 664e45f54308608666608dad4000cbf6f0687e94 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Ruel Date: Thu, 22 Aug 2024 08:30:58 -0400 Subject: [PATCH] docs: update the jupiter notebooks --- notebooks/pose_extimation_example.ipynb | 160 ++++++++++++------------ 1 file changed, 79 insertions(+), 81 deletions(-) diff --git a/notebooks/pose_extimation_example.ipynb b/notebooks/pose_extimation_example.ipynb index f2920a9..24ab4e9 100644 --- a/notebooks/pose_extimation_example.ipynb +++ b/notebooks/pose_extimation_example.ipynb @@ -1,66 +1,53 @@ { - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [] - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, "cells": [ { "cell_type": "code", - "source": [ - "# Copyright (c) Innoptech" - ], + "execution_count": null, "metadata": { "id": "ericuX_zTMmu" }, - "execution_count": null, - "outputs": [] + "outputs": [], + "source": [ + "# Copyright (c) Innoptech" + ] }, { "cell_type": "markdown", + "metadata": { + "id": "qP7Z5v82SqKM" + }, "source": [ "# **OpenFDCM: Fast Template Matching for Object Pose Estimation**\n", "\n", "### **Overview**\n", - "**OpenFDCM** (Fast Directional Chamfer Matching) is a high-performance, production-ready, fast template matching library designed to **enable object pose estimation**, particularly in industrial and manufacturing environments. This library excels at matching templates while remaining invariant to **translation** and **rotation** in the image plane.\n", - "\n", - "The library is very extensible. One could easily implement a CUDA module for example." - ], - "metadata": { - "id": "qP7Z5v82SqKM" - } + "**OpenFDCM** (Fast Directional Chamfer Matching) is a high-performance, production-ready, fast template matching library designed to **enable object pose estimation**, particularly in industrial and manufacturing environments. This library excels at matching templates while remaining invariant to **translation** and **rotation** in the image plane." + ] }, { "cell_type": "markdown", - "source": [ - "This Jupyter notebook focuses solely on documenting the fast template matching algorithms provided by OpenFDCM. For complete 6-DOF pose estimation, please refer to the repository's [README.md](https://github.com/Innoptech/OpenFDCM/blob/main/README.md). It is important to note that the output of OpenFDCM generates a comprehensive list of match candidates, which should be refined using the multiview techniques discussed." - ], "metadata": { "id": "SEANPaPYq1bx" - } + }, + "source": [ + "This Jupyter notebook focuses solely on documenting the fast template matching algorithms provided by OpenFDCM. For complete 6-DOF pose estimation, please refer to the repository's [README.md](https://github.com/Innoptech/OpenFDCM/blob/main/README.md). It is important to note that the output of OpenFDCM generates a comprehensive list of match candidates, which should be refined using the multiview techniques discussed." + ] }, { "cell_type": "markdown", + "metadata": { + "id": "Xz-qbxAxU87F" + }, "source": [ "\n", "\"Open\n", "" - ], - "metadata": { - "id": "Xz-qbxAxU87F" - } + ] }, { "cell_type": "markdown", + "metadata": { + "id": "dg-eqlAScYdS" + }, "source": [ "\n", "### Environment Set-up\n", @@ -69,21 +56,18 @@ "\n", "* If running from Google Colab, set using_colab=True below and run the cell.\n", "\n" - ], - "metadata": { - "id": "dg-eqlAScYdS" - } + ] }, { "cell_type": "code", - "source": [ - "using_colab = True" - ], + "execution_count": null, "metadata": { "id": "yvNJf9AldYcf" }, - "execution_count": null, - "outputs": [] + "outputs": [], + "source": [ + "using_colab = True" + ] }, { "cell_type": "code", @@ -104,15 +88,20 @@ }, { "cell_type": "markdown", - "source": [ - "### Set-up" - ], "metadata": { "id": "BRRooNI7XBHd" - } + }, + "source": [ + "### Set-up" + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Weudi63Cd7eE" + }, + "outputs": [], "source": [ "import time\n", "import cv2\n", @@ -121,15 +110,15 @@ "import matplotlib.pyplot as plt\n", "import openfdcm\n", "print(\"OpenFDCM version:\", openfdcm.__version__)" - ], - "metadata": { - "id": "Weudi63Cd7eE" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "KGKOy8-LW_fJ" + }, + "outputs": [], "source": [ "def apply_transform(template: np.ndarray, transform: np.ndarray):\n", " num_lines = template.shape[1]\n", @@ -161,15 +150,13 @@ "\n", "def find_files_recursive(directory, extension):\n", " return list(Path(directory).rglob(f\"*{extension}\"))" - ], - "metadata": { - "id": "KGKOy8-LW_fJ" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "markdown", + "metadata": { + "id": "Z_ykbvfVf7Bp" + }, "source": [ "### Templates sampling\n", "The template sampling consists in a fast OpenGL sythetic-rendered multiflash depth edge extraction. Further details can be seen in my master thesis (Ref to come).\n", @@ -179,37 +166,39 @@ "

\n", "\n", "For the sake of simplification, the templates have already been generated in this example." - ], - "metadata": { - "id": "Z_ykbvfVf7Bp" - } + ] }, { "cell_type": "markdown", + "metadata": { + "id": "UXA0Q0sRywyb" + }, "source": [ "### Template matching\n", "**Please note that Google Colab CPUs are quite slow.** \n", "**Also note that the shown matches should be refined using the multiview techniques discussed.**" - ], - "metadata": { - "id": "UXA0Q0sRywyb" - } + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "caD6EIBOy6K_" + }, + "outputs": [], "source": [ "from psutil import *\n", "# This line will return the CPU info\n", "!cat /proc/cpuinfo" - ], - "metadata": { - "id": "caD6EIBOy6K_" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "92OBUa4pgUX3" + }, + "outputs": [], "source": [ "for imagepth in find_files_recursive(\"./OpenFDCM/examples/assets\", \".jpg\"):\n", " scene_dir: Path = imagepth.parent\n", @@ -251,12 +240,21 @@ " if sorted_matches:\n", " best_matches = sorted_matches[:10]\n", " display_best_match(scene_image, best_matches, templates)" - ], - "metadata": { - "id": "92OBUa4pgUX3" - }, - "execution_count": null, - "outputs": [] + ] } - ] -} \ No newline at end of file + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +}