2023-12-06 09:21:43 +00:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-01-23 14:54:09 +00:00
|
|
|
"execution_count": 2,
|
2023-12-06 09:21:43 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"import cv2\n",
|
|
|
|
"import numpy as np\n",
|
|
|
|
"from PIL import Image\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
|
"from pathlib import Path"
|
2023-12-06 09:21:43 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-01-23 14:54:09 +00:00
|
|
|
"execution_count": 3,
|
2023-12-06 09:21:43 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2024-01-23 14:54:09 +00:00
|
|
|
"img_src = \"../DATASETS/hof/webcam20231103-2.png\""
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 4,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"img_path = Path(img_src)\n",
|
|
|
|
"output_path = img_path.with_stem(img_path.stem + '-homography').with_suffix('.txt')\n",
|
|
|
|
"\n"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"# Setup"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 5,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"from os import PathLike\n",
|
|
|
|
"\n",
|
|
|
|
"def render_projection(src, dst, img: PathLike, points = []):\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
" x_min = min(dst[:,0])\n",
|
|
|
|
" if x_min < 0:\n",
|
|
|
|
" dst[:,0] += x_min * -1\n",
|
|
|
|
" y_min = min(dst[:,1])\n",
|
|
|
|
" if y_min < 0:\n",
|
|
|
|
" dst[:,1] += y_min * -1\n",
|
|
|
|
"\n",
|
|
|
|
" dst[:,0] += 1500\n",
|
|
|
|
" dst[:,1] += 600\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
" # print(\"from\", src)\n",
|
|
|
|
" # print(\"to\", dst)\n",
|
|
|
|
"\n",
|
|
|
|
" H, status = cv2.findHomography(src,dst)\n",
|
|
|
|
" f, axes = plt.subplots(1, 2, figsize=(16,8))\n",
|
|
|
|
"\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
" img = cv2.imread(str(img))\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
" img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n",
|
|
|
|
"\n",
|
|
|
|
" for i, p in enumerate(src):\n",
|
|
|
|
" cv2.circle(img, p, 3, (0,255,0), 0)\n",
|
|
|
|
" cv2.putText(img, str(i), p, cv2.FONT_HERSHEY_COMPLEX, .5, (0,255,0))\n",
|
|
|
|
"\n",
|
|
|
|
" # print (H)\n",
|
|
|
|
" dst = cv2.warpPerspective(img,H,(2500,1920))\n",
|
|
|
|
" axes[0].imshow(img)\n",
|
|
|
|
" axes[1].imshow(dst)\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"\n",
|
|
|
|
" def onclick(event):\n",
|
|
|
|
" points.append([event.xdata,event.ydata])\n",
|
|
|
|
" f.canvas.mpl_connect('button_press_event', onclick)\n",
|
|
|
|
"\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
" plt.tight_layout()\n",
|
|
|
|
" plt.show()\n",
|
|
|
|
" # display(Image.fromarray(img).resize((600,600)), Image.fromarray(dst).resize((600,600)))\n",
|
|
|
|
" return H"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2024-01-23 14:54:09 +00:00
|
|
|
"cell_type": "mark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+OONeRM9vnGoCciQImrnQ+8G5/YL3esMbgvMf2PV0IYB3BB0I/gvfIciUZFZSicVjv6MKA7UaM1bXuJOPoGKxFRFiWjPWBsR8x46jPw5zxeaFzHpchGRAcbtdjD0d8N2CMw6aJdY16vzmnv5+G3f2++0egCRsNDQ0NDQ0NDQ0
|
2023-12-06 09:21:43 +00:00
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 1600x800 with 2 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
2024-01-23 14:54:09 +00:00
|
|
|
"array([[ 1.71375783e+00, 2.33423256e+00, -2.69179279e+02],\n",
|
|
|
|
" [-4.74127516e-01, 5.72635471e+00, 3.04878642e+02],\n",
|
|
|
|
" [-2.89572527e-04, 1.97232411e-03, 1.00000000e+00]])"
|
2023-12-06 09:21:43 +00:00
|
|
|
]
|
|
|
|
},
|
2024-01-23 14:54:09 +00:00
|
|
|
"execution_count": 6,
|
2023-12-06 09:21:43 +00:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"\n",
|
|
|
|
"src = np.array([[924, 341],\n",
|
|
|
|
" [988, 343],\n",
|
|
|
|
" [908,125],\n",
|
|
|
|
" [941, 404],])\n",
|
|
|
|
"\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"dst = np.array([[2,0],\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
"[100,0],\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"[105, -695],\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
"[0, 130]])\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"render_projection(src, dst, img_path)\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
"# cv2.imwrite(\"/tmp/test.j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SZi2gAF54RSMt55ctbz70IkWYeAx1FEKC27IoAEs6hyq7BrQDQUW6QQgueD997j4myHE2n2VuI8h/0Nx8OBfc785Kc/5dWrlwQPYxj
|
2023-12-06 09:21:43 +00:00
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 1600x800 with 2 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
},
|
|
|
|
{
|
2024-01-23 14:54:09 +00:00
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"[[ 2.21499129e+00 2.34352815e+00 8.78577725e+01]\n",
|
|
|
|
" [-5.43898062e-02 4.67568137e+00 9.00976942e+01]\n",
|
|
|
|
" [-4.62400661e-05 1.56718752e-03 1.00000000e+00]]\n"
|
|
|
|
]
|
2023-12-06 09:21:43 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"\n",
|
|
|
|
"src = np.array([[924, 341],\n",
|
|
|
|
" [988, 343],\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
" [810, 330],\n",
|
|
|
|
" [620, 325],\n",
|
|
|
|
" [908,143],\n",
|
|
|
|
" [1072,616],\n",
|
|
|
|
" [941, 404],\n",
|
|
|
|
" \n",
|
|
|
|
" ])\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
"\n",
|
|
|
|
"dst = np.array([[0,0],\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"[97,0],\n",
|
|
|
|
"[-160,-33],\n",
|
|
|
|
"[-460,-33],\n",
|
|
|
|
"[105, -500],\n",
|
|
|
|
"[87, 420],\n",
|
|
|
|
"[-2, 112]\n",
|
|
|
|
"])\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
"\n",
|
|
|
|
"\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"H = render_projection(src, dst, img_path)\n",
|
|
|
|
"print(H)\n",
|
|
|
|
"# np.savetxt(output_path, H, delim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wg2Bw3Ri2Og2vcDGOfw8sxkDIYCII2VhfzyxwXPx6C2G7TnOD2zGyNYLSSZi2gAF54RSMt55ctbz70IkWYeAx1FEKC27IoAEs6hyq7BrQDQUW6QQgueD997j4myHE2n2VuI8h/0Nx8OBfc785Kc/5dWrlwQPYxj
|
2023-12-06 09:21:43 +00:00
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 1600x800 with 2 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
},
|
|
|
|
{
|
2024-01-23 14:54:09 +00:00
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"[[ 2.21499129e+00 2.34352815e+00 8.78577725e+01]\n",
|
|
|
|
" [-5.43898062e-02 4.67568137e+00 9.00976942e+01]\n",
|
|
|
|
" [-4.62400661e-05 1.56718752e-03 1.00000000e+00]]\n"
|
|
|
|
]
|
2023-12-06 09:21:43 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"\n",
|
|
|
|
"src = np.array([[924, 341],\n",
|
|
|
|
" [988, 343],\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
" [810, 330],\n",
|
|
|
|
" [620, 325],\n",
|
|
|
|
" [908,143],\n",
|
|
|
|
" [1072,616],\n",
|
|
|
|
" [941, 404],\n",
|
|
|
|
" \n",
|
|
|
|
" ])\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
"\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"dst = np.array([[0,0],\n",
|
|
|
|
"[97,0],\n",
|
|
|
|
"[-160,-33],\n",
|
|
|
|
"[-460,-33],\n",
|
|
|
|
"[105, -500],\n",
|
|
|
|
"[87, 420],\n",
|
|
|
|
"[-2, 112]\n",
|
|
|
|
"])\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
"\n",
|
|
|
|
"\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"H = render_projection(src, dst, img_path)\n",
|
|
|
|
"print(H)\n",
|
|
|
|
"# np.savetxt(output_path, H, delimiter=\",\")\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
"# cv2.imwrite(\"/tmp/test.jpg\", dst)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2024-01-23 14:54:09 +00:00
|
|
|
"cell_type": "markdown",
|
2023-12-06 09:21:43 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
2024-01-23 14:54:09 +00:00
|
|
|
"# second recording"
|
2023-12-06 09:21:43 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-01-23 14:54:09 +00:00
|
|
|
"execution_count": 9,
|
2023-12-06 09:21:43 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2024-01-23 14:54:09 +00:00
|
|
|
"img_src = \"../DATASETS/hof/webcam20240110.png\"\n",
|
|
|
|
"img_path = Path(img_src)\n",
|
|
|
|
"output_path = img_path.with_stem(img_path.stem + '-homography').with_suffix('.txt')"
|
2023-12-06 09:21:43 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-01-23 14:54:09 +00:00
|
|
|
"execution_count": 10,
|
2023-12-06 09:21:43 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
2024-01-23 14:54:09 +00:00
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABjYAAAJnCAYAAAA0vWrlAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9W6wtS3bXDf5HRGTmnHPd932fUzdcxnbzGdlubFdjPm790S5aCOlrqSVaPGD5wUIWQkJ+sY3ExSBRQkjIEljyE+I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AI4JBNn9ymDaMnxtKuIaXbKL1bjjIKUXrbmBJxxDEihB4h+BKtM0nXlvss9cmwDZfrkY0tIhoMpBgm5g9G125s/CSfCVujenJk05AzbhTnhOvbb3Dbe4qiKIry9USNDUVRFEVRFEVRlG9i3n/6Av/hP/4OfvDP/sDEqDDGFLFaIIyFz2JkjAyOsWg63hcAWGtL5IahCLIWRIAxDs5G+BABBBHXkxguUjSBk7kh8Rc0WTVvmcBwiKl9kQGyBq6qUTcN6rpBXTWwdQOQRIzM5wvUsxlcVcE6MTScc2AGYggAAfN9g9nZJdrTExgiWCsGhiPAwILZgiH9Y6wFkQEZCzAQfQAooA+SaqvvO/gQELxEejBLii9wBMWAKkUHGGOk3yInq2HAGFvez1wTjUn6h0BYXZ4h9h3miwVsdAAYDx49wsnL53j25H1YQ6hs3ldMxgaBaNhnPtbmz5teuwkiAplh36/7LMXrYjht0cf52scJYJrI7kwM3jgucxpPRCCq8C2f/sPYPzxETIZL5Ij1coV33/t99O0
|
2023-12-06 09:21:43 +00:00
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 1600x800 with 2 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
2024-01-23 14:54:09 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"[[ 1.99303684e+00 2.07856843e+00 1.70031558e+02]\n",
|
|
|
|
" [ 1.80069779e-02 4.28293697e+00 1.19720304e+02]\n",
|
|
|
|
" [-7.86892465e-05 1.44778561e-03 1.00000000e+00]]\n"
|
|
|
|
]
|
2023-12-06 09:21:43 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"src = np.array([\n",
|
|
|
|
" [954, 326], # 0\n",
|
|
|
|
" [1010, 320], # 1\n",
|
|
|
|
" [840, 325], # 2\n",
|
|
|
|
" [645, 317], # 3\n",
|
|
|
|
" [930,123], # 4\n",
|
|
|
|
" [1115,598], # 5\n",
|
|
|
|
" [970, 390], # 6\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
" ])\n",
|
|
|
|
"\n",
|
|
|
|
"dst = np.array([[0,0],\n",
|
|
|
|
"[97,0],\n",
|
|
|
|
"[-160,-33],\n",
|
|
|
|
"[-460,-33],\n",
|
|
|
|
"[105, -500],\n",
|
|
|
|
"[87, 420],\n",
|
|
|
|
"[-2, 112]\n",
|
|
|
|
"])\n",
|
|
|
|
"\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"points=[]\n",
|
|
|
|
"H = render_projection(src, dst, img_path, points)\n",
|
|
|
|
"print(H)\n",
|
|
|
|
"# print(output_path)\n",
|
|
|
|
"np.savetxt(output_path, H, delimiter=\",\")"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"# Compare\n",
|
2023-12-06 09:21:43 +00:00
|
|
|
"\n",
|
2024-01-23 14:54:09 +00:00
|
|
|
"Compare the different input images and homeographies."
|
2023-12-06 09:21:43 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
|
|
|
"display_name": ".venv",
|
|
|
|
"language": "python",
|
|
|
|
"name": "python3"
|
|
|
|
},
|
|
|
|
"language_info": {
|
|
|
|
"codemirror_mode": {
|
|
|
|
"name": "ipython",
|
|
|
|
"version": 3
|
|
|
|
},
|
|
|
|
"file_extension": ".py",
|
|
|
|
"mimetype": "text/x-python",
|
|
|
|
"name": "python",
|
|
|
|
"nbconvert_exporter": "python",
|
|
|
|
"pygments_lexer": "ipython3",
|
|
|
|
"version": "3.10.4"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 2
|
|
|
|
}
|