Update execution counts in find_cute_box_with_image.ipynb and adjust coordinate transformations for OpenGL to Blender compatibility.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 77,
|
||||
"execution_count": 117,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -29,7 +29,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 78,
|
||||
"execution_count": 118,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -42,7 +42,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 79,
|
||||
"execution_count": 119,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -54,7 +54,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 80,
|
||||
"execution_count": 120,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -66,7 +66,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 81,
|
||||
"execution_count": 121,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -88,7 +88,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 82,
|
||||
"execution_count": 122,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -121,7 +121,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 83,
|
||||
"execution_count": 123,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -192,7 +192,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 86,
|
||||
"execution_count": 126,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -298,16 +298,13 @@
|
||||
"id_to_3d_coords = {marker.id: marker_to_3d_coords(marker, m) for marker in output_markers}\n",
|
||||
"# note that the glb is Y up\n",
|
||||
"# when visualizing with matplotlib, it's Z up\n",
|
||||
"# GLTF → Blender: (X, Y, Z) → (X, -Z, Y)\n",
|
||||
"OPEN_GL_TO_BLENDER = np.array([[1, 0, 0], [0, 0, -1], [0, 1, 0]])\n",
|
||||
"# Blender → GLTF: (X, Y, Z) → (X, Z, -Y)\n",
|
||||
"BLENDER_TO_OPEN_GL = np.array([[1, 0, 0], [0, 0, 1], [0, -1, 0]])\n",
|
||||
"display(np.linalg.inv(OPEN_GL_TO_BLENDER)) # should be the same"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 93,
|
||||
"execution_count": 131,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -370,10 +367,10 @@
|
||||
" assert face is not None\n",
|
||||
" color = face.color\n",
|
||||
" for i in range(4):\n",
|
||||
" p1 = corners[i]\n",
|
||||
" p2 = corners[(i + 1) % 4]\n",
|
||||
" p1 = OPEN_GL_TO_BLENDER @ corners[i]\n",
|
||||
" p2 = OPEN_GL_TO_BLENDER @ corners[(i + 1) % 4]\n",
|
||||
" ax.plot(*zip(p1, p2), color=color)\n",
|
||||
" center = corners.mean(axis=0)\n",
|
||||
" center = OPEN_GL_TO_BLENDER @ corners.mean(axis=0)\n",
|
||||
" ax.scatter(*center, color=color)\n",
|
||||
" ax.text(*center, str(tag_id), fontsize=9, color=\"black\") # type: ignore\n",
|
||||
"\n",
|
||||
|
||||
Reference in New Issue
Block a user