File size: 4,019 Bytes
5236ead
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{
 "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
}