Creato con Colab
This commit is contained in:
+12
-15
@@ -368,33 +368,33 @@
|
||||
" [1, 0, 0],\n",
|
||||
" [0, cos(rx), -sin(rx)],\n",
|
||||
" [0, sin(rx), cos(rx)]\n",
|
||||
" ])\n",
|
||||
" ], dtype=np.float64)\n",
|
||||
"\n",
|
||||
" # Y-axis rotation\n",
|
||||
" rot_y = np.array([\n",
|
||||
" [cos(ry), 0, sin(ry)],\n",
|
||||
" [0, 1, 0],\n",
|
||||
" [-sin(ry), 0, cos(ry)]\n",
|
||||
" ])\n",
|
||||
" ], dtype=np.float64)\n",
|
||||
"\n",
|
||||
" # Z-axis rotation\n",
|
||||
" rot_z = np.array([\n",
|
||||
" [cos(rz), -sin(rz), 0],\n",
|
||||
" [sin(rz), cos(rz), 0],\n",
|
||||
" [0, 0, 1]\n",
|
||||
" ])\n",
|
||||
" ], dtype=np.float64)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" # Combined rotation matrix (Z-Y-X order)\n",
|
||||
" rotation_matrix = rot_z @ rot_y @ rot_x\n",
|
||||
"\n",
|
||||
" points[:,0:3] *= np.array(scale)\n",
|
||||
" points[:,0:3] = (points[:,0:3] * np.array(scale, dtype=np.float64)).astype(np.float64)\n",
|
||||
"\n",
|
||||
" # Apply rotation\n",
|
||||
" points[:,0:3] = points[:,0:3] @ rotation_matrix.T\n",
|
||||
" points[:,0:3] = (points[:,0:3] @ rotation_matrix.T).astype(np.float64)\n",
|
||||
"\n",
|
||||
" # Apply translation\n",
|
||||
" points[:,0:3] += np.array(translate)\n",
|
||||
" points[:,0:3] = (points[:,0:3] + np.array(translate, dtype=np.float64)).astype(np.float64)\n",
|
||||
"\n",
|
||||
" return points\n",
|
||||
"\n",
|
||||
@@ -684,8 +684,7 @@
|
||||
" return blurred"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "PoTzLauTQlHl",
|
||||
"cellView": "form"
|
||||
"id": "PoTzLauTQlHl"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
@@ -761,11 +760,10 @@
|
||||
"quality=2 #@param {\"type\" : \"integer\"}\n",
|
||||
"img = torch.from_numpy((np.array(image)))\n",
|
||||
"depth_map = torch.from_numpy(np.array(depth_img))\n",
|
||||
"points = from2Dto3D_vectorized_torch(depth_map, img, depth, quality)"
|
||||
"points = (from2Dto3D_vectorized_torch(depth_map, img, depth, quality)).cpu().numpy()"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "u9S_ulEFRmiI",
|
||||
"cellView": "form"
|
||||
"id": "u9S_ulEFRmiI"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
@@ -779,12 +777,11 @@
|
||||
"distance = 16#@param {\"type\" : \"number\"}\n",
|
||||
"\n",
|
||||
"points = transform_points(points, translate=(0, 0, 0), rotate=(0, 0, 0), scale=(1,1,2))\n",
|
||||
"points = torch.from_numpy(clean_points(points, k=k, m=distance))\n",
|
||||
"points = (clean_points(points, k=k, m=distance))\n",
|
||||
"points = transform_points(points, translate=(0, 0, 0), rotate=(0, 0, 0), scale=(1,1,0.5))"
|
||||
],
|
||||
"metadata": {
|
||||
"id": "gEjBciYYldPF",
|
||||
"cellView": "form"
|
||||
"id": "gEjBciYYldPF"
|
||||
},
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
@@ -967,4 +964,4 @@
|
||||
"outputs": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user