Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
SVivdich02 committed Jun 23, 2024
1 parent 7ee9c31 commit c6b778f
Showing 1 changed file with 64 additions and 63 deletions.
127 changes: 64 additions & 63 deletions geo_seg_success_sam_without_pca.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"2024-06-23 11:07:16.330 Python[772:9766839] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.\n"
"2024-06-23 12:19:02.844 Python[1858:9800516] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.\n"
]
}
],
Expand All @@ -39,39 +39,7 @@
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Finish: 0/4 x and 0/4 y\n",
"Finish: 0/4 x and 1/4 y\n",
"Finish: 0/4 x and 2/4 y\n",
"Finish: 0/4 x and 3/4 y\n",
"Finish: 0/4 x and 4/4 y\n",
"Finish: 1/4 x and 0/4 y\n",
"Finish: 1/4 x and 1/4 y\n",
"Finish: 1/4 x and 2/4 y\n",
"Finish: 1/4 x and 3/4 y\n",
"Finish: 1/4 x and 4/4 y\n",
"Finish: 2/4 x and 0/4 y\n",
"Finish: 2/4 x and 1/4 y\n",
"Finish: 2/4 x and 2/4 y\n",
"Finish: 2/4 x and 3/4 y\n",
"Finish: 2/4 x and 4/4 y\n",
"Finish: 3/4 x and 0/4 y\n",
"Finish: 3/4 x and 1/4 y\n",
"Finish: 3/4 x and 2/4 y\n",
"Finish: 3/4 x and 3/4 y\n",
"Finish: 3/4 x and 4/4 y\n",
"Finish: 4/4 x and 0/4 y\n",
"Finish: 4/4 x and 1/4 y\n",
"Finish: 4/4 x and 2/4 y\n",
"Finish: 4/4 x and 3/4 y\n",
"Finish: 4/4 x and 4/4 y\n"
]
}
],
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
Expand Down Expand Up @@ -113,23 +81,62 @@
" segments.append(dict)\n",
" print(\"Finish: {}/{} x and {}/{} y\".format(i, len(x_grid) - 1 - 1, j, len(y_grid) - 1 - 1))\n",
"\n",
" return segments\n",
"\n",
"segment_dicts = divide_pcd_into_square_segments(np.asarray(full_pcd.points), np.asarray(full_pcd.colors), num_segments=6)"
" return segments"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Finish: 0/4 x and 0/4 y\n",
"Finish: 0/4 x and 1/4 y\n",
"Finish: 0/4 x and 2/4 y\n",
"Finish: 0/4 x and 3/4 y\n",
"Finish: 0/4 x and 4/4 y\n",
"Finish: 1/4 x and 0/4 y\n",
"Finish: 1/4 x and 1/4 y\n",
"Finish: 1/4 x and 2/4 y\n",
"Finish: 1/4 x and 3/4 y\n",
"Finish: 1/4 x and 4/4 y\n",
"Finish: 2/4 x and 0/4 y\n",
"Finish: 2/4 x and 1/4 y\n",
"Finish: 2/4 x and 2/4 y\n",
"Finish: 2/4 x and 3/4 y\n",
"Finish: 2/4 x and 4/4 y\n",
"Finish: 3/4 x and 0/4 y\n",
"Finish: 3/4 x and 1/4 y\n",
"Finish: 3/4 x and 2/4 y\n",
"Finish: 3/4 x and 3/4 y\n",
"Finish: 3/4 x and 4/4 y\n",
"Finish: 4/4 x and 0/4 y\n",
"Finish: 4/4 x and 1/4 y\n",
"Finish: 4/4 x and 2/4 y\n",
"Finish: 4/4 x and 3/4 y\n",
"Finish: 4/4 x and 4/4 y\n"
]
}
],
"source": [
"segment_dicts = divide_pcd_into_square_segments(np.asarray(full_pcd.points), np.asarray(full_pcd.colors), num_segments=6)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4679809"
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -140,7 +147,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -149,13 +156,6 @@
"text": [
"\u001b[1;33m[Open3D WARNING] GLFW Error: Cocoa: Failed to find service port for display\u001b[0;m\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-06-23 11:29:43.752 Python[929:9775455] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.\n"
]
}
],
"source": [
Expand All @@ -167,7 +167,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -176,7 +176,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -193,7 +193,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -228,7 +228,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand All @@ -237,7 +237,7 @@
"PointCloud with 4679809 points."
]
},
"execution_count": 8,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -263,7 +263,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand All @@ -290,7 +290,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand All @@ -314,7 +314,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -331,7 +331,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -344,7 +344,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -353,11 +353,11 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"def get_points_to_pixels(points, img_shape):\n",
"def get_points_to_pixels(points, img_shape, camera):\n",
" img_width, img_height = img_shape\n",
"\n",
" intrinsic = np.asarray(\n",
Expand Down Expand Up @@ -390,7 +390,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 17,
"metadata": {},
"outputs": [
{
Expand All @@ -407,6 +407,7 @@
"points_to_pixels = get_points_to_pixels(\n",
" np.asarray(pcd_hidden_removal.points),\n",
" ((image_labels.shape[1], image_labels.shape[0])),\n",
" camera,\n",
")\n",
"\n",
"for point_id, pixel_id in points_to_pixels.items():\n",
Expand All @@ -417,7 +418,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -436,7 +437,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -455,7 +456,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -464,7 +465,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 23,
"metadata": {},
"outputs": [
{
Expand Down

0 comments on commit c6b778f

Please sign in to comment.