{ "cells": [ { "cell_type": "markdown", "id": "0c5517fb", "metadata": {}, "source": [ "## import Blender.txt\n", "\n" ] }, { "cell_type": "code", "execution_count": 12, "id": "fd9f6425", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "100_13\n", "[[ 9.98290e-01 1.27898e-02 -5.70343e-02 8.50504e-01]\n", " [-2.31538e-02 9.82475e-01 -1.84952e-01 -8.78984e+00]\n", " [ 5.36693e-02 1.85956e-01 9.81091e-01 -6.32466e+01]\n", " [ 0.00000e+00 0.00000e+00 0.00000e+00 1.00000e+00]]\n", "\u001b[1;33m[Open3D WARNING] Read PLY failed: unable to read file: ./gt_filtered.ply\u001b[0;m\n", "\u001b[1;33m[Open3D WARNING] Read PLY failed: unable to read file: ./noisy_result/noisy_filtered_100_13.ply\u001b[0;m\n", "\u001b[1;33m[Open3D WARNING] Read PLY failed: unable to read file: ./noisy_result/noisy_filtered_100_13.ply\u001b[0;m\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "RPly: Unexpected end of file\n", "RPly: Error reading 'view_px' of 'camera' number 0\n", "RPly: Unexpected end of file\n", "RPly: Error reading 'view_px' of 'camera' number 0\n", "RPly: Unexpected end of file\n", "RPly: Error reading 'view_px' of 'camera' number 0\n" ] } ], "source": [ "import json\n", "import numpy as np\n", "import open3d as o3d\n", "\n", "\n", "def get_T(file_path):\n", " with open(file_path, 'r') as f:\n", " T_matrix = np.loadtxt(file_path)\n", " print(T_matrix)\n", " return T_matrix\n", " \n", "filenames = []\n", "with open(\"filename.txt\", \"r\") as f:\n", " for line in f:\n", " filenames.append(line.strip())\n", "\n", "\n", "filename = filenames[0]\n", "print(filename)\n", "\n", "with open(f\"./gt/noisy_filtered_{filename}.json\", 'r') as f:\n", " loaded_data = json.load(f)\n", "\n", "noisy_data = loaded_data[f'noisy_filtered_{filename}']\n", "T_matrix = noisy_data['matrix_world']\n", "\n", " \n", "infer_path = f\"./result3/result_{filename}.txt\"\n", "infer_T = get_T(infer_path)\n", "\n", "\n", "\n", "##Translated\n", "\n", "gt_path = \"./gt_filtered.ply\"\n", "noisy_path = f\"./noisy_result/noisy_filtered_{filename}.ply\"\n", "\n", "\n", "gt_pcd = o3d.io.read_point_cloud(gt_path)\n", "gt_pcd.paint_uniform_color([0,0,1])\n", "noisy_pcd = o3d.io.read_point_cloud(noisy_path)\n", "noisy_pcd.paint_uniform_color([1,0,0])\n", "infer_pcd = o3d.io.read_point_cloud(noisy_path)\n", "infer_pcd.paint_uniform_color([0,1,0])\n", "\n", "## move and check gt and noisy\n", "\n", "\n", "\n", "# infer_pcd.transform(infer_T)\n", "noisy_pcd.transform(T_matrix)\n", "\n", "\n", "o3d.visualization.draw_geometries([gt_pcd, noisy_pcd, infer_pcd])\n" ] }, { "cell_type": "code", "execution_count": null, "id": "fbf13a76", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "0509ac65", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "eccad9e9", "metadata": {}, "source": [ "## write GT\n" ] }, { "cell_type": "code", "execution_count": null, "id": "e0a339ca", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }