Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sarlinpe committed Feb 2, 2024
1 parent 3cd1490 commit 278ea0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions examples/test_BA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6cee46c7",
"id": "0e69461f-3619-41a5-b202-c6dc8e2fc778",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -104,7 +104,9 @@
" for im in rec.images.values():\n",
" cam = rec.cameras[im.camera_id]\n",
" for p in im.points2D:\n",
" cost = pyceres.factors.ReprojErrorCost(cam.model, im.cam_from_world, p.xy)\n",
" cost = pycolmap.cost_functions.ReprojErrorCost(\n",
" cam.model, im.cam_from_world, p.xy\n",
" )\n",
" prob.add_residual_block(\n",
" cost, loss, [rec.points3D[p.point3D_id].xyz, cam.params]\n",
" )\n",
Expand Down Expand Up @@ -185,7 +187,7 @@
" for im in rec.images.values():\n",
" cam = rec.cameras[im.camera_id]\n",
" for p in im.points2D:\n",
" cost = pyceres.factors.ReprojErrorCost(cam.model, p.xy)\n",
" cost = pycolmap.cost_functions.ReprojErrorCost(cam.model, p.xy)\n",
" pose = im.cam_from_world\n",
" params = [\n",
" pose.rotation.quat,\n",
Expand Down
8 changes: 4 additions & 4 deletions examples/test_PGO.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@
"loss = pyceres.TrivialLoss()\n",
"costs = []\n",
"for i in range(num):\n",
" cost = pyceres.factors.PoseGraphRelativeCost(i_from_j[i], np.eye(6))\n",
" cost = pycolmap.cost_functions.MetricRelativePoseErrorCost(i_from_j[i], np.eye(6))\n",
" costs.append(cost)\n",
" j = (i + 1) % num\n",
" params = [\n",
" i_from_w_opt[j].rotation.quat,\n",
" i_from_w_opt[j].translation,\n",
" i_from_w_opt[i].rotation.quat,\n",
" i_from_w_opt[i].translation,\n",
" i_from_w_opt[j].rotation.quat,\n",
" i_from_w_opt[j].translation,\n",
" ]\n",
" prob.add_residual_block(cost, loss, params)\n",
" prob.set_manifold(i_from_w_opt[i].rotation.quat, pyceres.EigenQuaternionManifold())\n",
Expand Down Expand Up @@ -129,7 +129,7 @@
"loss = pyceres.TrivialLoss()\n",
"costs = []\n",
"for i in range(num):\n",
" cost = pyceres.factors.PoseGraphAbsoluteCost(i_from_w[i], np.eye(6))\n",
" cost = pycolmap.cost_functions.AbsolutePoseErrorCost(i_from_w[i], np.eye(6))\n",
" costs.append(cost)\n",
" pose = i_from_w_opt[i]\n",
" prob.add_residual_block(cost, loss, [pose.rotation.quat, pose.translation])\n",
Expand Down

0 comments on commit 278ea0f

Please sign in to comment.