Skip to content

Commit 42ab507

Browse files
Update notebook.
1 parent 13b7006 commit 42ab507

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

debug.ipynb

+17-14
Original file line numberDiff line numberDiff line change
@@ -7305,27 +7305,30 @@
73057305
"\n",
73067306
"\n",
73077307
"def calc_hand_data(iv):\n",
7308-
" origin = to_vec(calculate_origin(iv.hmap[0][..., 9]))\n",
7308+
" origin = to_vec(calc_origin(iv.hmap[0][..., 9]))\n",
73097309
"# origin = to_vec([iv.uv[9][1] / 32, 1 - (iv.uv[9][0]) / 32])\n",
73107310
" \n",
73117311
"# UV instead of XY\n",
73127312
"# joints = list([to_vec([*(uv[::-1]/32), xyz[2]]) for xyz, uv in zip(iv.xyz, iv.uv)])\n",
73137313
"# joints = list([to_vec([*(uv[::-1]/32), xyz[2]]) for xyz, uv in zip(iv.xyz, xy)])\n",
73147314
" \n",
73157315
" joints = list([to_vec(xyz) for xyz in iv.xyz.tolist()]) # tolist, because 0mq can't work with np.float\n",
7316-
" \n",
7317-
" dists_x = np.array([32 *\n",
7318-
" np.linalg.norm(iv.xyz[i[1:], :2] - iv.xyz[i[:-1], :2]) /\n",
7319-
" np.linalg.norm(iv.uv[i[1:]] - iv.uv[i[:-1]])\n",
7320-
" for i in indexes_x])\n",
73217316
"\n",
7322-
" dists_y = np.array([32 * \n",
7323-
" np.linalg.norm(iv.xyz[i[1:], :2] - iv.xyz[i[:-1], :2]) /\n",
7324-
" np.linalg.norm(iv.uv[i[1:]] - iv.uv[i[:-1]])\n",
7325-
" for i in indexes_y])\n",
7317+
" def calc_dists(indexes):\n",
7318+
" return np.array([\n",
7319+
" np.linalg.norm(iv.xyz[i[1:], :2] - iv.xyz[i[:-1], :2]) * 32 /\n",
7320+
" np.linalg.norm(iv.uv[i[1:]] - iv.uv[i[:-1]])\n",
7321+
" for i in indexes\n",
7322+
" ])\n",
7323+
"\n",
7324+
" dists_x = filter_nan_inf(calc_dists(indexes_x))\n",
7325+
" dists_y = filter_nan_inf(calc_dists(indexes_y))\n",
7326+
"\n",
7327+
" if dists_x.size == 0 or dists_y.size == 0:\n",
7328+
" return None\n",
73267329
"\n",
7327-
" dist_x = np.mean(filter_nan_inf(dists_x))\n",
7328-
" dist_y = np.mean(filter_nan_inf(dists_y))\n",
7330+
" dist_x = np.mean(dists_x)\n",
7331+
" dist_y = np.mean(dists_y)\n",
73297332
" \n",
73307333
"# palm_size = sum(np.linalg.norm(iv.xyz[0] - iv.xyz[i]) for i in [1, 5, 9, 13, 17])\n",
73317334
" \n",
@@ -7336,8 +7339,8 @@
73367339
" return origin, joints, dist_x, dist_y, vert\n",
73377340
"\n",
73387341
"\n",
7339-
"data_originL, data_jointsL, data_distXL, data_distYL, data_palmSizeL, data_vertL = calc_hand_data(ivl)\n",
7340-
"data_originR, data_jointsR, data_distXR, data_distYR, data_palmSizeR, data_vertR = calc_hand_data(ivr)\n",
7342+
"data_originL, data_jointsL, data_distXL, data_distYL, data_vertL = calc_hand_data(ivl)\n",
7343+
"data_originR, data_jointsR, data_distXR, data_distYR, data_vertR = calc_hand_data(ivr)\n",
73417344
"\n",
73427345
"scaleXL = data_vertL * data_distXL + (1 - data_vertL) * data_distYL\n",
73437346
"scaleYL = data_vertL * data_distYL + (1 - data_vertL) * data_distXL\n",

0 commit comments

Comments
 (0)