number-plate-study/Мальцев-лабы.ipynb

11545 lines
12 MiB
Plaintext
Raw Normal View History

2024-11-28 18:44:43 +01:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Лаба 2"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABdEAAAMUCAYAAABToG43AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9ebQtV1nuj39mU1Vrrd2dNiEQuggSaa7SDOmRHpVGUBQUGPTqlx4Fh6IQQMVEBeEiKAoXBA7SBgboQC4IClwYV8ULKMKPLkEIkOa0e++1VlXNOd/fH++sWnufJjknOUnQ1JOxc85ZezW1qmbN932f522MiAgDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgGNgr+8DGDBgwIABAwYMGDBgwIABAwYMGDBgwIABA35QMZDoAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwAkwkOgDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDACTCQ6AMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMAJMJDoAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwAkwkOgDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDACTCQ6AMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMAJMJDoAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwAkwkOgDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDACTCQ6AMGnAa89KUvxRhztV77lre8BWMMF1988ek9qC24+OKLMcbwlre85Vr7jAEDBgwYMOCGhuvChl8VnvGMZ/CgBz1o22OXXnopj370o9m9ezfGGF796lfzD//wDxhj+Id/+If+eU960pO4xS1ucd0e8LWEtm256U1vyutf//rr+1AGDBgwYMCA6w3XhJs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v/d7v8erX/1qHvSgB3GTm9yECy64gFvd6la84AUv4JOf/GT/uiNHjvDGN76R+973vlxwwQW89KUv5fLLL+chD3kIn//85/vnpZR4+MMfzl//9V/zxCc+kd///d/ne9/7Hk984hOPOZYvfelL3O1ud+PLX/4yv/mbv8krX/lKlpaWeOQjH3lKbXgGDBgwYMC1i3379vGzP/uzlGXJL/7iL/K1r32Nf/7nfwa0h/WjHvUoPvCBD9A0zbbXfeADH6Cuax772McCaiMe8YhH8Md//Mc8/OEP57WvfS2PfOQj+ZM/+RMe85jHHPO5H//4x3n+85/PYx7zGF7zmtf0wzNf85rXcMc73pGXv/zlvOIVr8B7z8///M8fY++vCxt+ySWXcL/73Y8vfelL/NZv/RbPf/7z2bdvH695zWtO6jM+85nPYIzhjne8Y//Yfe5zH972trcBSiZ3Zd8ng7179/Jnf/ZnADzqUY/qX/uzP/uzwKnb3mc84xn8x3/8By95yUv4zd/8zRN+rohw6aWXsmfPnpM6TlAi/Rd/8ReZTqd8+tOf3va7O9/5zogIn/nMZ076/QYMGDBgwPWL/+7+wqWXXsrd7nY3Pvaxj/GsZz2L17zmNdzqVrfiqU99Kq9+9atP6hy1bcsVV1zBFVdcwXe+8x0+9KEP8apXvYr73Oc+3PKWtzyp9zhZnCznMWDADQ4yYMANDIcOHRJAfuZnfuZKn/eIRzxCADly5IiIiJx33nkCyC/+4i8e89zudx0+97nPCSDPe97ztj3vSU96kgBy3nnn9Y+9+c1vFkAuuuii/rGb3/zmAsgnP/nJ/rHLLrtMqqqSX//1X+8fm8/nEmPc9hkXXXSRVFUlL3/5y7c9Bsib3/zmK/3On/jEJwSQ97znPcd8t1/+5V/uHwshyNlnny3GGDn//PP7xw8ePCjj8Vi
"text/plain": [
"<Figure size 1500x800 with 6 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"\n",
"img = cv.imread('img/1.jpg')\n",
"\n",
"average_blur = cv.filter2D(img, -1, np.ones((5, 5), np.float32) / 25) \n",
"simple_blur = cv.blur(img, (5, 5))\n",
"gaussian_blur = cv.GaussianBlur(img, (5, 5), 0) \n",
"median_blur = cv.medianBlur(img, 5)\n",
"bilateral_blur = cv.bilateralFilter(img, 9, 75, 75) \n",
"\n",
"images = [img, average_blur, simple_blur, gaussian_blur, median_blur, bilateral_blur]\n",
"titles = ['Original Image', 'Averaging (filter2D)', 'Average Blur', 'Gaussian Blur', 'Median Blur', 'Bilateral Blur']\n",
"\n",
"plt.figure(figsize=(15, 8))\n",
"\n",
"for i in range(len(images)):\n",
" plt.subplot(2, 3, i + 1)\n",
" plt.imshow(cv.cvtColor(images[i], cv.COLOR_BGR2RGB))\n",
" plt.title(titles[i])\n",
" plt.xticks([]), plt.yticks([])\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAGDCAYAAAC2gxMSAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAtXUlEQVR4nO3deXQUVaLH8V93BxK2LDxQQTEgoIjiBg8cZYuiiCDqiOxIUMaBQVbh6TwVgmcGQUQZfbgLAUKQYRFQBOSNcJRRXBBhBnEAhRmeAQHZEiFA0vf94ame3tMJWbnfzzl9kty6detW962qX1dVd1zGGCMAAGAtd0V3AAAAVCzCAAAAliMMAABgOcIAAACWIwwAAGA5wgAAAJYjDAAAYDnCAAAAliMMAABguSoVBjIyMuRyuUo0b2Zmplwul/bu3Vu6nfKzd+9euVwuZWZmltkyAAAobeUSBrZv366BAwfq4osvVnx8vBo2bKgBAwZo+/bt5bH4SmfDhg1yuVxasmRJRXcFlZATXP0fF1xwgdLS0rR69eqAui6XS4888ojvbyeQulwuLV26NKRtJ1AfPnw47LJ79+4tl8ulxx57LOx0Z+w6D4/HowsuuEC9evXSjh07JEnHjh1TgwYNdPPNNyvct51v2rRJbrdbEyZMiPk5QdlizAVy1um5554L24/NmzeHzJOenq7atWtLkg4ePKi4uDgNHDgw4jJyc3NVo0YN/frXv46pT2WtzMPAsmXLdMMNN+gvf/mLhgwZopdfflkPPfSQ1q9frxtuuEHvvPNOzG09+eSTOnXqVIn6MWjQIJ06dUqpqaklmh8ob08//bTmz5+vefPm6b/+67906NAh3XnnnXrvvfdinr84/3rkxIkTevfdd9W4cWMtXLgw6ryjRo3S/Pnz9eabb2rAgAFatWqVOnTooAMHDig5OVkzZ87UJ598ojfeeCNgvoKCAg0bNkypqamaPHlyzH1D+WDMxSYjIyPq9AsuuEC33XabVqxYoZMnT4ats2zZMuXn50cNDOXKlKHdu3ebmjVrmhYtWpiDBw8GTDt06JBp0aKFqVWrlvnuu++itpOXl1eW3Sw1e/bsMZLMnDlzotZbv369kWQWL15cPh1DlTJnzhwjyXzxxRcB5UeOHDHVqlUz/fv395VJMiNGjPD97YzB6667zkgyS5cuDWhj0qRJRpI5dOhQyHJnz55tqlWrZj788EMjyWzYsCGkTqSx+8orrxhJZtq0ab6ybt26mZSUFHPgwAFf2XPPPWckmffffz/GZwPlgTEXyFmn6dOnh/TDWc/NmzcHzDN48GBTq1Yt39/z5883kszChQvDLuP22283SUlJJj8/P+Z+laUyPTMwffp0nTx5Uq+//rrq168fMK1evXp67bXX9PPPP+vZZ5/1lTunlL755hv1799fKSkpat++fcA0f6dOndKoUaNUr1491alTRz179tQPP/wgl8sVkN7C3TPQuHFj9ejRQxs3blTbtm2VkJCgyy67TPPmzQtYxpEjRzR+/Hi1atVKtWvXVmJiorp166atW7eW0jP173XbuXOnBg4cqKSkJNWvX19PPfWUjDHat2+f7r77biUmJuqiiy7SjBkzAuY/c+aMJk6cqNatWyspKUm1atVShw4dtH79+pBl/fTTTxo0aJASExOVnJyswYMHa+vWrWHvd/j222/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7xerzEm8inb5557ztSoUcO3He7cudNIMu+8805APWfszp492xw6dMjk5OSYNWvWmGbNmhmXy2U+//zzgPpnz5411113nalbt66RZF577bXSeppQihhzgaJdJli8eLE5duyYSUlJMT179vRND75MYIwxq1atCtuHG2+80Vx88cUhx5WKVGZnBnJzcyVJderUiVrPmX7ixImA8mHDhhW5jDVr1kiSfve73wWUjxw5MuZ+tmzZMuDMRf369XXFFVfo+++/95XFx8fL7f7lqSosLNRPP/2k2rVr64orroiaDEti6NChvt89Ho/atGkjY4weeughX3lycnJIHz0ej6pXry7pl3f/R44cUUFBgdq0aRPQxzVr1qhatWoBZ1vcbrdGjBgR0I8jR47oww8/VO/evZWbm6vDhw/r8OHD+umnn9S1a1ft2rVLP/zwQ6muOwLNmjVL69at07p165SVlaW0tDQNHTpUy5Yti2l+/3dqy5cvj1p3wYIF6t69u297bN68uVq3bh3xtO2DDz6o+vXrq2HDhrrjjjt0/PhxzZ8/X//5n/8ZUC8uLk6vv/66jhw5ohtvvDHqWT5UPMZcbJKSkjRmzBitXLlSW7ZsiVjv9ttvV/369QMuFezZs0ebNm1Sv379fMeVyqDMeuK8wE4oiCRSaGjSpEmRy/jnP/8pt9sdUrdZs2Yx9/PSSy8NKUtJSdHRo0d9f3u9Xr3wwgtq3ry54uPjVa9ePdWvX1/btm3T8ePHY15WSfqTlJSkhIQE1atXL6Tcv4+SNHfuXF1zzTVKSEjQf/zHf6h+/fpatWpVQB//+c9/qkGDBqpZs2bAvMHP2e7du2WM0VNPPaX69esHPCZNmiTpl+teKDtt27ZVly5d1KVLF9/d0y1bttQjjzwS86nUAQMGqFmzZlGv4+7YsUNbtmzRzTffrN27d/senTt31nvvvRcS1CVp4sSJWrdund555x098MADOn78eMQdm7Ozbt26dYm/JwTlgzEXu9GjRys5OTnqvQNxcXHq06ePPv74Y9+bJycYVKpLBCrDMJCUlKQGDRpo27ZtUett27ZNF198sRITEwPKa9SoUVZdC+DxeMKW+w/iKVOmaNy4cerYsaOysrK0du1arVu3TldddZW8Xm+Z9yeWPmZlZSk9PV1NmzbVW2+9pTVr1mjdunW65ZZbStRHZ57x48f73ikEP4oTunDu3G630tLStH//fu3atSumeZx3al9//bVWrFgRtk5WVpYkaezYsWrevLnvMWPGDOXn54f
"text/plain": [
"<Figure size 640x480 with 6 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"img = cv.imread('img/gradient.png', cv.IMREAD_GRAYSCALE)\n",
"assert img is not None, \"file could not be read, check with os.path.exists()\"\n",
"ret,thresh1 = cv.threshold(img,127,255,cv.THRESH_BINARY)\n",
"ret,thresh2 = cv.threshold(img,127,255,cv.THRESH_BINARY_INV)\n",
"ret,thresh3 = cv.threshold(img,127,255,cv.THRESH_TRUNC)\n",
"ret,thresh4 = cv.threshold(img,127,255,cv.THRESH_TOZERO)\n",
"ret,thresh5 = cv.threshold(img,127,255,cv.THRESH_TOZERO_INV)\n",
"titles = ['Original Image','BINARY','BINARY_INV','TRUNC','TOZERO','TOZERO_INV']\n",
"images = [img, thresh1, thresh2, thresh3, thresh4, thresh5]\n",
"for i in range(6):\n",
" plt.subplot(2,3,i+1),plt.imshow(images[i],'gray',vmin=0,vmax=255)\n",
" plt.title(titles[i])\n",
" plt.xticks([]),plt.yticks([])\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAh4AAAGbCAYAAACLVpm8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOx9d5xcVfn+M22nbk12U0kjoYQaeq/So0QUARGpCvYCNkSxfQVRFH8WBNEACojwBRRUQBAELKBAgBBKSCENNttmp8/uzNzfH/t9zjz37CyEMGSTzX0/n/3s7p1bzj33zH2f87zP+x6f4zgOPPPMM88888wzzzaB+Ue7AZ555plnnnnm2dZjHvDwzDPPPPPMM882mXnAwzPPPPPMM88822TmAQ/PPPPMM88882yTmQc8PPPMM88888yzTWYe8PDMM88888wzzzaZecDDM88888wzzzzbZOYBD88888wzzzzzbJOZBzw888wzzzzzzLNNZh7weIftG9/4Bnw+30Yde/3118Pn82HlypX1bZTYypUr4fP5cP31179j1/DMs5Hs7Xw/ZsyYgfnz59etLfX+LvB8P/jBD+pyvrdr70R73so7asaMGTjrrLPM/w8//DB8Ph8efvjhurXnrdoVV1yBHXbYAZVKZdTasDlaT08P4vE4/vznP78j5/eAxwj2/PPP40Mf+hCmTJmCcDiMyZMn4/TTT8fzzz8/2k0bFeNL4vbbbx/tpni2mduKFSvwyU9+Ettttx1isRhisRjmzp2LT3ziE3j22WdHu3lvy2bMmAGfz/emPx6Q3/wtlUrhe9/7Hr70pS/B79/8XOETTzyBj3/849hzzz0RCoVGBOirV6/GN7/5Teyzzz5obW3F+PHjcdhhh+GBBx4Ytu9hhx024pgNhUJmv3HjxuG8887D1772tXfk3oLvyFm3cLvjjjtw2mmnoa2tDeeeey5mzpyJlStX4le/+hVuv/12/O53v8N73/veDTrXJZdcgi9/+csb1Y4zzjgDp556KsLh8EYd75lnm9ruuecenHLKKQgGgzj99NOx2267we/348UXX8Qdd9yBq6++GitWrMD06dNHu6kbZVdddRUymYz5/89//jNuueUW/OhHP8L48ePN9gMOOGA0mrdF2SGHHIJ8Po+GhoZRuf6vf/1rlEolnHbaaaNy/TezP//5z7juuuuw6667YtasWXj55Zdr7veHP/wB3/ve97BgwQKceeaZKJVKuPHGG3HUUUfh17/+Nc4++2yz71e/+lWcd955ruOz2SwuuOACHH300a7tF1xwAf7f//t/+Nvf/oYjjjiirvfmAQ/Lli1bhjPOOAOzZs3CI488gvb2dvPZZz7zGRx88ME444wz8Oyzz2LWrFkjniebzSIejyMYDCIY3LhuDgQCCAQCG3WsZ55talu2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yeffDLmzJmD7373u2/4oM466yz8/ve/xxlnnIH99tsPf//733HCCSdscBtfeeUVvP/978e5556LM888E7/+9a9x1llnYc8998ROO+0EAFi+fDnuuusunHzyyZg5cyY6OztxzTXX4NBDD8WSJUswefLkDb7em9kpp5yCHXfcEZdffjn+9Kc/4Tvf+Q7a2tpwzTXX4IgjjsD3vvc93HTTTbjooouw995745BDDgEw9GW+7rrrcNppp+EjH/kI0uk0fvWrX+GYY47BE088gd133x3A0Iv33e9+N5544gl87GMfww477IA//OEPOPPMM4e15fnnn8eBBx6IKVOm4Mtf/jLi8Th+//vfY8GCBfjf//3fDQ6RefbW7Z577sHs2bOx7777vq3znHfeebjhhhvw/ve/HxdeeCEef/xxXHbZZXjhhRdw5513uvZdunQpTjnlFFxwwQU488wzsXDhQpx88sm49957zexuU34XatnNN9+MdDqN888/Hz6fD1dccQVOOukkLF++3BVXL5VKOOaYY3DQQQfhBz/4AWKxGADg/PPPx/XXX4+zzz4bn/70p7FixQr89Kc/xdNPP41//OMfCIVCWL9+PY4++mi0t7fjy1/+MlpaWrBy5cphIGxD2/PAAw/guOOOw6xZs/CNb3wD+XweP/nJT3DggQfiqaeeGsbuqH3961/Hd77zHRx//PE4/vjj8dRTT+Hoo4/GwMDABvVXX18fjj32WJx00kn4wAc+gNtvvx1f+tKXsMsuu+C4444DMMQGHXHEEXjttdfwmc98BhMnTsTNN99cc9JSy/75z38CAPbYYw+zLRQK4b3vfS/uuOMOXHPNNa4Q0F133YVisYhTTz31Dc/b39+PwcHBN71+JBJBIpHYoLZurL3++utGYzWSdXV14a9//StOOeWUmuzannvuiR/96Ed4/vnnsfPOO9evcY5nxpLJpAPAOfHEE99wv/e85z0OACeVSjmO4ziXXnqpA8A57bTThu3Lz2hPPvmkA8D57Gc/69rvrLPOcgA4l156qdm2cOFCB4CzYsUKs2369OkOAOeRRx4x29avX++Ew2HnwgsvNNsKhYJTLpdd11ixYoUTDoedb33rW65tAJyFCxe+4T0/9NBDDgDntttuG3ZvH/3oR822UqnkTJ061fH5fM7ll19utvf19TnRaNQ588wzXfsWi0XXdfr6+pwJEyY455xzjtn2v//7vw4A56qrrjLbyuWyc8QRRwxr+5FHHunssssuTqFQMNsqlYpzwAEHOHPmzHnDe/Rs462/v98B4CxYsGDYZ319fU5XV5f5yeVy5jP7+7Fo0SIHgHPeeee5znHRRRc5AJy//e1vZhu/C//7v//rasekSZOcefPmmW31/i6off/73x/2HbXPN27cOKe3t9ds/8Mf/uAAcO6++26z7cwzz3QAOF/+8pdd53j00UcdAM5NN93k2n7vvfe6tt95550OAOc///nPiG19K+3ZfffdnY6ODqenp8dse+aZZxy/3+98+MMfNtvsd9T69eu
"text/plain": [
"<Figure size 640x480 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"img = cv.imread('img/1.jpg', cv.IMREAD_GRAYSCALE)\n",
"img = cv.medianBlur(img,5)\n",
"ret,th1 = cv.threshold(img,127,255,cv.THRESH_BINARY)\n",
"th2 = cv.adaptiveThreshold(img,255,cv.ADAPTIVE_THRESH_MEAN_C,\\\n",
" cv.THRESH_BINARY,11,2)\n",
"th3 = cv.adaptiveThreshold(img,255,cv.ADAPTIVE_THRESH_GAUSSIAN_C,\\\n",
" cv.THRESH_BINARY,11,2)\n",
"titles = ['Original Image', 'Global Thresholding (v = 127)',\n",
" 'Adaptive Mean Thresholding', 'Adaptive Gaussian Thresholding']\n",
"images = [img, th1, th2, th3]\n",
"for i in range(4):\n",
" plt.subplot(2,2,i+1),plt.imshow(images[i],'gray')\n",
" plt.title(titles[i])\n",
" plt.xticks([]),plt.yticks([])\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkwAAAGbCAYAAAA2t8/JAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOx9d3hUdfr9md5LJpn0kEYKIYFI702ki1hQsYLoWnARl9XF1bWs7toXKyp+FSxgQ6RILyoCSodQQgophPQ2vc/c3x/5vR9nSAIJxRLveZ48kDt37tx7J3Pn3POe97wCjuM48ODBgwcPHjx48GgXwt96B3jw4MGDBw8ePH7v4AkTDx48ePDgwYPHecATJh48ePDgwYMHj/OAJ0w8ePDgwYMHDx7nAU+YePDgwYMHDx48zgOeMPHgwYMHDx48eJwHPGHiwYMHDx48ePA4D3jCxIMHDx48ePDgcR7whIkHDx48ePDgweM8+EMRpqeffhoCgeCCnrt06VIIBAKUlZVd2p0KQllZGQQCAZYuXXrZXuN8mDlzJpKSkn6z1+fxx0BSUhJmzpz5W+8GD1zcdS0pKQlTpky5ZPtyqa9htL1XXnnlkmzvYnE59qcz3y1nf+6+//57CAQCfP/995dsfzqLl156CZmZmQgEAr/ZPvyaWLBgAQYOHHhBz/1VCNPx48dx2223IS4uDjKZDLGxsbj11ltx/PjxX+Plf3egD4lAIMCBAwdaPT5z5kyo1erfYM86j9/bBfHPCrpo79+/v83HR40ahezs7It6jfXr1+Ppp5++qG38WVBaWooHH3wQ6enpUCqVUCqVyMrKwpw5c5CXl/db795FISkpiV2/zvXzW9448ugYLBYLXnzxRfzjH/+AUPjr6Sf/+c9/MHXqVERFRUEgELR7XVm5ciVuuukmpKSkQKlUIiMjA/Pnz4fJZApZL/g7ta2f//znP2zdefPm4ciRI1izZk2n91vc6Wd0EitXrsSMGTNgMBgwe/ZsJCcno6ysDB988AFWrFiBzz//HNdee22HtvXEE09gwYIFF7Qft99+O26++WbIZLILev7lwtNPP421a9desu29//77f5o7BR4XjoKCgk5fINevX4+3336bJ03nwbfffoubbroJYrEYt956K3r37g2hUIiTJ09i5cqVeOedd1BaWorExMTfelcvCK+99hpsNhv7ff369fjss8+wcOFCREREsOVDhgz5LXbvD4URI0bA6XRCKpX+Jq//4YcfwufzYcaMGb/q6z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YMeK857k9fPvtt+jevfsFm0oJd999Nz766CPccMMNmD9/Pvbs2YPnn38e+fn5+Oabb0LWLSoqwk033YT77rsPd955J5YsWYLp06dj48aNuOqqqwBcvmtYR7F8+XJYrVbce++9EAgEeOmll3DdddehpKQk5Nrl8/kwfvx4DBs2DK+88gqUSiUA4N5778XSpUsxa9YszJ07F6WlpXjrrbdw6NAhdv2rq6vDuHHjYDQasWDBAuj1epSVlbUijx3dn61bt2LixIlISUnB008/DafTiTfffBNDhw7FwYMHz/ml/+STT+K5557DpEmTMGnSJBw8eBDjxo2Dx+Pp0Plqbm7GhAkTcN111+HGG2/EihUr8I9//AM5OTmYOHEigJablDFjxqC6uhoPPfQQoqOjsXz5cnz33Xcdeo3du3cDQMj3jkQiwbXXXouVK1fivffeCykVrlq1Cm63GzfffDNb1ta1pi1oNJpLpmrX1NQAQEj5ty0sW7YMANokTDqdDqmpqdi1a1er771zgrtMMJlMHADummuuOed6U6dO5QBwFouF4ziOe+qppzgA3IwZM1qtS48RDhw4wAHg5s2
"text/plain": [
"<Figure size 640x480 with 9 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"img = cv.imread('img/noisy2.png', cv.IMREAD_GRAYSCALE)\n",
"assert img is not None, \"file could not be read, check with os.path.exists()\"\n",
"# global thresholding\n",
"ret1,th1 = cv.threshold(img,127,255,cv.THRESH_BINARY)\n",
"# Otsu's thresholding\n",
"ret2,th2 = cv.threshold(img,0,255,cv.THRESH_BINARY+cv.THRESH_OTSU)\n",
"# Otsu's thresholding after Gaussian filtering\n",
"blur = cv.GaussianBlur(img,(5,5),0)\n",
"ret3,th3 = cv.threshold(blur,0,255,cv.THRESH_BINARY+cv.THRESH_OTSU)\n",
"# plot all the images and their histograms\n",
"images = [img, 0, th1,\n",
" img, 0, th2,\n",
" blur, 0, th3]\n",
"titles = ['Original Noisy Image','Histogram','Global Thresholding (v=127)',\n",
" 'Original Noisy Image','Histogram',\"Otsu's Thresholding\",\n",
" 'Gaussian filtered Image','Histogram',\"Otsu's Thresholding\"]\n",
"for i in range(3):\n",
" plt.subplot(3,3,i*3+1),plt.imshow(images[i*3],'gray')\n",
" plt.title(titles[i*3]), plt.xticks([]), plt.yticks([])\n",
" plt.subplot(3,3,i*3+2),plt.hist(images[i*3].ravel(),256)\n",
" plt.title(titles[i*3+1]), plt.xticks([]), plt.yticks([])\n",
" plt.subplot(3,3,i*3+3),plt.imshow(images[i*3+2],'gray')\n",
" plt.title(titles[i*3+2]), plt.xticks([]), plt.yticks([])\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"118 118.0\n"
]
}
],
"source": [
"\n",
"blur = cv.GaussianBlur(img,(5,5),0)\n",
"# find normalized_histogram, and its cumulative distribution function\n",
"hist = cv.calcHist([blur],[0],None,[256],[0,256])\n",
"hist_norm = hist.ravel()/hist.sum()\n",
"Q = hist_norm.cumsum()\n",
"bins = np.arange(256)\n",
"fn_min = np.inf\n",
"thresh = -1\n",
"for i in range(1,256):\n",
" p1,p2 = np.hsplit(hist_norm,[i]) # probabilities\n",
" q1,q2 = Q[i],Q[255]-Q[i] # cum sum of classes\n",
" if q1 < 1.e-6 or q2 < 1.e-6:\n",
" continue\n",
" b1,b2 = np.hsplit(bins,[i]) # weights\n",
" # finding means and variances\n",
" m1,m2 = np.sum(p1*b1)/q1, np.sum(p2*b2)/q2\n",
" v1,v2 = np.sum(((b1-m1)**2)*p1)/q1,np.sum(((b2-m2)**2)*p2)/q2\n",
" # calculates the minimization function\n",
" fn = v1*q1 + v2*q2\n",
" if fn < fn_min:\n",
" fn_min = fn\n",
" thresh = i\n",
"# find otsu's threshold value with OpenCV function\n",
"ret, otsu = cv.threshold(blur,0,255,cv.THRESH_BINARY+cv.THRESH_OTSU)\n",
"print( \"{} {}\".format(thresh,ret) )"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"((array([[[178, 224]]], dtype=int32),\n",
" array([[[ 58, 224]]], dtype=int32),\n",
" array([[[ 47, 224]]], dtype=int32),\n",
" array([[[176, 223]]], dtype=int32),\n",
" array([[[ 83, 223]]], dtype=int32),\n",
" array([[[ 74, 223]]], dtype=int32),\n",
" array([[[208, 222]],\n",
" \n",
" [[208, 224]],\n",
" \n",
" [[208, 223]],\n",
" \n",
" [[209, 222]]], dtype=int32),\n",
" array([[[191, 222]]], dtype=int32),\n",
" array([[[187, 222]],\n",
" \n",
" [[187, 224]],\n",
" \n",
" [[188, 224]],\n",
" \n",
" [[189, 223]],\n",
" \n",
" [[190, 224]],\n",
" \n",
" [[189, 223]],\n",
" \n",
" [[188, 223]]], dtype=int32),\n",
" array([[[ 61, 222]],\n",
" \n",
" [[ 61, 224]]], dtype=int32),\n",
" array([[[178, 221]],\n",
" \n",
" [[178, 222]],\n",
" \n",
" [[179, 221]],\n",
" \n",
" [[180, 222]],\n",
" \n",
" [[180, 223]],\n",
" \n",
" [[181, 224]],\n",
" \n",
" [[182, 223]],\n",
" \n",
" [[183, 224]],\n",
" \n",
" [[185, 224]],\n",
" \n",
" [[184, 224]],\n",
" \n",
" [[181, 221]],\n",
" \n",
" [[180, 222]],\n",
" \n",
" [[179, 221]]], dtype=int32),\n",
" array([[[180, 222]],\n",
" \n",
" [[181, 221]],\n",
" \n",
" [[182, 222]],\n",
" \n",
" [[181, 223]]], dtype=int32),\n",
" array([[[ 86, 221]],\n",
" \n",
" [[ 85, 222]]], dtype=int32),\n",
" array([[[176, 220]]], dtype=int32),\n",
" array([[[ 94, 220]]], dtype=int32),\n",
" array([[[ 66, 220]]], dtype=int32),\n",
" array([[[ 48, 220]]], dtype=int32),\n",
" array([[[ 60, 219]]], dtype=int32),\n",
" array([[[ 55, 219]],\n",
" \n",
" [[ 55, 220]],\n",
" \n",
" [[ 56, 221]],\n",
" \n",
" [[ 56, 222]],\n",
" \n",
" [[ 56, 221]],\n",
" \n",
" [[ 55, 220]]], dtype=int32),\n",
" array([[[212, 218]],\n",
" \n",
" [[211, 219]],\n",
" \n",
" [[210, 219]],\n",
" \n",
" [[211, 220]],\n",
" \n",
" [[211, 219]],\n",
" \n",
" [[212, 218]],\n",
" \n",
" [[213, 218]]], dtype=int32),\n",
" array([[[ 87, 218]]], dtype=int32),\n",
" array([[[ 69, 218]]], dtype=int32),\n",
" array([[[179, 217]],\n",
" \n",
" [[180, 218]],\n",
" \n",
" [[180, 219]],\n",
" \n",
" [[182, 219]],\n",
" \n",
" [[182, 218]],\n",
" \n",
" [[181, 219]]], dtype=int32),\n",
" array([[[ 54, 217]]], dtype=int32),\n",
" array([[[211, 216]]], dtype=int32),\n",
" array([[[182, 216]]], dtype=int32),\n",
" array([[[213, 215]]], dtype=int32),\n",
" array([[[176, 215]]], dtype=int32),\n",
" array([[[ 69, 214]],\n",
" \n",
" [[ 69, 216]]], dtype=int32),\n",
" array([[[ 29, 213]]], dtype=int32),\n",
" array([[[214, 212]]], dtype=int32),\n",
" array([[[169, 210]]], dtype=int32),\n",
" array([[[216, 209]],\n",
" \n",
" [[216, 210]]], dtype=int32),\n",
" array([[[ 91, 209]]], dtype=int32),\n",
" array([[[ 68, 209]],\n",
" \n",
" [[ 68, 210]],\n",
" \n",
" [[ 69, 210]],\n",
" \n",
" [[ 71, 212]]], dtype=int32),\n",
" array([[[ 94, 208]],\n",
" \n",
" [[ 93, 209]],\n",
" \n",
" [[ 93, 210]],\n",
" \n",
" [[ 92, 211]],\n",
" \n",
" [[ 91, 211]],\n",
" \n",
" [[ 92, 211]],\n",
" \n",
" [[ 93, 210]],\n",
" \n",
" [[ 93, 209]]], dtype=int32),\n",
" array([[[ 71, 206]]], dtype=int32),\n",
" array([[[ 29, 206]],\n",
" \n",
" [[ 29, 210]]], dtype=int32),\n",
" array([[[ 97, 205]]], dtype=int32),\n",
" array([[[ 94, 205]],\n",
" \n",
" [[ 93, 206]],\n",
" \n",
" [[ 95, 206]],\n",
" \n",
" [[ 96, 207]]], dtype=int32),\n",
" array([[[ 75, 204]]], dtype=int32),\n",
" array([[[ 64, 204]],\n",
" \n",
" [[ 64, 205]],\n",
" \n",
" [[ 65, 205]],\n",
" \n",
" [[ 66, 206]],\n",
" \n",
" [[ 65, 207]],\n",
" \n",
" [[ 64, 207]],\n",
" \n",
" [[ 65, 207]],\n",
" \n",
" [[ 66, 208]],\n",
" \n",
" [[ 67, 207]],\n",
" \n",
" [[ 68, 207]],\n",
" \n",
" [[ 67, 207]]], dtype=int32),\n",
" array([[[ 65, 207]],\n",
" \n",
" [[ 66, 206]],\n",
" \n",
" [[ 67, 207]],\n",
" \n",
" [[ 66, 208]]], dtype=int32),\n",
" array([[[ 62, 202]]], dtype=int32),\n",
" array([[[100, 200]],\n",
" \n",
" [[ 98, 202]],\n",
" \n",
" [[ 97, 202]],\n",
" \n",
" [[ 97, 203]]], dtype=int32),\n",
" array([[[217, 199]]], dtype=int32),\n",
" array([[[ 65, 199]]], dtype=int32),\n",
" array([[[ 98, 198]],\n",
" \n",
" [[ 98, 199]],\n",
" \n",
" [[ 97, 200]],\n",
" \n",
" [[ 99, 198]],\n",
" \n",
" [[100, 198]]], dtype=int32),\n",
" array([[[216, 197]]], dtype=int32),\n",
" array([[[ 69, 196]],\n",
" \n",
" [[ 68, 197]],\n",
" \n",
" [[ 68, 200]],\n",
" \n",
" [[ 70, 202]],\n",
" \n",
" [[ 68, 200]],\n",
" \n",
" [[ 68, 197]],\n",
" \n",
" [[ 69, 196]],\n",
" \n",
" [[ 70, 197]],\n",
" \n",
" [[ 71, 196]],\n",
" \n",
" [[ 73, 198]],\n",
" \n",
" [[ 73, 199]],\n",
" \n",
" [[ 76, 202]],\n",
" \n",
" [[ 76, 201]],\n",
" \n",
" [[ 77, 200]],\n",
" \n",
" [[ 76, 201]],\n",
" \n",
" [[ 75, 200]],\n",
" \n",
" [[ 74, 200]],\n",
" \n",
" [[ 73, 199]],\n",
" \n",
" [[ 73, 198]],\n",
" \n",
" [[ 72, 197]],\n",
" \n",
" [[ 72, 196]],\n",
" \n",
" [[ 71, 196]],\n",
" \n",
" [[ 70, 197]]], dtype=int32),\n",
" array([[[211, 195]]], dtype=int32),\n",
" array([[[ 84, 195]]], dtype=int32),\n",
" array([[[ 81, 195]]], dtype=int32),\n",
" array([[[204, 194]]], dtype=int32),\n",
" array([[[212, 192]]], dtype=int32),\n",
" array([[[100, 190]],\n",
" \n",
" [[ 99, 191]],\n",
" \n",
" [[ 98, 191]],\n",
" \n",
" [[ 99, 192]],\n",
" \n",
" [[ 98, 193]],\n",
" \n",
" [[ 97, 193]],\n",
" \n",
" [[ 97, 194]],\n",
" \n",
" [[ 98, 193]],\n",
" \n",
" [[100, 193]],\n",
" \n",
" [[100, 192]],\n",
" \n",
" [[ 99, 191]]], dtype=int32),\n",
" array([[[ 63, 190]],\n",
" \n",
" [[ 63, 191]],\n",
" \n",
" [[ 64, 192]],\n",
" \n",
" [[ 64, 191]]], dtype=int32),\n",
" array([[[221, 189]]], dtype=int32),\n",
" array([[[ 45, 189]],\n",
" \n",
" [[ 45, 190]],\n",
" \n",
" [[ 44, 191]],\n",
" \n",
" [[ 45, 191]]], dtype=int32),\n",
" array([[[214, 188]],\n",
" \n",
" [[213, 189]],\n",
" \n",
" [[213, 190]],\n",
" \n",
" [[213, 189]]], dtype=int32),\n",
" array([[[ 85, 188]]], dtype=int32),\n",
" array([[[ 63, 187]]], dtype=int32),\n",
" array([[[ 46, 185]],\n",
" \n",
" [[ 46, 187]]], dtype=int32),\n",
" array([[[106, 183]]], dtype=int32),\n",
" array([[[100, 183]],\n",
" \n",
" [[100, 185]],\n",
" \n",
" [[100, 184]],\n",
" \n",
" [[101, 183]]], dtype=int32),\n",
" array([[[ 64, 183]]], dtype=int32),\n",
" array([[[ 66, 181]],\n",
" \n",
" [[ 66, 183]],\n",
" \n",
" [[ 67, 183]],\n",
" \n",
" [[ 66, 182]]], dtype=int32),\n",
" array([[[ 30, 181]]], dtype=int32),\n",
" array([[[109, 179]],\n",
" \n",
" [[109, 180]],\n",
" \n",
" [[110, 180]]], dtype=int32),\n",
" array([[[ 55, 179]],\n",
" \n",
" [[ 55, 181]]], dtype=int32),\n",
" array([[[ 43, 179]]], dtype=int32),\n",
" array([[[107, 178]],\n",
" \n",
" [[107, 179]]], dtype=int32),\n",
" array([[[ 0, 178]],\n",
" \n",
" [[ 0, 179]],\n",
" \n",
" [[ 1, 180]],\n",
" \n",
" [[ 1, 181]],\n",
" \n",
" [[ 3, 183]],\n",
" \n",
" [[ 3, 184]],\n",
" \n",
" [[ 4, 185]],\n",
" \n",
" [[ 4, 189]],\n",
" \n",
" [[ 5, 190]],\n",
" \n",
" [[ 5, 192]],\n",
" \n",
" [[ 4, 193]],\n",
" \n",
" [[ 4, 194]],\n",
" \n",
" [[ 5, 195]],\n",
" \n",
" [[ 5, 198]],\n",
" \n",
" [[ 6, 199]],\n",
" \n",
" [[ 6, 201]],\n",
" \n",
" [[ 5, 202]],\n",
" \n",
" [[ 6, 203]],\n",
" \n",
" [[ 6, 205]],\n",
" \n",
" [[ 5, 206]],\n",
" \n",
" [[ 6, 207]],\n",
" \n",
" [[ 6, 211]],\n",
" \n",
" [[ 5, 212]],\n",
" \n",
" [[ 5, 213]],\n",
" \n",
" [[ 6, 214]],\n",
" \n",
" [[ 6, 215]],\n",
" \n",
" [[ 7, 216]],\n",
" \n",
" [[ 7, 218]],\n",
" \n",
" [[ 6, 219]],\n",
" \n",
" [[ 7, 220]],\n",
" \n",
" [[ 7, 224]],\n",
" \n",
" [[ 13, 224]],\n",
" \n",
" [[ 13, 221]],\n",
" \n",
" [[ 12, 220]],\n",
" \n",
" [[ 12, 216]],\n",
" \n",
" [[ 11, 215]],\n",
" \n",
" [[ 12, 214]],\n",
" \n",
" [[ 11, 213]],\n",
" \n",
" [[ 11, 206]],\n",
" \n",
" [[ 10, 205]],\n",
" \n",
" [[ 10, 203]],\n",
" \n",
" [[ 9, 202]],\n",
" \n",
" [[ 10, 201]],\n",
" \n",
" [[ 10, 200]],\n",
" \n",
" [[ 9, 199]],\n",
" \n",
" [[ 10, 198]],\n",
" \n",
" [[ 10, 193]],\n",
" \n",
" [[ 9, 192]],\n",
" \n",
" [[ 9, 184]],\n",
" \n",
" [[ 8, 183]],\n",
" \n",
" [[ 9, 182]],\n",
" \n",
" [[ 8, 183]],\n",
" \n",
" [[ 7, 182]],\n",
" \n",
" [[ 7, 181]],\n",
" \n",
" [[ 5, 179]],\n",
" \n",
" [[ 4, 179]],\n",
" \n",
" [[ 3, 178]]], dtype=int32),\n",
" array([[[ 5, 206]],\n",
" \n",
" [[ 6, 205]],\n",
" \n",
" [[ 7, 206]],\n",
" \n",
" [[ 6, 207]]], dtype=int32),\n",
" array([[[ 66, 177]],\n",
" \n",
" [[ 66, 179]],\n",
" \n",
" [[ 67, 178]],\n",
" \n",
" [[ 68, 179]],\n",
" \n",
" [[ 68, 180]],\n",
" \n",
" [[ 69, 181]],\n",
" \n",
" [[ 69, 184]],\n",
" \n",
" [[ 68, 185]],\n",
" \n",
" [[ 68, 187]],\n",
" \n",
" [[ 69, 188]],\n",
" \n",
" [[ 68, 189]],\n",
" \n",
" [[ 68, 191]],\n",
" \n",
" [[ 69, 192]],\n",
" \n",
" [[ 69, 193]],\n",
" \n",
" [[ 67, 195]],\n",
" \n",
" [[ 66, 194]],\n",
" \n",
" [[ 66, 193]],\n",
" \n",
" [[ 66, 194]],\n",
" \n",
" [[ 67, 195]],\n",
" \n",
" [[ 68, 194]],\n",
" \n",
" [[ 70, 194]],\n",
" \n",
" [[ 70, 193]],\n",
" \n",
" [[ 71, 192]],\n",
" \n",
" [[ 72, 192]],\n",
" \n",
" [[ 73, 193]],\n",
" \n",
" [[ 74, 193]],\n",
" \n",
" [[ 75, 194]],\n",
" \n",
" [[ 78, 194]],\n",
" \n",
" [[ 77, 194]],\n",
" \n",
" [[ 76, 193]],\n",
" \n",
" [[ 76, 192]],\n",
" \n",
" [[ 77, 191]],\n",
" \n",
" [[ 79, 191]],\n",
" \n",
" [[ 79, 190]],\n",
" \n",
" [[ 78, 191]],\n",
" \n",
" [[ 77, 190]],\n",
" \n",
" [[ 77, 189]],\n",
" \n",
" [[ 78, 188]],\n",
" \n",
" [[ 78, 183]],\n",
" \n",
" [[ 77, 182]],\n",
" \n",
" [[ 77, 180]],\n",
" \n",
" [[ 76, 179]],\n",
" \n",
" [[ 76, 178]],\n",
" \n",
" [[ 75, 177]],\n",
" \n",
" [[ 76, 178]],\n",
" \n",
" [[ 76, 179]],\n",
" \n",
" [[ 77, 180]],\n",
" \n",
" [[ 77, 182]],\n",
" \n",
" [[ 78, 183]],\n",
" \n",
" [[ 78, 185]],\n",
" \n",
" [[ 77, 186]],\n",
" \n",
" [[ 77, 189]],\n",
" \n",
" [[ 76, 190]],\n",
" \n",
" [[ 76, 191]],\n",
" \n",
" [[ 75, 192]],\n",
" \n",
" [[ 72, 189]],\n",
" \n",
" [[ 72, 187]],\n",
" \n",
" [[ 71, 186]],\n",
" \n",
" [[ 72, 185]],\n",
" \n",
" [[ 72, 184]],\n",
" \n",
" [[ 73, 183]],\n",
" \n",
" [[ 72, 184]],\n",
" \n",
" [[ 71, 183]],\n",
" \n",
" [[ 71, 181]],\n",
" \n",
" [[ 70, 180]],\n",
" \n",
" [[ 70, 179]],\n",
" \n",
" [[ 69, 178]],\n",
" \n",
" [[ 68, 179]]], dtype=int32),\n",
" array([[[ 71, 190]],\n",
" \n",
" [[ 72, 189]],\n",
" \n",
" [[ 75, 192]],\n",
" \n",
" [[ 74, 193]],\n",
" \n",
" [[ 73, 193]],\n",
" \n",
" [[ 71, 191]]], dtype=int32),\n",
" array([[[ 69, 188]],\n",
" \n",
" [[ 70, 187]],\n",
" \n",
" [[ 71, 188]],\n",
" \n",
" [[ 71, 191]],\n",
" \n",
" [[ 70, 192]],\n",
" \n",
" [[ 69, 192]],\n",
" \n",
" [[ 68, 191]],\n",
" \n",
" [[ 69, 190]]], dtype=int32),\n",
" array([[[ 69, 181]],\n",
" \n",
" [[ 70, 180]],\n",
" \n",
" [[ 71, 181]],\n",
" \n",
" [[ 71, 185]],\n",
" \n",
" [[ 69, 187]],\n",
" \n",
" [[ 68, 186]],\n",
" \n",
" [[ 68, 185]],\n",
" \n",
" [[ 69, 184]]], dtype=int32),\n",
" array([[[ 64, 177]]], dtype=int32),\n",
" array([[[ 2, 176]]], dtype=int32),\n",
" array([[[ 0, 176]]], dtype=int32),\n",
" array([[[108, 175]]], dtype=int32),\n",
" array([[[ 46, 175]],\n",
" \n",
" [[ 46, 177]],\n",
" \n",
" [[ 45, 178]],\n",
" \n",
" [[ 46, 177]]], dtype=int32),\n",
" array([[[ 66, 174]],\n",
" \n",
" [[ 67, 174]]], dtype=int32),\n",
" array([[[ 56, 174]]], dtype=int32),\n",
" array([[[ 33, 173]],\n",
" \n",
" [[ 33, 174]],\n",
" \n",
" [[ 31, 176]],\n",
" \n",
" [[ 31, 178]],\n",
" \n",
" [[ 31, 176]],\n",
" \n",
" [[ 33, 174]]], dtype=int32),\n",
" array([[[ 61, 171]],\n",
" \n",
" [[ 59, 173]],\n",
" \n",
" [[ 59, 175]],\n",
" \n",
" [[ 59, 174]],\n",
" \n",
" [[ 61, 172]]], dtype=int32),\n",
" array([[[ 58, 170]]], dtype=int32),\n",
" array([[[ 34, 170]],\n",
" \n",
" [[ 34, 171]]], dtype=int32),\n",
" array([[[ 50, 167]],\n",
" \n",
" [[ 50, 171]],\n",
" \n",
" [[ 50, 170]],\n",
" \n",
" [[ 51, 169]],\n",
" \n",
" [[ 52, 170]],\n",
" \n",
" [[ 52, 171]],\n",
" \n",
" [[ 53, 172]],\n",
" \n",
" [[ 52, 173]],\n",
" \n",
" [[ 51, 173]],\n",
" \n",
" [[ 52, 174]],\n",
" \n",
" [[ 52, 175]],\n",
" \n",
" [[ 53, 175]],\n",
" \n",
" [[ 54, 176]],\n",
" \n",
" [[ 52, 174]],\n",
" \n",
" [[ 52, 173]],\n",
" \n",
" [[ 53, 172]],\n",
" \n",
" [[ 53, 171]],\n",
" \n",
" [[ 52, 170]],\n",
" \n",
" [[ 52, 169]]], dtype=int32),\n",
" array([[[111, 166]]], dtype=int32),\n",
" array([[[ 32, 166]]], dtype=int32),\n",
" array([[[ 34, 163]]], dtype=int32),\n",
" array([[[110, 162]],\n",
" \n",
" [[110, 163]]], dtype=int32),\n",
" array([[[ 61, 162]]], dtype=int32),\n",
" array([[[ 54, 161]],\n",
" \n",
" [[ 54, 162]],\n",
" \n",
" [[ 55, 163]],\n",
" \n",
" [[ 55, 164]],\n",
" \n",
" [[ 56, 165]],\n",
" \n",
" [[ 58, 165]],\n",
" \n",
" [[ 59, 166]],\n",
" \n",
" [[ 58, 167]],\n",
" \n",
" [[ 59, 167]],\n",
" \n",
" [[ 60, 168]],\n",
" \n",
" [[ 61, 168]],\n",
" \n",
" [[ 62, 169]],\n",
" \n",
" [[ 63, 169]],\n",
" \n",
" [[ 64, 170]],\n",
" \n",
" [[ 64, 172]],\n",
" \n",
" [[ 65, 172]],\n",
" \n",
" [[ 65, 170]],\n",
" \n",
" [[ 66, 169]],\n",
" \n",
" [[ 67, 169]],\n",
" \n",
" [[ 70, 172]],\n",
" \n",
" [[ 70, 173]],\n",
" \n",
" [[ 69, 174]],\n",
" \n",
" [[ 69, 176]],\n",
" \n",
" [[ 70, 176]],\n",
" \n",
" [[ 73, 179]],\n",
" \n",
" [[ 73, 180]],\n",
" \n",
" [[ 75, 182]],\n",
" \n",
" [[ 75, 183]],\n",
" \n",
" [[ 76, 184]],\n",
" \n",
" [[ 75, 183]],\n",
" \n",
" [[ 75, 181]],\n",
" \n",
" [[ 70, 176]],\n",
" \n",
" [[ 70, 175]],\n",
" \n",
" [[ 72, 173]],\n",
" \n",
" [[ 74, 175]],\n",
" \n",
" [[ 72, 173]],\n",
" \n",
" [[ 72, 172]],\n",
" \n",
" [[ 71, 172]],\n",
" \n",
" [[ 68, 169]],\n",
" \n",
" [[ 66, 169]],\n",
" \n",
" [[ 64, 167]],\n",
" \n",
" [[ 64, 165]],\n",
" \n",
" [[ 63, 164]],\n",
" \n",
" [[ 64, 165]],\n",
" \n",
" [[ 63, 166]],\n",
" \n",
" [[ 63, 167]],\n",
" \n",
" [[ 64, 168]],\n",
" \n",
" [[ 63, 169]],\n",
" \n",
" [[ 62, 169]],\n",
" \n",
" [[ 61, 168]],\n",
" \n",
" [[ 60, 168]],\n",
" \n",
" [[ 59, 167]],\n",
" \n",
" [[ 60, 166]],\n",
" \n",
" [[ 59, 166]],\n",
" \n",
" [[ 58, 165]],\n",
" \n",
" [[ 56, 165]],\n",
" \n",
" [[ 55, 164]],\n",
" \n",
" [[ 55, 163]],\n",
" \n",
" [[ 54, 162]]], dtype=int32),\n",
" array([[[ 53, 159]]], dtype=int32),\n",
" array([[[ 61, 158]],\n",
" \n",
" [[ 61, 159]],\n",
" \n",
" [[ 60, 160]],\n",
" \n",
" [[ 61, 159]],\n",
" \n",
" [[ 62, 160]],\n",
" \n",
" [[ 61, 159]]], dtype=int32),\n",
" array([[[ 40, 158]],\n",
" \n",
" [[ 40, 160]]], dtype=int32),\n",
" array([[[ 34, 157]],\n",
" \n",
" [[ 33, 158]],\n",
" \n",
" [[ 33, 159]],\n",
" \n",
" [[ 32, 160]],\n",
" \n",
" [[ 32, 162]],\n",
" \n",
" [[ 32, 161]],\n",
" \n",
" [[ 33, 160]],\n",
" \n",
" [[ 33, 159]],\n",
" \n",
" [[ 34, 158]]], dtype=int32),\n",
" array([[[101, 154]]], dtype=int32),\n",
" array([[[ 60, 154]]], dtype=int32),\n",
" array([[[ 54, 154]]], dtype=int32),\n",
" array([[[ 51, 154]],\n",
" \n",
" [[ 51, 157]],\n",
" \n",
" [[ 50, 158]],\n",
" \n",
" [[ 50, 165]],\n",
" \n",
" [[ 50, 163]],\n",
" \n",
" [[ 51, 162]],\n",
" \n",
" [[ 52, 162]],\n",
" \n",
" [[ 51, 161]],\n",
" \n",
" [[ 51, 160]],\n",
" \n",
" [[ 50, 159]],\n",
" \n",
" [[ 51, 158]]], dtype=int32),\n",
" array([[[ 37, 152]],\n",
" \n",
" [[ 37, 153]],\n",
" \n",
" [[ 35, 155]],\n",
" \n",
" [[ 37, 153]]], dtype=int32),\n",
" array([[[102, 151]],\n",
" \n",
" [[103, 152]],\n",
" \n",
" [[103, 153]],\n",
" \n",
" [[104, 152]],\n",
" \n",
" [[103, 152]]], dtype=int32),\n",
" array([[[ 60, 151]]], dtype=int32),\n",
" array([[[100, 150]],\n",
" \n",
" [[100, 151]]], dtype=int32),\n",
" array([[[ 62, 150]],\n",
" \n",
" [[ 62, 152]],\n",
" \n",
" [[ 63, 152]],\n",
" \n",
" [[ 62, 151]],\n",
" \n",
" [[ 63, 150]]], dtype=int32),\n",
" array([[[ 37, 150]]], dtype=int32),\n",
" array([[[ 34, 149]],\n",
" \n",
" [[ 34, 150]],\n",
" \n",
" [[ 35, 149]]], dtype=int32),\n",
" array([[[ 60, 148]],\n",
" \n",
" [[ 60, 149]]], dtype=int32),\n",
" array([[[ 42, 148]]], dtype=int32),\n",
" array([[[ 37, 146]],\n",
" \n",
" [[ 36, 147]]], dtype=int32),\n",
" array([[[ 46, 145]],\n",
" \n",
" [[ 45, 146]],\n",
" \n",
" [[ 46, 146]]], dtype=int32),\n",
" array([[[ 65, 144]],\n",
" \n",
" [[ 65, 146]],\n",
" \n",
" [[ 66, 145]]], dtype=int32),\n",
" array([[[ 71, 142]],\n",
" \n",
" [[ 72, 142]]], dtype=int32),\n",
" array([[[ 53, 141]]], dtype=int32),\n",
" array([[[ 49, 141]]], dtype=int32),\n",
" array([[[ 43, 141]]], dtype=int32),\n",
" array([[[ 36, 140]]], dtype=int32),\n",
" array([[[ 69, 139]]], dtype=int32),\n",
" array([[[ 50, 138]]], dtype=int32),\n",
" array([[[ 72, 137]],\n",
" \n",
" [[ 71, 138]],\n",
" \n",
" [[ 73, 140]],\n",
" \n",
" [[ 71, 138]]], dtype=int32),\n",
" array([[[ 38, 137]],\n",
" \n",
" [[ 37, 138]],\n",
" \n",
" [[ 38, 138]]], dtype=int32),\n",
" array([[[ 55, 136]],\n",
" \n",
" [[ 55, 140]],\n",
" \n",
" [[ 56, 141]],\n",
" \n",
" [[ 56, 144]],\n",
" \n",
" [[ 58, 146]],\n",
" \n",
" [[ 58, 147]],\n",
" \n",
" [[ 58, 146]],\n",
" \n",
" [[ 59, 145]],\n",
" \n",
" [[ 59, 143]],\n",
" \n",
" [[ 59, 145]],\n",
" \n",
" [[ 58, 146]],\n",
" \n",
" [[ 57, 145]],\n",
" \n",
" [[ 57, 143]],\n",
" \n",
" [[ 56, 142]],\n",
" \n",
" [[ 56, 140]],\n",
" \n",
" [[ 55, 139]]], dtype=int32),\n",
" array([[[ 57, 135]]], dtype=int32),\n",
" array([[[ 53, 135]],\n",
" \n",
" [[ 53, 136]]], dtype=int32),\n",
" array([[[ 75, 134]],\n",
" \n",
" [[ 74, 135]],\n",
" \n",
" [[ 74, 136]],\n",
" \n",
" [[ 75, 137]],\n",
" \n",
" [[ 76, 137]],\n",
" \n",
" [[ 76, 135]]], dtype=int32),\n",
" array([[[ 55, 134]]], dtype=int32),\n",
" array([[[ 32, 134]]], dtype=int32),\n",
" array([[[ 44, 133]],\n",
" \n",
" [[ 44, 134]],\n",
" \n",
" [[ 43, 135]],\n",
" \n",
" [[ 44, 134]]], dtype=int32),\n",
" array([[[ 48, 132]]], dtype=int32),\n",
" array([[[ 41, 132]],\n",
" \n",
" [[ 40, 133]],\n",
" \n",
" [[ 39, 133]],\n",
" \n",
" [[ 38, 134]],\n",
" \n",
" [[ 36, 134]],\n",
" \n",
" [[ 34, 136]],\n",
" \n",
" [[ 35, 136]],\n",
" \n",
" [[ 37, 134]],\n",
" \n",
" [[ 38, 135]],\n",
" \n",
" [[ 41, 132]],\n",
" \n",
" [[ 42, 132]]], dtype=int32),\n",
" array([[[ 38, 130]],\n",
" \n",
" [[ 38, 131]]], dtype=int32),\n",
" array([[[100, 129]],\n",
" \n",
" [[ 99, 130]],\n",
" \n",
" [[ 99, 132]],\n",
" \n",
" [[101, 134]],\n",
" \n",
" [[102, 134]],\n",
" \n",
" [[101, 134]],\n",
" \n",
" [[100, 133]],\n",
" \n",
" [[100, 132]],\n",
" \n",
" [[ 99, 131]],\n",
" \n",
" [[ 99, 130]]], dtype=int32),\n",
" array([[[ 75, 128]],\n",
" \n",
" [[ 75, 131]],\n",
" \n",
" [[ 76, 131]],\n",
" \n",
" [[ 77, 132]],\n",
" \n",
" [[ 77, 133]],\n",
" \n",
" [[ 79, 135]],\n",
" \n",
" [[ 79, 133]],\n",
" \n",
" [[ 78, 133]],\n",
" \n",
" [[ 77, 132]],\n",
" \n",
" [[ 77, 131]],\n",
" \n",
" [[ 76, 131]],\n",
" \n",
" [[ 75, 130]]], dtype=int32),\n",
" array([[[ 54, 128]],\n",
" \n",
" [[ 55, 129]],\n",
" \n",
" [[ 54, 130]],\n",
" \n",
" [[ 54, 132]],\n",
" \n",
" [[ 54, 130]],\n",
" \n",
" [[ 55, 129]],\n",
" \n",
" [[ 56, 129]],\n",
" \n",
" [[ 57, 128]],\n",
" \n",
" [[ 58, 128]],\n",
" \n",
" [[ 57, 128]],\n",
" \n",
" [[ 56, 129]],\n",
" \n",
" [[ 55, 129]]], dtype=int32),\n",
" array([[[ 42, 127]],\n",
" \n",
" [[ 41, 128]],\n",
" \n",
" [[ 41, 129]],\n",
" \n",
" [[ 43, 127]],\n",
" \n",
" [[ 46, 127]]], dtype=int32),\n",
" array([[[ 39, 127]],\n",
" \n",
" [[ 38, 128]],\n",
" \n",
" [[ 37, 128]],\n",
" \n",
" [[ 36, 129]],\n",
" \n",
" [[ 37, 128]],\n",
" \n",
" [[ 39, 128]]], dtype=int32),\n",
" array([[[ 74, 126]],\n",
" \n",
" [[ 73, 127]],\n",
" \n",
" [[ 72, 127]],\n",
" \n",
" [[ 73, 127]]], dtype=int32),\n",
" array([[[ 69, 126]],\n",
" \n",
" [[ 70, 126]]], dtype=int32),\n",
" array([[[ 56, 126]]], dtype=int32),\n",
" array([[[ 38, 125]]], dtype=int32),\n",
" array([[[ 73, 123]]], dtype=int32),\n",
" array([[[ 58, 123]],\n",
" \n",
" [[ 58, 124]],\n",
" \n",
" [[ 59, 123]]], dtype=int32),\n",
" array([[[ 56, 123]]], dtype=int32),\n",
" array([[[ 59, 121]]], dtype=int32),\n",
" array([[[ 92, 120]]], dtype=int32),\n",
" array([[[ 70, 120]],\n",
" \n",
" [[ 70, 122]],\n",
" \n",
" [[ 71, 123]],\n",
" \n",
" [[ 70, 122]]], dtype=int32),\n",
" array([[[ 34, 120]],\n",
" \n",
" [[ 35, 121]],\n",
" \n",
" [[ 34, 122]],\n",
" \n",
" [[ 35, 123]],\n",
" \n",
" [[ 34, 122]],\n",
" \n",
" [[ 35, 121]]], dtype=int32),\n",
" array([[[105, 119]]], dtype=int32),\n",
" array([[[ 72, 119]],\n",
" \n",
" [[ 72, 120]],\n",
" \n",
" [[ 73, 121]],\n",
" \n",
" [[ 72, 120]]], dtype=int32),\n",
" array([[[ 42, 119]]], dtype=int32),\n",
" array([[[128, 118]],\n",
" \n",
" [[129, 118]]], dtype=int32),\n",
" array([[[113, 118]]], dtype=int32),\n",
" array([[[108, 118]]], dtype=int32),\n",
" array([[[127, 116]]], dtype=int32),\n",
" array([[[ 70, 116]]], dtype=int32),\n",
" array([[[ 72, 115]],\n",
" \n",
" [[ 73, 115]]], dtype=int32),\n",
" array([[[ 68, 114]]], dtype=int32),\n",
" array([[[ 73, 113]]], dtype=int32),\n",
" array([[[ 35, 113]]], dtype=int32),\n",
" array([[[ 0, 111]]], dtype=int32),\n",
" array([[[ 9, 109]]], dtype=int32),\n",
" array([[[ 76, 107]],\n",
" \n",
" [[ 76, 110]]], dtype=int32),\n",
" array([[[ 50, 106]],\n",
" \n",
" [[ 49, 107]],\n",
" \n",
" [[ 50, 107]],\n",
" \n",
" [[ 51, 106]],\n",
" \n",
" [[ 52, 106]]], dtype=int32),\n",
" array([[[ 69, 105]]], dtype=int32),\n",
" array([[[ 56, 105]]], dtype=int32),\n",
" array([[[181, 104]]], dtype=int32),\n",
" array([[[ 55, 103]]], dtype=int32),\n",
" array([[[ 44, 103]]], dtype=int32),\n",
" array([[[ 41, 103]],\n",
" \n",
" [[ 40, 104]]], dtype=int32),\n",
" array([[[ 66, 101]],\n",
" \n",
" [[ 67, 101]]], dtype=int32),\n",
" array([[[ 52, 101]],\n",
" \n",
" [[ 52, 102]],\n",
" \n",
" [[ 51, 103]],\n",
" \n",
" [[ 50, 102]],\n",
" \n",
" [[ 51, 103]],\n",
" \n",
" [[ 50, 104]],\n",
" \n",
" [[ 52, 102]],\n",
" \n",
" [[ 53, 103]],\n",
" \n",
" [[ 52, 102]]], dtype=int32),\n",
" array([[[100, 100]],\n",
" \n",
" [[100, 101]]], dtype=int32),\n",
" array([[[ 96, 100]]], dtype=int32),\n",
" array([[[99, 98]]], dtype=int32),\n",
" array([[[ 63, 98]],\n",
" \n",
" [[ 64, 99]],\n",
" \n",
" [[ 64, 100]],\n",
" \n",
" [[ 64, 99]]], dtype=int32),\n",
" array([[[48, 98]],\n",
" \n",
" [[48, 99]],\n",
" \n",
" [[49, 99]],\n",
" \n",
" [[50, 98]],\n",
" \n",
" [[51, 99]],\n",
" \n",
" [[50, 98]]], dtype=int32),\n",
" array([[[99, 96]]], dtype=int32),\n",
" array([[[50, 96]]], dtype=int32),\n",
" array([[[49, 94]]], dtype=int32),\n",
" array([[[ 4, 94]]], dtype=int32),\n",
" array([[[ 1, 94]]], dtype=int32),\n",
" array([[[ 1, 92]]], dtype=int32),\n",
" array([[[115, 90]],\n",
" \n",
" [[116, 90]]], dtype=int32),\n",
" array([[[47, 90]]], dtype=int32),\n",
" array([[[42, 90]]], dtype=int32),\n",
" array([[[114, 88]],\n",
" \n",
" [[113, 89]],\n",
" \n",
" [[113, 90]],\n",
" \n",
" [[113, 89]]], dtype=int32),\n",
" array([[[97, 88]]], dtype=int32),\n",
" array([[[110, 85]],\n",
" \n",
" [[109, 86]]], dtype=int32),\n",
" array([[[ 2, 85]]], dtype=int32),\n",
" array([[[107, 83]]], dtype=int32),\n",
" array([[[91, 83]],\n",
" \n",
" [[90, 84]],\n",
" \n",
" [[90, 85]],\n",
" \n",
" [[90, 84]],\n",
" \n",
" [[91, 83]],\n",
" \n",
" [[92, 83]]], dtype=int32),\n",
" array([[[112, 81]]], dtype=int32),\n",
" array([[[110, 81]]], dtype=int32),\n",
" array([[[96, 81]],\n",
" \n",
" [[96, 82]]], dtype=int32),\n",
" array([[[67, 81]]], dtype=int32),\n",
" array([[[40, 81]]], dtype=int32),\n",
" array([[[100, 80]],\n",
" \n",
" [[101, 80]]], dtype=int32),\n",
" array([[[69, 80]]], dtype=int32),\n",
" array([[[67, 78]]], dtype=int32),\n",
" array([[[ 3, 77]]], dtype=int32),\n",
" array([[[ 99, 76]],\n",
" \n",
" [[ 99, 77]],\n",
" \n",
" [[100, 77]]], dtype=int32),\n",
" array([[[97, 76]],\n",
" \n",
" [[96, 77]],\n",
" \n",
" [[95, 77]],\n",
" \n",
" [[95, 78]],\n",
" \n",
" [[94, 79]],\n",
" \n",
" [[95, 79]],\n",
" \n",
" [[97, 77]]], dtype=int32),\n",
" array([[[46, 75]]], dtype=int32),\n",
" array([[[44, 73]]], dtype=int32),\n",
" array([[[67, 66]]], dtype=int32),\n",
" array([[[76, 63]]], dtype=int32),\n",
" array([[[48, 63]],\n",
" \n",
" [[47, 64]]], dtype=int32),\n",
" array([[[36, 63]]], dtype=int32),\n",
" array([[[68, 62]]], dtype=int32),\n",
" array([[[63, 62]]], dtype=int32),\n",
" array([[[38, 62]]], dtype=int32),\n",
" array([[[72, 61]],\n",
" \n",
" [[72, 62]],\n",
" \n",
" [[71, 63]],\n",
" \n",
" [[72, 62]],\n",
" \n",
" [[74, 64]],\n",
" \n",
" [[72, 66]],\n",
" \n",
" [[71, 65]],\n",
" \n",
" [[70, 66]],\n",
" \n",
" [[70, 68]],\n",
" \n",
" [[70, 66]],\n",
" \n",
" [[71, 65]],\n",
" \n",
" [[72, 66]],\n",
" \n",
" [[73, 66]],\n",
" \n",
" [[73, 65]],\n",
" \n",
" [[74, 64]],\n",
" \n",
" [[74, 63]]], dtype=int32),\n",
" array([[[36, 61]]], dtype=int32),\n",
" array([[[ 3, 61]]], dtype=int32),\n",
" array([[[38, 60]]], dtype=int32),\n",
" array([[[68, 59]]], dtype=int32),\n",
" array([[[43, 59]],\n",
" \n",
" [[42, 60]]], dtype=int32),\n",
" array([[[71, 58]]], dtype=int32),\n",
" array([[[50, 58]]], dtype=int32),\n",
" array([[[66, 57]],\n",
" \n",
" [[66, 58]]], dtype=int32),\n",
" array([[[75, 56]]], dtype=int32),\n",
" array([[[52, 55]],\n",
" \n",
" [[51, 56]]], dtype=int32),\n",
" array([[[48, 54]],\n",
" \n",
" [[49, 55]],\n",
" \n",
" [[50, 54]],\n",
" \n",
" [[49, 55]]], dtype=int32),\n",
" array([[[69, 52]],\n",
" \n",
" [[69, 53]]], dtype=int32),\n",
" array([[[61, 51]]], dtype=int32),\n",
" array([[[50, 51]],\n",
" \n",
" [[50, 52]]], dtype=int32),\n",
" array([[[70, 50]]], dtype=int32),\n",
" array([[[68, 50]]], dtype=int32),\n",
" array([[[66, 49]],\n",
" \n",
" [[66, 50]]], dtype=int32),\n",
" array([[[50, 49]]], dtype=int32),\n",
" array([[[72, 48]]], dtype=int32),\n",
" array([[[47, 48]]], dtype=int32),\n",
" array([[[68, 47]]], dtype=int32),\n",
" array([[[65, 47]]], dtype=int32),\n",
" array([[[71, 46]]], dtype=int32),\n",
" array([[[54, 46]]], dtype=int32),\n",
" array([[[65, 44]],\n",
" \n",
" [[65, 45]]], dtype=int32),\n",
" array([[[75, 42]],\n",
" \n",
" [[76, 43]],\n",
" \n",
" [[77, 42]]], dtype=int32),\n",
" array([[[72, 41]],\n",
" \n",
" [[71, 42]],\n",
" \n",
" [[71, 43]],\n",
" \n",
" [[72, 44]],\n",
" \n",
" [[73, 44]],\n",
" \n",
" [[72, 44]],\n",
" \n",
" [[71, 43]],\n",
" \n",
" [[71, 42]]], dtype=int32),\n",
" array([[[80, 40]],\n",
" \n",
" [[79, 41]],\n",
" \n",
" [[80, 40]],\n",
" \n",
" [[81, 40]]], dtype=int32),\n",
" array([[[68, 40]]], dtype=int32),\n",
" array([[[ 0, 40]]], dtype=int32),\n",
" array([[[69, 38]]], dtype=int32),\n",
" array([[[71, 37]]], dtype=int32),\n",
" array([[[62, 37]]], dtype=int32),\n",
" array([[[56, 37]]], dtype=int32),\n",
" array([[[54, 37]],\n",
" \n",
" [[54, 40]],\n",
" \n",
" [[55, 40]],\n",
" \n",
" [[55, 39]],\n",
" \n",
" [[54, 38]]], dtype=int32),\n",
" array([[[52, 36]],\n",
" \n",
" [[52, 37]]], dtype=int32),\n",
" array([[[49, 36]],\n",
" \n",
" [[49, 37]],\n",
" \n",
" [[50, 37]],\n",
" \n",
" [[50, 36]]], dtype=int32),\n",
" array([[[70, 35]]], dtype=int32),\n",
" array([[[144, 33]]], dtype=int32),\n",
" array([[[140, 33]]], dtype=int32),\n",
" array([[[131, 32]]], dtype=int32),\n",
" array([[[74, 32]],\n",
" \n",
" [[75, 33]],\n",
" \n",
" [[75, 35]],\n",
" \n",
" [[76, 36]],\n",
" \n",
" [[75, 37]],\n",
" \n",
" [[76, 38]],\n",
" \n",
" [[77, 37]],\n",
" \n",
" [[77, 36]],\n",
" \n",
" [[78, 35]],\n",
" \n",
" [[77, 36]],\n",
" \n",
" [[76, 36]],\n",
" \n",
" [[75, 35]],\n",
" \n",
" [[77, 33]],\n",
" \n",
" [[78, 33]],\n",
" \n",
" [[77, 33]],\n",
" \n",
" [[76, 34]]], dtype=int32),\n",
" array([[[75, 37]],\n",
" \n",
" [[76, 36]],\n",
" \n",
" [[77, 37]],\n",
" \n",
" [[76, 38]]], dtype=int32),\n",
" array([[[137, 31]]], dtype=int32),\n",
" array([[[40, 31]]], dtype=int32),\n",
" array([[[144, 30]]], dtype=int32),\n",
" array([[[73, 29]],\n",
" \n",
" [[73, 30]],\n",
" \n",
" [[74, 30]]], dtype=int32),\n",
" array([[[56, 29]],\n",
" \n",
" [[56, 30]],\n",
" \n",
" [[57, 31]],\n",
" \n",
" [[57, 32]],\n",
" \n",
" [[58, 33]],\n",
" \n",
" [[58, 35]],\n",
" \n",
" [[58, 32]],\n",
" \n",
" [[57, 31]],\n",
" \n",
" [[58, 30]],\n",
" \n",
" [[59, 30]],\n",
" \n",
" [[59, 29]],\n",
" \n",
" [[57, 31]],\n",
" \n",
" [[56, 30]]], dtype=int32),\n",
" array([[[53, 29]],\n",
" \n",
" [[53, 30]]], dtype=int32),\n",
" array([[[51, 29]]], dtype=int32),\n",
" array([[[49, 29]],\n",
" \n",
" [[49, 30]]], dtype=int32),\n",
" array([[[46, 29]]], dtype=int32),\n",
" array([[[128, 28]]], dtype=int32),\n",
" array([[[42, 28]]], dtype=int32),\n",
" array([[[46, 27]],\n",
" \n",
" [[47, 27]]], dtype=int32),\n",
" array([[[134, 26]],\n",
" \n",
" [[133, 27]],\n",
" \n",
" [[135, 29]],\n",
" \n",
" [[135, 28]],\n",
" \n",
" [[134, 27]]], dtype=int32),\n",
" array([[[58, 26]],\n",
" \n",
" [[57, 27]]], dtype=int32),\n",
" array([[[55, 25]],\n",
" \n",
" [[55, 26]]], dtype=int32),\n",
" array([[[53, 25]]], dtype=int32),\n",
" array([[[50, 24]],\n",
" \n",
" [[50, 27]]], dtype=int32),\n",
" array([[[141, 23]]], dtype=int32),\n",
" array([[[48, 23]]], dtype=int32),\n",
" array([[[39, 23]]], dtype=int32),\n",
" array([[[138, 22]]], dtype=int32),\n",
" array([[[35, 22]]], dtype=int32),\n",
" array([[[200, 21]]], dtype=int32),\n",
" array([[[141, 21]]], dtype=int32),\n",
" array([[[47, 21]]], dtype=int32),\n",
" array([[[138, 20]]], dtype=int32),\n",
" array([[[117, 20]],\n",
" \n",
" [[117, 21]],\n",
" \n",
" [[119, 21]],\n",
" \n",
" [[118, 20]]], dtype=int32),\n",
" array([[[202, 19]],\n",
" \n",
" [[202, 21]]], dtype=int32),\n",
" array([[[44, 19]]], dtype=int32),\n",
" array([[[144, 18]],\n",
" \n",
" [[144, 19]]], dtype=int32),\n",
" array([[[198, 16]],\n",
" \n",
" [[198, 17]]], dtype=int32),\n",
" array([[[48, 16]],\n",
" \n",
" [[47, 17]]], dtype=int32),\n",
" array([[[33, 16]]], dtype=int32),\n",
" array([[[35, 15]]], dtype=int32),\n",
" array([[[40, 14]]], dtype=int32),\n",
" array([[[194, 12]]], dtype=int32),\n",
" array([[[197, 11]],\n",
" \n",
" [[198, 11]],\n",
" \n",
" [[199, 12]],\n",
" \n",
" [[199, 14]],\n",
" \n",
" [[200, 14]],\n",
" \n",
" [[199, 13]],\n",
" \n",
" [[200, 12]],\n",
" \n",
" [[202, 12]],\n",
" \n",
" [[203, 11]]], dtype=int32),\n",
" array([[[137, 11]],\n",
" \n",
" [[136, 12]],\n",
" \n",
" [[137, 12]],\n",
" \n",
" [[139, 14]],\n",
" \n",
" [[140, 13]],\n",
" \n",
" [[139, 14]],\n",
" \n",
" [[137, 12]]], dtype=int32),\n",
" array([[[140, 10]]], dtype=int32),\n",
" array([[[203, 7]]], dtype=int32),\n",
" array([[[139, 7]]], dtype=int32),\n",
" array([[[47, 7]],\n",
" \n",
" [[45, 9]]], dtype=int32),\n",
" array([[[196, 6]],\n",
" \n",
" [[195, 7]],\n",
" \n",
" [[196, 8]],\n",
" \n",
" [[195, 7]]], dtype=int32),\n",
" array([[[51, 6]],\n",
" \n",
" [[52, 7]]], dtype=int32),\n",
" array([[[138, 5]]], dtype=int32),\n",
" array([[[53, 5]]], dtype=int32),\n",
" array([[[210, 3]],\n",
" \n",
" [[211, 3]]], dtype=int32),\n",
" array([[[207, 3]],\n",
" \n",
" [[207, 4]],\n",
" \n",
" [[208, 4]]], dtype=int32),\n",
" array([[[200, 3]],\n",
" \n",
" [[201, 3]]], dtype=int32),\n",
" array([[[136, 3]]], dtype=int32),\n",
" array([[[50, 2]],\n",
" \n",
" [[49, 3]],\n",
" \n",
" [[49, 5]],\n",
" \n",
" [[49, 3]]], dtype=int32),\n",
" array([[[38, 2]]], dtype=int32),\n",
" array([[[195, 1]],\n",
" \n",
" [[195, 2]],\n",
" \n",
" [[196, 3]],\n",
" \n",
" [[195, 4]],\n",
" \n",
" [[196, 3]],\n",
" \n",
" [[197, 3]],\n",
" \n",
" [[199, 5]],\n",
" \n",
" [[199, 6]],\n",
" \n",
" [[198, 7]],\n",
" \n",
" [[199, 6]],\n",
" \n",
" [[200, 7]],\n",
" \n",
" [[200, 8]],\n",
" \n",
" [[201, 7]],\n",
" \n",
" [[200, 7]],\n",
" \n",
" [[199, 6]],\n",
" \n",
" [[199, 5]],\n",
" \n",
" [[197, 3]],\n",
" \n",
" [[197, 2]],\n",
" \n",
" [[198, 1]],\n",
" \n",
" [[196, 3]],\n",
" \n",
" [[195, 2]]], dtype=int32),\n",
" array([[[191, 1]],\n",
" \n",
" [[190, 2]],\n",
" \n",
" [[191, 3]]], dtype=int32),\n",
" array([[[45, 1]],\n",
" \n",
" [[46, 1]]], dtype=int32),\n",
" array([[[214, 0]],\n",
" \n",
" [[213, 1]],\n",
" \n",
" [[214, 2]],\n",
" \n",
" [[213, 3]],\n",
" \n",
" [[214, 4]],\n",
" \n",
" [[214, 5]],\n",
" \n",
" [[213, 6]],\n",
" \n",
" [[212, 5]],\n",
" \n",
" [[211, 5]],\n",
" \n",
" [[210, 6]],\n",
" \n",
" [[208, 6]],\n",
" \n",
" [[206, 8]],\n",
" \n",
" [[205, 7]],\n",
" \n",
" [[206, 8]],\n",
" \n",
" [[208, 8]],\n",
" \n",
" [[210, 6]],\n",
" \n",
" [[211, 7]],\n",
" \n",
" [[212, 7]],\n",
" \n",
" [[213, 8]],\n",
" \n",
" [[212, 9]],\n",
" \n",
" [[210, 9]],\n",
" \n",
" [[209, 10]],\n",
" \n",
" [[206, 10]],\n",
" \n",
" [[207, 10]],\n",
" \n",
" [[208, 11]],\n",
" \n",
" [[207, 12]],\n",
" \n",
" [[206, 12]],\n",
" \n",
" [[205, 13]],\n",
" \n",
" [[204, 13]],\n",
" \n",
" [[205, 14]],\n",
" \n",
" [[204, 15]],\n",
" \n",
" [[202, 15]],\n",
" \n",
" [[202, 16]],\n",
" \n",
" [[203, 15]],\n",
" \n",
" [[205, 17]],\n",
" \n",
" [[205, 18]],\n",
" \n",
" [[207, 16]],\n",
" \n",
" [[207, 12]],\n",
" \n",
" [[208, 11]],\n",
" \n",
" [[209, 12]],\n",
" \n",
" [[211, 12]],\n",
" \n",
" [[213, 10]],\n",
" \n",
" [[213, 9]],\n",
" \n",
" [[214, 8]],\n",
" \n",
" [[215, 8]],\n",
" \n",
" [[216, 7]],\n",
" \n",
" [[216, 6]],\n",
" \n",
" [[217, 5]],\n",
" \n",
" [[218, 5]],\n",
" \n",
" [[221, 2]],\n",
" \n",
" [[222, 2]],\n",
" \n",
" [[223, 1]],\n",
" \n",
" [[224, 1]],\n",
" \n",
" [[224, 0]],\n",
" \n",
" [[221, 0]],\n",
" \n",
" [[221, 2]],\n",
" \n",
" [[220, 3]],\n",
" \n",
" [[218, 1]],\n",
" \n",
" [[218, 0]]], dtype=int32),\n",
" array([[[204, 16]],\n",
" \n",
" [[205, 15]],\n",
" \n",
" [[206, 16]],\n",
" \n",
" [[205, 17]]], dtype=int32),\n",
" array([[[210, 6]],\n",
" \n",
" [[211, 5]],\n",
" \n",
" [[212, 5]],\n",
" \n",
" [[213, 6]],\n",
" \n",
" [[212, 7]],\n",
" \n",
" [[211, 7]]], dtype=int32),\n",
" array([[[214, 5]],\n",
" \n",
" [[215, 4]],\n",
" \n",
" [[216, 4]],\n",
" \n",
" [[217, 5]],\n",
" \n",
" [[216, 6]],\n",
" \n",
" [[215, 6]]], dtype=int32),\n",
" array([[[216, 0]],\n",
" \n",
" [[217, 0]],\n",
" \n",
" [[218, 1]],\n",
" \n",
" [[217, 2]],\n",
" \n",
" [[218, 1]],\n",
" \n",
" [[220, 3]],\n",
" \n",
" [[219, 4]],\n",
" \n",
" [[215, 4]],\n",
" \n",
" [[214, 3]],\n",
" \n",
" [[214, 2]]], dtype=int32),\n",
" array([[[213, 1]],\n",
" \n",
" [[214, 0]],\n",
" \n",
" [[215, 1]],\n",
" \n",
" [[214, 2]]], dtype=int32),\n",
" array([[[209, 0]],\n",
" \n",
" [[208, 1]],\n",
" \n",
" [[209, 0]],\n",
" \n",
" [[210, 1]]], dtype=int32),\n",
" array([[[203, 0]],\n",
" \n",
" [[205, 2]],\n",
" \n",
" [[204, 3]],\n",
" \n",
" [[203, 3]],\n",
" \n",
" [[204, 3]],\n",
" \n",
" [[205, 4]],\n",
" \n",
" [[204, 5]],\n",
" \n",
" [[205, 5]],\n",
" \n",
" [[205, 2]],\n",
" \n",
" [[206, 1]],\n",
" \n",
" [[205, 2]]], dtype=int32),\n",
" array([[[193, 0]],\n",
" \n",
" [[193, 3]]], dtype=int32),\n",
" array([[[137, 0]]], dtype=int32),\n",
" array([[[131, 0]],\n",
" \n",
" [[131, 2]],\n",
" \n",
" [[129, 4]],\n",
" \n",
" [[128, 4]],\n",
" \n",
" [[128, 5]],\n",
" \n",
" [[129, 4]],\n",
" \n",
" [[130, 4]],\n",
" \n",
" [[134, 0]],\n",
" \n",
" [[133, 0]],\n",
" \n",
" [[132, 1]]], dtype=int32),\n",
" array([[[126, 0]],\n",
" \n",
" [[126, 1]],\n",
" \n",
" [[127, 2]],\n",
" \n",
" [[128, 1]],\n",
" \n",
" [[128, 0]]], dtype=int32),\n",
" array([[[55, 0]],\n",
" \n",
" [[55, 1]],\n",
" \n",
" [[54, 2]],\n",
" \n",
" ...,\n",
" \n",
" [[58, 0]],\n",
" \n",
" [[57, 0]],\n",
" \n",
" [[56, 1]]], dtype=int32),\n",
" array([[[130, 223]],\n",
" \n",
" [[131, 222]],\n",
" \n",
" [[132, 223]],\n",
" \n",
" [[131, 224]]], dtype=int32),\n",
" array([[[122, 223]],\n",
" \n",
" [[123, 222]],\n",
" \n",
" [[124, 223]],\n",
" \n",
" [[123, 224]]], dtype=int32),\n",
" array([[[111, 223]],\n",
" \n",
" [[112, 222]],\n",
" \n",
" [[113, 223]],\n",
" \n",
" [[112, 224]]], dtype=int32),\n",
" array([[[101, 223]],\n",
" \n",
" [[102, 222]],\n",
" \n",
" [[103, 223]],\n",
" \n",
" [[102, 224]]], dtype=int32),\n",
" array([[[ 96, 223]],\n",
" \n",
" [[ 97, 222]],\n",
" \n",
" [[ 98, 223]],\n",
" \n",
" [[ 97, 224]]], dtype=int32),\n",
" array([[[ 94, 223]],\n",
" \n",
" [[ 95, 222]],\n",
" \n",
" [[ 96, 223]],\n",
" \n",
" [[ 95, 224]]], dtype=int32),\n",
" array([[[116, 222]],\n",
" \n",
" [[117, 221]],\n",
" \n",
" [[118, 222]],\n",
" \n",
" [[117, 223]]], dtype=int32),\n",
" array([[[110, 222]],\n",
" \n",
" [[111, 221]],\n",
" \n",
" [[112, 222]],\n",
" \n",
" [[111, 223]]], dtype=int32),\n",
" array([[[108, 222]],\n",
" \n",
" [[109, 221]],\n",
" \n",
" [[110, 222]],\n",
" \n",
" [[109, 223]]], dtype=int32),\n",
" array([[[106, 222]],\n",
" \n",
" [[107, 221]],\n",
" \n",
" [[108, 222]],\n",
" \n",
" [[107, 223]]], dtype=int32),\n",
" array([[[102, 222]],\n",
" \n",
" [[103, 221]],\n",
" \n",
" [[104, 222]],\n",
" \n",
" [[103, 223]]], dtype=int32),\n",
" array([[[ 97, 222]],\n",
" \n",
" [[ 98, 221]],\n",
" \n",
" [[ 99, 222]],\n",
" \n",
" [[ 98, 223]]], dtype=int32),\n",
" array([[[ 95, 222]],\n",
" \n",
" [[ 96, 221]],\n",
" \n",
" [[ 97, 222]],\n",
" \n",
" [[ 96, 223]]], dtype=int32),\n",
" array([[[132, 221]],\n",
" \n",
" [[133, 220]],\n",
" \n",
" [[134, 221]],\n",
" \n",
" [[133, 222]]], dtype=int32),\n",
" array([[[115, 221]],\n",
" \n",
" [[116, 220]],\n",
" \n",
" [[117, 221]],\n",
" \n",
" [[116, 222]]], dtype=int32),\n",
" array([[[111, 221]],\n",
" \n",
" [[112, 220]],\n",
" \n",
" [[113, 221]],\n",
" \n",
" [[112, 222]]], dtype=int32),\n",
" array([[[107, 221]],\n",
" \n",
" [[108, 220]],\n",
" \n",
" [[109, 221]],\n",
" \n",
" [[108, 222]]], dtype=int32),\n",
" array([[[ 96, 221]],\n",
" \n",
" [[ 97, 220]],\n",
" \n",
" [[ 98, 221]],\n",
" \n",
" [[ 97, 222]]], dtype=int32),\n",
" array([[[113, 220]],\n",
" \n",
" [[114, 219]],\n",
" \n",
" [[115, 220]],\n",
" \n",
" [[114, 221]]], dtype=int32),\n",
" array([[[104, 220]],\n",
" \n",
" [[105, 219]],\n",
" \n",
" [[106, 220]],\n",
" \n",
" [[106, 222]],\n",
" \n",
" [[105, 223]],\n",
" \n",
" [[104, 222]]], dtype=int32),\n",
" array([[[134, 219]],\n",
" \n",
" [[135, 218]],\n",
" \n",
" [[136, 218]],\n",
" \n",
" [[137, 219]],\n",
" \n",
" [[135, 221]],\n",
" \n",
" [[134, 220]]], dtype=int32),\n",
" array([[[102, 219]],\n",
" \n",
" [[103, 218]],\n",
" \n",
" [[104, 219]],\n",
" \n",
" [[104, 220]],\n",
" \n",
" [[103, 221]],\n",
" \n",
" [[102, 220]]], dtype=int32),\n",
" array([[[100, 219]],\n",
" \n",
" [[101, 218]],\n",
" \n",
" [[102, 219]],\n",
" \n",
" [[102, 220]],\n",
" \n",
" [[101, 221]],\n",
" \n",
" [[100, 220]]], dtype=int32),\n",
" array([[[106, 218]],\n",
" \n",
" [[107, 217]],\n",
" \n",
" [[108, 218]],\n",
" \n",
" [[108, 219]],\n",
" \n",
" [[107, 220]],\n",
" \n",
" [[106, 219]]], dtype=int32),\n",
" array([[[101, 218]],\n",
" \n",
" [[102, 217]],\n",
" \n",
" [[103, 218]],\n",
" \n",
" [[102, 219]]], dtype=int32),\n",
" array([[[122, 217]],\n",
" \n",
" [[123, 216]],\n",
" \n",
" [[124, 217]],\n",
" \n",
" [[123, 218]]], dtype=int32),\n",
" array([[[118, 217]],\n",
" \n",
" [[119, 216]],\n",
" \n",
" [[120, 217]],\n",
" \n",
" [[119, 218]]], dtype=int32),\n",
" array([[[111, 217]],\n",
" \n",
" [[112, 216]],\n",
" \n",
" [[113, 217]],\n",
" \n",
" [[112, 218]]], dtype=int32),\n",
" array([[[109, 217]],\n",
" \n",
" [[110, 216]],\n",
" \n",
" [[111, 217]],\n",
" \n",
" [[111, 218]],\n",
" \n",
" [[112, 219]],\n",
" \n",
" [[111, 220]],\n",
" \n",
" [[110, 220]],\n",
" \n",
" [[109, 219]]], dtype=int32),\n",
" array([[[105, 217]],\n",
" \n",
" [[106, 216]],\n",
" \n",
" [[107, 217]],\n",
" \n",
" [[106, 218]]], dtype=int32),\n",
" array([[[ 97, 217]],\n",
" \n",
" [[ 98, 216]],\n",
" \n",
" [[ 99, 217]],\n",
" \n",
" [[ 98, 218]]], dtype=int32),\n",
" array([[[139, 216]],\n",
" \n",
" [[140, 215]],\n",
" \n",
" [[141, 216]],\n",
" \n",
" [[140, 217]]], dtype=int32),\n",
" array([[[130, 216]],\n",
" \n",
" [[131, 215]],\n",
" \n",
" [[132, 216]],\n",
" \n",
" [[131, 217]]], dtype=int32),\n",
" array([[[128, 216]],\n",
" \n",
" [[129, 215]],\n",
" \n",
" [[130, 216]],\n",
" \n",
" [[129, 217]]], dtype=int32),\n",
" array([[[110, 216]],\n",
" \n",
" [[111, 215]],\n",
" \n",
" [[112, 216]],\n",
" \n",
" [[111, 217]]], dtype=int32),\n",
" array([[[103, 216]],\n",
" \n",
" [[104, 215]],\n",
" \n",
" [[105, 216]],\n",
" \n",
" [[105, 217]],\n",
" \n",
" [[104, 218]],\n",
" \n",
" [[103, 217]]], dtype=int32),\n",
" array([[[101, 215]],\n",
" \n",
" [[102, 216]],\n",
" \n",
" [[102, 217]],\n",
" \n",
" [[100, 219]],\n",
" \n",
" [[100, 220]],\n",
" \n",
" [[102, 222]],\n",
" \n",
" [[101, 223]],\n",
" \n",
" [[100, 223]],\n",
" \n",
" [[ 98, 221]],\n",
" \n",
" [[ 98, 218]]], dtype=int32),\n",
" array([[[ 96, 216]],\n",
" \n",
" [[ 97, 215]],\n",
" \n",
" [[ 98, 216]],\n",
" \n",
" [[ 97, 217]]], dtype=int32),\n",
" array([[[108, 215]],\n",
" \n",
" [[109, 214]],\n",
" \n",
" [[110, 215]],\n",
" \n",
" [[110, 216]],\n",
" \n",
" [[109, 217]],\n",
" \n",
" [[108, 216]]], dtype=int32),\n",
" array([[[101, 215]],\n",
" \n",
" [[102, 214]],\n",
" \n",
" [[103, 215]],\n",
" \n",
" [[102, 216]]], dtype=int32),\n",
" array([[[ 98, 215]],\n",
" \n",
" [[ 99, 214]],\n",
" \n",
" [[100, 215]],\n",
" \n",
" [[ 99, 216]]], dtype=int32),\n",
" array([[[127, 214]],\n",
" \n",
" [[128, 213]],\n",
" \n",
" [[129, 214]],\n",
" \n",
" [[128, 215]]], dtype=int32),\n",
" array([[[115, 214]],\n",
" \n",
" [[116, 213]],\n",
" \n",
" [[117, 213]],\n",
" \n",
" [[118, 214]],\n",
" \n",
" [[117, 215]],\n",
" \n",
" [[116, 215]]], dtype=int32),\n",
" array([[[110, 214]],\n",
" \n",
" [[111, 213]],\n",
" \n",
" [[112, 214]],\n",
" \n",
" [[111, 215]]], dtype=int32),\n",
" array([[[103, 214]],\n",
" \n",
" [[104, 213]],\n",
" \n",
" [[105, 214]],\n",
" \n",
" [[104, 215]]], dtype=int32),\n",
" array([[[129, 213]],\n",
" \n",
" [[130, 212]],\n",
" \n",
" [[131, 213]],\n",
" \n",
" [[131, 214]],\n",
" \n",
" [[130, 215]],\n",
" \n",
" [[129, 214]]], dtype=int32),\n",
" array([[[124, 212]],\n",
" \n",
" [[125, 211]],\n",
" \n",
" [[126, 212]],\n",
" \n",
" [[126, 213]],\n",
" \n",
" [[125, 214]],\n",
" \n",
" [[124, 213]]], dtype=int32),\n",
" array([[[118, 212]],\n",
" \n",
" [[119, 211]],\n",
" \n",
" [[120, 212]],\n",
" \n",
" [[119, 213]]], dtype=int32),\n",
" array([[[101, 212]],\n",
" \n",
" [[102, 211]],\n",
" \n",
" [[103, 212]],\n",
" \n",
" [[103, 213]],\n",
" \n",
" [[102, 214]],\n",
" \n",
" [[101, 213]]], dtype=int32),\n",
" array([[[ 99, 212]],\n",
" \n",
" [[100, 211]],\n",
" \n",
" [[101, 212]],\n",
" \n",
" [[100, 213]]], dtype=int32),\n",
" array([[[123, 211]],\n",
" \n",
" [[124, 210]],\n",
" \n",
" [[125, 211]],\n",
" \n",
" [[124, 212]]], dtype=int32),\n",
" array([[[104, 211]],\n",
" \n",
" [[105, 210]],\n",
" \n",
" [[106, 211]],\n",
" \n",
" [[106, 212]],\n",
" \n",
" [[107, 213]],\n",
" \n",
" [[106, 214]],\n",
" \n",
" [[105, 214]],\n",
" \n",
" [[104, 213]]], dtype=int32),\n",
" array([[[102, 211]],\n",
" \n",
" [[103, 210]],\n",
" \n",
" [[104, 211]],\n",
" \n",
" [[103, 212]]], dtype=int32),\n",
" array([[[125, 210]],\n",
" \n",
" [[126, 209]],\n",
" \n",
" [[127, 210]],\n",
" \n",
" [[127, 211]],\n",
" \n",
" [[126, 212]],\n",
" \n",
" [[125, 211]]], dtype=int32),\n",
" array([[[121, 210]],\n",
" \n",
" [[122, 209]],\n",
" \n",
" [[123, 210]],\n",
" \n",
" [[122, 211]]], dtype=int32),\n",
" array([[[111, 210]],\n",
" \n",
" [[112, 209]],\n",
" \n",
" [[114, 209]],\n",
" \n",
" [[115, 210]],\n",
" \n",
" [[114, 211]],\n",
" \n",
" [[112, 211]]], dtype=int32),\n",
" array([[[105, 210]],\n",
" \n",
" [[106, 209]],\n",
" \n",
" [[107, 210]],\n",
" \n",
" [[106, 211]]], dtype=int32),\n",
" array([[[106, 209]],\n",
" \n",
" [[107, 208]],\n",
" \n",
" [[108, 208]],\n",
" \n",
" [[109, 209]],\n",
" \n",
" [[108, 210]],\n",
" \n",
" [[107, 210]]], dtype=int32),\n",
" array([[[131, 208]],\n",
" \n",
" [[132, 207]],\n",
" \n",
" [[133, 208]],\n",
" \n",
" [[132, 209]]], dtype=int32),\n",
" array([[[116, 208]],\n",
" \n",
" [[117, 207]],\n",
" \n",
" [[118, 208]],\n",
" \n",
" [[117, 209]]], dtype=int32),\n",
" array([[[112, 208]],\n",
" \n",
" [[113, 207]],\n",
" \n",
" [[114, 208]],\n",
" \n",
" [[113, 209]]], dtype=int32),\n",
" array([[[130, 207]],\n",
" \n",
" [[131, 206]],\n",
" \n",
" [[132, 207]],\n",
" \n",
" [[131, 208]]], dtype=int32),\n",
" array([[[128, 207]],\n",
" \n",
" [[129, 206]],\n",
" \n",
" [[130, 207]],\n",
" \n",
" [[129, 208]]], dtype=int32),\n",
" array([[[121, 207]],\n",
" \n",
" [[122, 206]],\n",
" \n",
" [[123, 207]],\n",
" \n",
" [[122, 208]]], dtype=int32),\n",
" array([[[134, 206]],\n",
" \n",
" [[135, 205]],\n",
" \n",
" [[136, 206]],\n",
" \n",
" [[135, 207]]], dtype=int32),\n",
" array([[[127, 206]],\n",
" \n",
" [[128, 205]],\n",
" \n",
" [[129, 206]],\n",
" \n",
" [[128, 207]]], dtype=int32),\n",
" array([[[124, 206]],\n",
" \n",
" [[125, 205]],\n",
" \n",
" [[126, 205]],\n",
" \n",
" [[127, 206]],\n",
" \n",
" [[125, 208]],\n",
" \n",
" [[124, 207]]], dtype=int32),\n",
" array([[[118, 206]],\n",
" \n",
" [[119, 205]],\n",
" \n",
" [[121, 207]],\n",
" \n",
" [[120, 208]],\n",
" \n",
" [[119, 208]],\n",
" \n",
" [[118, 207]]], dtype=int32),\n",
" array([[[138, 205]],\n",
" \n",
" [[139, 204]],\n",
" \n",
" [[140, 205]],\n",
" \n",
" [[139, 206]]], dtype=int32),\n",
" array([[[128, 205]],\n",
" \n",
" [[129, 204]],\n",
" \n",
" [[130, 204]],\n",
" \n",
" [[131, 205]],\n",
" \n",
" [[130, 206]],\n",
" \n",
" [[129, 206]]], dtype=int32),\n",
" array([[[126, 205]],\n",
" \n",
" [[127, 204]],\n",
" \n",
" [[128, 205]],\n",
" \n",
" [[127, 206]]], dtype=int32),\n",
" array([[[120, 205]],\n",
" \n",
" [[121, 204]],\n",
" \n",
" [[122, 205]],\n",
" \n",
" [[121, 206]]], dtype=int32),\n",
" array([[[135, 204]],\n",
" \n",
" [[136, 203]],\n",
" \n",
" [[137, 204]],\n",
" \n",
" [[136, 205]]], dtype=int32),\n",
" array([[[125, 204]],\n",
" \n",
" [[126, 203]],\n",
" \n",
" [[127, 204]],\n",
" \n",
" [[126, 205]]], dtype=int32),\n",
" array([[[122, 204]],\n",
" \n",
" [[123, 203]],\n",
" \n",
" [[124, 204]],\n",
" \n",
" [[123, 205]]], dtype=int32),\n",
" array([[[104, 204]],\n",
" \n",
" [[105, 203]],\n",
" \n",
" [[106, 204]],\n",
" \n",
" [[106, 205]],\n",
" \n",
" [[105, 206]],\n",
" \n",
" [[104, 205]]], dtype=int32),\n",
" array([[[189, 203]],\n",
" \n",
" [[190, 202]],\n",
" \n",
" [[191, 203]],\n",
" \n",
" [[190, 204]]], dtype=int32),\n",
" array([[[187, 203]],\n",
" \n",
" [[188, 202]],\n",
" \n",
" [[189, 203]],\n",
" \n",
" [[188, 204]]], dtype=int32),\n",
" array([[[117, 203]],\n",
" \n",
" [[118, 202]],\n",
" \n",
" [[119, 203]],\n",
" \n",
" [[118, 204]]], dtype=int32),\n",
" array([[[111, 203]],\n",
" \n",
" [[112, 202]],\n",
" \n",
" [[113, 203]],\n",
" \n",
" [[112, 204]]], dtype=int32),\n",
" array([[[119, 202]],\n",
" \n",
" [[120, 201]],\n",
" \n",
" [[121, 202]],\n",
" \n",
" [[120, 203]]], dtype=int32),\n",
" array([[[113, 202]],\n",
" \n",
" [[114, 201]],\n",
" \n",
" [[115, 202]],\n",
" \n",
" [[114, 203]]], dtype=int32),\n",
" array([[[179, 201]],\n",
" \n",
" [[180, 200]],\n",
" \n",
" [[181, 201]],\n",
" \n",
" [[180, 202]]], dtype=int32),\n",
" array([[[134, 201]],\n",
" \n",
" [[135, 200]],\n",
" \n",
" [[136, 201]],\n",
" \n",
" [[135, 202]]], dtype=int32),\n",
" array([[[121, 201]],\n",
" \n",
" [[122, 200]],\n",
" \n",
" [[124, 202]],\n",
" \n",
" [[123, 203]],\n",
" \n",
" [[122, 203]],\n",
" \n",
" [[121, 202]]], dtype=int32),\n",
" array([[[107, 201]],\n",
" \n",
" [[108, 200]],\n",
" \n",
" [[110, 200]],\n",
" \n",
" [[111, 201]],\n",
" \n",
" [[110, 202]],\n",
" \n",
" [[108, 202]]], dtype=int32),\n",
" array([[[188, 200]],\n",
" \n",
" [[189, 199]],\n",
" \n",
" [[190, 199]],\n",
" \n",
" [[191, 200]],\n",
" \n",
" [[190, 201]],\n",
" \n",
" [[189, 201]]], dtype=int32),\n",
" array([[[180, 200]],\n",
" \n",
" [[181, 199]],\n",
" \n",
" [[182, 200]],\n",
" \n",
" [[181, 201]]], dtype=int32),\n",
" array([[[128, 200]],\n",
" \n",
" [[129, 199]],\n",
" \n",
" [[130, 200]],\n",
" \n",
" [[129, 201]]], dtype=int32),\n",
" array([[[118, 200]],\n",
" \n",
" [[119, 199]],\n",
" \n",
" [[120, 200]],\n",
" \n",
" [[119, 201]]], dtype=int32),\n",
" array([[[111, 200]],\n",
" \n",
" [[112, 199]],\n",
" \n",
" [[114, 199]],\n",
" \n",
" [[115, 200]],\n",
" \n",
" [[114, 201]],\n",
" \n",
" [[112, 201]]], dtype=int32),\n",
" array([[[187, 199]],\n",
" \n",
" [[188, 198]],\n",
" \n",
" [[189, 199]],\n",
" \n",
" [[188, 200]]], dtype=int32),\n",
" array([[[182, 199]],\n",
" \n",
" [[183, 198]],\n",
" \n",
" [[185, 198]],\n",
" \n",
" [[186, 199]],\n",
" \n",
" [[185, 200]],\n",
" \n",
" [[183, 200]]], dtype=int32),\n",
" array([[[176, 199]],\n",
" \n",
" [[177, 198]],\n",
" \n",
" [[178, 199]],\n",
" \n",
" [[178, 200]],\n",
" \n",
" [[177, 201]],\n",
" \n",
" [[176, 200]]], dtype=int32),\n",
" array([[[169, 199]],\n",
" \n",
" [[170, 198]],\n",
" \n",
" [[171, 199]],\n",
" \n",
" [[170, 200]]], dtype=int32),\n",
" array([[[165, 199]],\n",
" \n",
" [[166, 198]],\n",
" \n",
" [[167, 199]],\n",
" \n",
" [[166, 200]]], dtype=int32),\n",
" array([[[186, 198]],\n",
" \n",
" [[187, 197]],\n",
" \n",
" [[188, 198]],\n",
" \n",
" [[187, 199]]], dtype=int32),\n",
" array([[[180, 198]],\n",
" \n",
" [[181, 197]],\n",
" \n",
" [[182, 197]],\n",
" \n",
" [[183, 198]],\n",
" \n",
" [[182, 199]],\n",
" \n",
" [[181, 199]]], dtype=int32),\n",
" array([[[175, 198]],\n",
" \n",
" [[176, 197]],\n",
" \n",
" [[177, 198]],\n",
" \n",
" [[176, 199]]], dtype=int32),\n",
" array([[[123, 198]],\n",
" \n",
" [[124, 197]],\n",
" \n",
" [[125, 198]],\n",
" \n",
" [[125, 200]],\n",
" \n",
" [[126, 201]],\n",
" \n",
" [[125, 202]],\n",
" \n",
" [[124, 202]],\n",
" \n",
" [[123, 201]]], dtype=int32),\n",
" array([[[109, 198]],\n",
" \n",
" [[110, 197]],\n",
" \n",
" [[111, 197]],\n",
" \n",
" [[112, 198]],\n",
" \n",
" [[112, 199]],\n",
" \n",
" [[111, 200]]], dtype=int32),\n",
" array([[[178, 197]],\n",
" \n",
" [[179, 196]],\n",
" \n",
" [[180, 196]],\n",
" \n",
" [[181, 197]],\n",
" \n",
" [[180, 198]],\n",
" \n",
" [[179, 198]]], dtype=int32),\n",
" array([[[113, 197]],\n",
" \n",
" [[114, 196]],\n",
" \n",
" [[115, 197]],\n",
" \n",
" [[114, 198]]], dtype=int32),\n",
" array([[[108, 197]],\n",
" \n",
" [[109, 196]],\n",
" \n",
" [[110, 197]],\n",
" \n",
" [[109, 198]]], dtype=int32),\n",
" array([[[176, 196]],\n",
" \n",
" [[177, 195]],\n",
" \n",
" [[178, 196]],\n",
" \n",
" [[177, 197]]], dtype=int32),\n",
" array([[[163, 196]],\n",
" \n",
" [[164, 195]],\n",
" \n",
" [[165, 196]],\n",
" \n",
" [[164, 197]]], dtype=int32),\n",
" array([[[119, 196]],\n",
" \n",
" [[120, 195]],\n",
" \n",
" [[123, 195]],\n",
" \n",
" [[124, 196]],\n",
" \n",
" [[122, 198]],\n",
" \n",
" [[121, 197]],\n",
" \n",
" [[120, 197]]], dtype=int32),\n",
" array([[[117, 196]],\n",
" \n",
" [[118, 195]],\n",
" \n",
" [[119, 196]],\n",
" \n",
" [[118, 197]]], dtype=int32),\n",
" array([[[109, 196]],\n",
" \n",
" [[110, 195]],\n",
" \n",
" [[111, 196]],\n",
" \n",
" [[110, 197]]], dtype=int32),\n",
" array([[[180, 195]],\n",
" \n",
" [[181, 194]],\n",
" \n",
" [[182, 194]],\n",
" \n",
" [[183, 195]],\n",
" \n",
" [[182, 196]],\n",
" \n",
" [[181, 196]]], dtype=int32),\n",
" array([[[118, 195]],\n",
" \n",
" [[119, 194]],\n",
" \n",
" [[120, 195]],\n",
" \n",
" [[119, 196]]], dtype=int32),\n",
" array([[[186, 194]],\n",
" \n",
" [[187, 193]],\n",
" \n",
" [[188, 194]],\n",
" \n",
" [[187, 195]]], dtype=int32),\n",
" array([[[178, 194]],\n",
" \n",
" [[179, 193]],\n",
" \n",
" [[180, 194]],\n",
" \n",
" [[179, 195]]], dtype=int32),\n",
" array([[[169, 194]],\n",
" \n",
" [[170, 193]],\n",
" \n",
" [[171, 194]],\n",
" \n",
" [[170, 195]]], dtype=int32),\n",
" array([[[126, 193]],\n",
" \n",
" [[127, 194]],\n",
" \n",
" [[127, 195]],\n",
" \n",
" [[125, 197]],\n",
" \n",
" [[124, 196]],\n",
" \n",
" [[124, 195]]], dtype=int32),\n",
" array([[[121, 194]],\n",
" \n",
" [[122, 193]],\n",
" \n",
" [[123, 194]],\n",
" \n",
" [[122, 195]]], dtype=int32),\n",
" array([[[176, 193]],\n",
" \n",
" [[177, 192]],\n",
" \n",
" [[178, 193]],\n",
" \n",
" [[177, 194]]], dtype=int32),\n",
" array([[[163, 193]],\n",
" \n",
" [[164, 192]],\n",
" \n",
" [[165, 193]],\n",
" \n",
" [[164, 194]]], dtype=int32),\n",
" array([[[116, 193]],\n",
" \n",
" [[117, 192]],\n",
" \n",
" [[118, 193]],\n",
" \n",
" [[117, 194]]], dtype=int32),\n",
" array([[[108, 193]],\n",
" \n",
" [[109, 192]],\n",
" \n",
" [[110, 193]],\n",
" \n",
" [[109, 194]]], dtype=int32),\n",
" array([[[172, 192]],\n",
" \n",
" [[173, 191]],\n",
" \n",
" [[174, 192]],\n",
" \n",
" [[173, 193]]], dtype=int32),\n",
" array([[[166, 192]],\n",
" \n",
" [[167, 191]],\n",
" \n",
" [[168, 192]],\n",
" \n",
" [[167, 193]]], dtype=int32),\n",
" array([[[118, 192]],\n",
" \n",
" [[119, 191]],\n",
" \n",
" [[121, 193]],\n",
" \n",
" [[120, 194]],\n",
" \n",
" [[119, 194]],\n",
" \n",
" [[118, 193]]], dtype=int32),\n",
" array([[[110, 192]],\n",
" \n",
" [[111, 191]],\n",
" \n",
" [[112, 192]],\n",
" \n",
" [[112, 195]],\n",
" \n",
" [[111, 196]],\n",
" \n",
" [[110, 195]]], dtype=int32),\n",
" array([[[168, 191]],\n",
" \n",
" [[169, 190]],\n",
" \n",
" [[170, 191]],\n",
" \n",
" [[169, 192]]], dtype=int32),\n",
" array([[[111, 191]],\n",
" \n",
" [[112, 190]],\n",
" \n",
" [[113, 191]],\n",
" \n",
" [[112, 192]]], dtype=int32),\n",
" array([[[114, 190]],\n",
" \n",
" [[115, 189]],\n",
" \n",
" [[116, 190]],\n",
" \n",
" [[115, 191]]], dtype=int32),\n",
" array([[[109, 190]],\n",
" \n",
" [[110, 189]],\n",
" \n",
" [[111, 190]],\n",
" \n",
" [[110, 191]]], dtype=int32),\n",
" array([[[171, 189]],\n",
" \n",
" [[172, 188]],\n",
" \n",
" [[173, 189]],\n",
" \n",
" [[172, 190]]], dtype=int32),\n",
" array([[[120, 189]],\n",
" \n",
" [[121, 188]],\n",
" \n",
" [[122, 189]],\n",
" \n",
" [[122, 190]],\n",
" \n",
" [[121, 191]],\n",
" \n",
" [[120, 190]]], dtype=int32),\n",
" array([[[117, 189]],\n",
" \n",
" [[118, 188]],\n",
" \n",
" [[119, 189]],\n",
" \n",
" [[119, 190]],\n",
" \n",
" [[118, 191]],\n",
" \n",
" [[117, 190]]], dtype=int32),\n",
" array([[[113, 189]],\n",
" \n",
" [[114, 188]],\n",
" \n",
" [[115, 189]],\n",
" \n",
" [[114, 190]]], dtype=int32),\n",
" array([[[111, 189]],\n",
" \n",
" [[112, 188]],\n",
" \n",
" [[113, 189]],\n",
" \n",
" [[112, 190]]], dtype=int32),\n",
" array([[[177, 188]],\n",
" \n",
" [[178, 187]],\n",
" \n",
" [[179, 188]],\n",
" \n",
" [[179, 189]],\n",
" \n",
" [[178, 190]],\n",
" \n",
" [[177, 189]]], dtype=int32),\n",
" array([[[123, 188]],\n",
" \n",
" [[124, 187]],\n",
" \n",
" [[125, 188]],\n",
" \n",
" [[124, 189]]], dtype=int32),\n",
" array([[[165, 187]],\n",
" \n",
" [[166, 186]],\n",
" \n",
" [[167, 187]],\n",
" \n",
" [[166, 188]]], dtype=int32),\n",
" array([[[112, 187]],\n",
" \n",
" [[113, 186]],\n",
" \n",
" [[114, 187]],\n",
" \n",
" [[113, 188]]], dtype=int32),\n",
" array([[[172, 186]],\n",
" \n",
" [[173, 185]],\n",
" \n",
" [[174, 186]],\n",
" \n",
" [[173, 187]]], dtype=int32),\n",
" array([[[169, 186]],\n",
" \n",
" [[170, 185]],\n",
" \n",
" [[171, 186]],\n",
" \n",
" [[171, 187]],\n",
" \n",
" [[170, 188]],\n",
" \n",
" [[169, 187]]], dtype=int32),\n",
" array([[[164, 185]],\n",
" \n",
" [[165, 184]],\n",
" \n",
" [[166, 185]],\n",
" \n",
" [[165, 186]]], dtype=int32),\n",
" array([[[114, 185]],\n",
" \n",
" [[115, 184]],\n",
" \n",
" [[116, 185]],\n",
" \n",
" [[115, 186]]], dtype=int32),\n",
" array([[[166, 184]],\n",
" \n",
" [[167, 183]],\n",
" \n",
" [[168, 184]],\n",
" \n",
" [[167, 185]]], dtype=int32),\n",
" array([[[117, 184]],\n",
" \n",
" [[118, 183]],\n",
" \n",
" [[119, 184]],\n",
" \n",
" [[118, 185]]], dtype=int32),\n",
" array([[[180, 183]],\n",
" \n",
" [[181, 182]],\n",
" \n",
" [[182, 183]],\n",
" \n",
" [[181, 184]]], dtype=int32),\n",
" array([[[118, 183]],\n",
" \n",
" [[119, 182]],\n",
" \n",
" [[120, 183]],\n",
" \n",
" [[119, 184]]], dtype=int32),\n",
" array([[[113, 182]],\n",
" \n",
" [[114, 181]],\n",
" \n",
" [[115, 182]],\n",
" \n",
" [[115, 184]],\n",
" \n",
" [[114, 185]],\n",
" \n",
" [[113, 184]]], dtype=int32),\n",
" array([[[119, 181]],\n",
" \n",
" [[120, 180]],\n",
" \n",
" [[122, 180]],\n",
" \n",
" [[123, 181]],\n",
" \n",
" [[123, 182]],\n",
" \n",
" [[122, 183]],\n",
" \n",
" [[121, 182]],\n",
" \n",
" [[120, 183]],\n",
" \n",
" [[119, 182]]], dtype=int32),\n",
" array([[[172, 180]],\n",
" \n",
" [[173, 179]],\n",
" \n",
" [[174, 180]],\n",
" \n",
" [[173, 181]]], dtype=int32),\n",
" array([[[120, 179]],\n",
" \n",
" [[121, 178]],\n",
" \n",
" [[122, 179]],\n",
" \n",
" [[121, 180]]], dtype=int32),\n",
" array([[[121, 177]],\n",
" \n",
" [[122, 176]],\n",
" \n",
" [[124, 178]],\n",
" \n",
" [[124, 179]],\n",
" \n",
" [[123, 180]],\n",
" \n",
" [[121, 178]]], dtype=int32),\n",
" array([[[118, 177]],\n",
" \n",
" [[119, 176]],\n",
" \n",
" [[120, 177]],\n",
" \n",
" [[119, 178]]], dtype=int32),\n",
" array([[[171, 176]],\n",
" \n",
" [[172, 175]],\n",
" \n",
" [[173, 176]],\n",
" \n",
" [[172, 177]]], dtype=int32),\n",
" array([[[125, 176]],\n",
" \n",
" [[126, 175]],\n",
" \n",
" [[127, 176]],\n",
" \n",
" [[126, 177]]], dtype=int32),\n",
" array([[[123, 176]],\n",
" \n",
" [[124, 175]],\n",
" \n",
" [[125, 176]],\n",
" \n",
" [[124, 177]]], dtype=int32),\n",
" array([[[172, 175]],\n",
" \n",
" [[173, 174]],\n",
" \n",
" [[174, 175]],\n",
" \n",
" [[173, 176]]], dtype=int32),\n",
" array([[[166, 175]],\n",
" \n",
" [[167, 174]],\n",
" \n",
" [[168, 175]],\n",
" \n",
" [[168, 177]],\n",
" \n",
" [[167, 178]],\n",
" \n",
" [[166, 177]]], dtype=int32),\n",
" array([[[121, 175]],\n",
" \n",
" [[122, 174]],\n",
" \n",
" [[123, 175]],\n",
" \n",
" [[122, 176]]], dtype=int32),\n",
" array([[[118, 175]],\n",
" \n",
" [[119, 174]],\n",
" \n",
" [[120, 175]],\n",
" \n",
" [[119, 176]]], dtype=int32),\n",
" array([[[125, 173]],\n",
" \n",
" [[126, 172]],\n",
" \n",
" [[127, 173]],\n",
" \n",
" [[127, 174]],\n",
" \n",
" [[126, 175]],\n",
" \n",
" [[125, 174]]], dtype=int32),\n",
" array([[[121, 173]],\n",
" \n",
" [[122, 172]],\n",
" \n",
" [[123, 172]],\n",
" \n",
" [[124, 173]],\n",
" \n",
" [[124, 174]],\n",
" \n",
" [[123, 175]]], dtype=int32),\n",
" array([[[119, 173]],\n",
" \n",
" [[120, 172]],\n",
" \n",
" [[121, 173]],\n",
" \n",
" [[121, 174]],\n",
" \n",
" [[120, 175]],\n",
" \n",
" [[119, 174]]], dtype=int32),\n",
" array([[[115, 173]],\n",
" \n",
" [[116, 172]],\n",
" \n",
" [[117, 172]],\n",
" \n",
" [[118, 173]],\n",
" \n",
" [[117, 174]],\n",
" \n",
" [[117, 175]],\n",
" \n",
" [[116, 176]],\n",
" \n",
" [[115, 175]]], dtype=int32),\n",
" array([[[112, 172]],\n",
" \n",
" [[113, 171]],\n",
" \n",
" [[115, 171]],\n",
" \n",
" [[116, 172]],\n",
" \n",
" [[115, 173]],\n",
" \n",
" [[113, 173]]], dtype=int32),\n",
" array([[[184, 171]],\n",
" \n",
" [[185, 170]],\n",
" \n",
" [[186, 171]],\n",
" \n",
" [[185, 172]]], dtype=int32),\n",
" array([[[115, 171]],\n",
" \n",
" [[116, 170]],\n",
" \n",
" [[117, 171]],\n",
" \n",
" [[116, 172]]], dtype=int32),\n",
" array([[[111, 171]],\n",
" \n",
" [[112, 170]],\n",
" \n",
" [[113, 171]],\n",
" \n",
" [[112, 172]]], dtype=int32),\n",
" array([[[117, 170]],\n",
" \n",
" [[118, 169]],\n",
" \n",
" [[119, 170]],\n",
" \n",
" [[119, 171]],\n",
" \n",
" [[118, 172]],\n",
" \n",
" [[117, 171]]], dtype=int32),\n",
" array([[[189, 169]],\n",
" \n",
" [[190, 168]],\n",
" \n",
" [[191, 169]],\n",
" \n",
" [[190, 170]]], dtype=int32),\n",
" array([[[187, 169]],\n",
" \n",
" [[188, 168]],\n",
" \n",
" [[189, 169]],\n",
" \n",
" [[189, 170]],\n",
" \n",
" [[188, 171]],\n",
" \n",
" [[187, 170]]], dtype=int32),\n",
" array([[[176, 169]],\n",
" \n",
" [[177, 168]],\n",
" \n",
" [[178, 169]],\n",
" \n",
" [[177, 170]]], dtype=int32),\n",
" array([[[186, 168]],\n",
" \n",
" [[187, 167]],\n",
" \n",
" [[188, 168]],\n",
" \n",
" [[187, 169]]], dtype=int32),\n",
" array([[[173, 168]],\n",
" \n",
" [[174, 167]],\n",
" \n",
" [[175, 167]],\n",
" \n",
" [[176, 168]],\n",
" \n",
" [[175, 169]],\n",
" \n",
" [[174, 169]]], dtype=int32),\n",
" array([[[190, 167]],\n",
" \n",
" [[191, 166]],\n",
" \n",
" [[192, 167]],\n",
" \n",
" [[191, 168]]], dtype=int32),\n",
" array([[[172, 166]],\n",
" \n",
" [[173, 165]],\n",
" \n",
" [[174, 166]],\n",
" \n",
" [[173, 167]]], dtype=int32),\n",
" array([[[118, 165]],\n",
" \n",
" [[119, 164]],\n",
" \n",
" [[120, 165]],\n",
" \n",
" [[119, 166]]], dtype=int32),\n",
" array([[[169, 164]],\n",
" \n",
" [[170, 163]],\n",
" \n",
" [[171, 164]],\n",
" \n",
" [[170, 165]]], dtype=int32),\n",
" array([[[190, 163]],\n",
" \n",
" [[191, 162]],\n",
" \n",
" [[192, 163]],\n",
" \n",
" [[193, 162]],\n",
" \n",
" [[194, 163]],\n",
" \n",
" [[195, 163]],\n",
" \n",
" [[196, 162]],\n",
" \n",
" [[197, 162]],\n",
" \n",
" [[199, 164]],\n",
" \n",
" [[198, 165]],\n",
" \n",
" [[198, 168]],\n",
" \n",
" [[197, 169]],\n",
" \n",
" [[197, 178]],\n",
" \n",
" [[196, 179]],\n",
" \n",
" [[196, 181]],\n",
" \n",
" [[195, 182]],\n",
" \n",
" [[194, 182]],\n",
" \n",
" [[193, 181]],\n",
" \n",
" [[193, 180]],\n",
" \n",
" [[193, 181]],\n",
" \n",
" [[192, 182]],\n",
" \n",
" [[191, 181]],\n",
" \n",
" [[191, 180]],\n",
" \n",
" [[190, 179]],\n",
" \n",
" [[190, 180]],\n",
" \n",
" [[191, 181]],\n",
" \n",
" [[191, 182]],\n",
" \n",
" [[190, 183]],\n",
" \n",
" [[190, 185]],\n",
" \n",
" [[191, 186]],\n",
" \n",
" [[190, 187]],\n",
" \n",
" [[189, 187]],\n",
" \n",
" [[190, 188]],\n",
" \n",
" [[188, 190]],\n",
" \n",
" [[188, 192]],\n",
" \n",
" [[186, 194]],\n",
" \n",
" [[185, 194]],\n",
" \n",
" [[185, 195]],\n",
" \n",
" [[187, 197]],\n",
" \n",
" [[186, 198]],\n",
" \n",
" [[184, 198]],\n",
" \n",
" [[182, 196]],\n",
" \n",
" [[183, 195]],\n",
" \n",
" [[183, 194]],\n",
" \n",
" [[182, 193]],\n",
" \n",
" [[183, 192]],\n",
" \n",
" [[180, 192]],\n",
" \n",
" [[179, 191]],\n",
" \n",
" [[179, 190]],\n",
" \n",
" [[180, 189]],\n",
" \n",
" [[181, 190]],\n",
" \n",
" [[184, 190]],\n",
" \n",
" [[183, 190]],\n",
" \n",
" [[181, 188]],\n",
" \n",
" [[180, 188]],\n",
" \n",
" [[179, 187]],\n",
" \n",
" [[181, 185]],\n",
" \n",
" [[183, 185]],\n",
" \n",
" [[184, 186]],\n",
" \n",
" [[184, 187]],\n",
" \n",
" [[185, 188]],\n",
" \n",
" [[186, 188]],\n",
" \n",
" [[187, 187]],\n",
" \n",
" [[187, 186]],\n",
" \n",
" [[188, 185]],\n",
" \n",
" [[188, 184]],\n",
" \n",
" [[187, 184]],\n",
" \n",
" [[186, 183]],\n",
" \n",
" [[188, 181]],\n",
" \n",
" [[188, 180]],\n",
" \n",
" [[187, 181]],\n",
" \n",
" [[187, 182]],\n",
" \n",
" [[185, 184]],\n",
" \n",
" [[186, 184]],\n",
" \n",
" [[187, 185]],\n",
" \n",
" [[186, 186]],\n",
" \n",
" [[184, 186]],\n",
" \n",
" [[183, 185]],\n",
" \n",
" [[183, 182]],\n",
" \n",
" [[184, 181]],\n",
" \n",
" [[185, 181]],\n",
" \n",
" [[185, 180]],\n",
" \n",
" [[184, 181]],\n",
" \n",
" [[182, 179]],\n",
" \n",
" [[182, 178]],\n",
" \n",
" [[183, 177]],\n",
" \n",
" [[184, 178]],\n",
" \n",
" [[184, 177]],\n",
" \n",
" [[183, 177]],\n",
" \n",
" [[181, 179]],\n",
" \n",
" [[180, 178]],\n",
" \n",
" [[180, 177]],\n",
" \n",
" [[179, 177]],\n",
" \n",
" [[178, 176]],\n",
" \n",
" [[177, 177]],\n",
" \n",
" [[176, 176]],\n",
" \n",
" [[176, 177]],\n",
" \n",
" [[175, 178]],\n",
" \n",
" [[174, 177]],\n",
" \n",
" [[174, 175]],\n",
" \n",
" [[175, 174]],\n",
" \n",
" [[176, 174]],\n",
" \n",
" [[177, 173]],\n",
" \n",
" [[176, 174]],\n",
" \n",
" [[175, 173]],\n",
" \n",
" [[173, 173]],\n",
" \n",
" [[173, 174]],\n",
" \n",
" [[171, 176]],\n",
" \n",
" [[170, 175]],\n",
" \n",
" [[170, 174]],\n",
" \n",
" [[171, 173]],\n",
" \n",
" [[168, 173]],\n",
" \n",
" [[167, 172]],\n",
" \n",
" [[168, 171]],\n",
" \n",
" [[168, 169]],\n",
" \n",
" [[169, 168]],\n",
" \n",
" [[170, 168]],\n",
" \n",
" [[171, 169]],\n",
" \n",
" [[172, 168]],\n",
" \n",
" [[173, 168]],\n",
" \n",
" [[174, 169]],\n",
" \n",
" [[174, 170]],\n",
" \n",
" [[178, 170]],\n",
" \n",
" [[179, 171]],\n",
" \n",
" [[180, 170]],\n",
" \n",
" [[181, 171]],\n",
" \n",
" [[184, 171]],\n",
" \n",
" [[185, 172]],\n",
" \n",
" [[185, 173]],\n",
" \n",
" [[187, 171]],\n",
" \n",
" [[188, 171]],\n",
" \n",
" [[189, 172]],\n",
" \n",
" [[189, 173]],\n",
" \n",
" [[188, 174]],\n",
" \n",
" [[189, 173]],\n",
" \n",
" [[191, 173]],\n",
" \n",
" [[192, 172]],\n",
" \n",
" [[194, 172]],\n",
" \n",
" [[192, 172]],\n",
" \n",
" [[191, 171]],\n",
" \n",
" [[192, 170]],\n",
" \n",
" [[193, 170]],\n",
" \n",
" [[193, 169]],\n",
" \n",
" [[194, 168]],\n",
" \n",
" [[195, 169]],\n",
" \n",
" [[194, 168]],\n",
" \n",
" [[195, 167]],\n",
" \n",
" [[194, 166]],\n",
" \n",
" [[195, 165]],\n",
" \n",
" [[194, 165]],\n",
" \n",
" [[193, 166]],\n",
" \n",
" [[192, 165]],\n",
" \n",
" [[191, 165]],\n",
" \n",
" [[190, 164]]], dtype=int32),\n",
" array([[[186, 190]]], dtype=int32),\n",
" array([[[187, 162]],\n",
" \n",
" [[188, 161]],\n",
" \n",
" [[189, 162]],\n",
" \n",
" [[188, 163]]], dtype=int32),\n",
" array([[[114, 162]],\n",
" \n",
" [[115, 161]],\n",
" \n",
" [[116, 162]],\n",
" \n",
" [[116, 163]],\n",
" \n",
" [[115, 164]],\n",
" \n",
" [[114, 163]]], dtype=int32),\n",
" array([[[112, 162]],\n",
" \n",
" [[113, 161]],\n",
" \n",
" [[114, 162]],\n",
" \n",
" [[114, 163]],\n",
" \n",
" [[113, 164]],\n",
" \n",
" [[112, 163]]], dtype=int32),\n",
" array([[[192, 161]],\n",
" \n",
" [[193, 160]],\n",
" \n",
" [[194, 161]],\n",
" \n",
" [[193, 162]]], dtype=int32),\n",
" array([[[169, 161]],\n",
" \n",
" [[170, 160]],\n",
" \n",
" [[171, 161]],\n",
" \n",
" [[170, 162]]], dtype=int32),\n",
" array([[[122, 161]],\n",
" \n",
" [[123, 160]],\n",
" \n",
" [[124, 160]],\n",
" \n",
" [[125, 161]],\n",
" \n",
" [[123, 163]],\n",
" \n",
" [[122, 162]]], dtype=int32),\n",
" array([[[120, 161]],\n",
" \n",
" [[121, 160]],\n",
" \n",
" [[122, 161]],\n",
" \n",
" [[121, 162]]], dtype=int32),\n",
" array([[[188, 160]],\n",
" \n",
" [[189, 159]],\n",
" \n",
" [[190, 160]],\n",
" \n",
" [[189, 161]]], dtype=int32),\n",
" array([[[185, 160]],\n",
" \n",
" [[186, 159]],\n",
" \n",
" [[187, 160]],\n",
" \n",
" [[186, 161]]], dtype=int32),\n",
" array([[[177, 160]],\n",
" \n",
" [[178, 159]],\n",
" \n",
" [[179, 159]],\n",
" \n",
" [[180, 160]],\n",
" \n",
" [[179, 161]],\n",
" \n",
" [[178, 161]]], dtype=int32),\n",
" array([[[126, 160]],\n",
" \n",
" [[127, 159]],\n",
" \n",
" [[128, 160]],\n",
" \n",
" [[127, 161]]], dtype=int32),\n",
" array([[[187, 159]],\n",
" \n",
" [[188, 158]],\n",
" \n",
" [[189, 159]],\n",
" \n",
" [[188, 160]]], dtype=int32),\n",
" array([[[176, 159]],\n",
" \n",
" [[177, 158]],\n",
" \n",
" [[178, 159]],\n",
" \n",
" [[177, 160]]], dtype=int32),\n",
" array([[[133, 159]],\n",
" \n",
" [[134, 158]],\n",
" \n",
" [[135, 159]],\n",
" \n",
" [[134, 160]]], dtype=int32),\n",
" array([[[131, 159]],\n",
" \n",
" [[132, 158]],\n",
" \n",
" [[133, 159]],\n",
" \n",
" [[133, 160]],\n",
" \n",
" [[132, 161]],\n",
" \n",
" [[129, 161]],\n",
" \n",
" [[128, 160]],\n",
" \n",
" [[129, 159]]], dtype=int32),\n",
" array([[[113, 159]],\n",
" \n",
" [[114, 158]],\n",
" \n",
" [[115, 159]],\n",
" \n",
" [[114, 160]]], dtype=int32),\n",
" array([[[196, 158]],\n",
" \n",
" [[197, 157]],\n",
" \n",
" [[198, 158]],\n",
" \n",
" [[198, 161]],\n",
" \n",
" [[197, 162]],\n",
" \n",
" [[196, 162]],\n",
" \n",
" [[195, 161]],\n",
" \n",
" [[195, 160]],\n",
" \n",
" [[196, 159]]], dtype=int32),\n",
" array([[[193, 158]],\n",
" \n",
" [[194, 157]],\n",
" \n",
" [[195, 158]],\n",
" \n",
" [[194, 159]]], dtype=int32),\n",
" array([[[135, 158]],\n",
" \n",
" [[136, 157]],\n",
" \n",
" [[137, 158]],\n",
" \n",
" [[136, 159]]], dtype=int32),\n",
" array([[[129, 158]],\n",
" \n",
" [[130, 157]],\n",
" \n",
" [[131, 158]],\n",
" \n",
" [[130, 159]]], dtype=int32),\n",
" array([[[109, 157]],\n",
" \n",
" [[111, 159]],\n",
" \n",
" [[110, 160]],\n",
" \n",
" [[108, 160]],\n",
" \n",
" [[107, 159]]], dtype=int32),\n",
" array([[[ 64, 158]],\n",
" \n",
" [[ 65, 157]],\n",
" \n",
" [[ 66, 158]],\n",
" \n",
" [[ 65, 159]]], dtype=int32),\n",
" array([[[197, 157]],\n",
" \n",
" [[198, 156]],\n",
" \n",
" [[199, 157]],\n",
" \n",
" [[198, 158]]], dtype=int32),\n",
" array([[[195, 157]],\n",
" \n",
" [[196, 156]],\n",
" \n",
" [[197, 157]],\n",
" \n",
" [[196, 158]]], dtype=int32),\n",
" array([[[192, 157]],\n",
" \n",
" [[193, 156]],\n",
" \n",
" [[194, 157]],\n",
" \n",
" [[193, 158]]], dtype=int32),\n",
" array([[[190, 156]],\n",
" \n",
" [[191, 155]],\n",
" \n",
" [[192, 156]],\n",
" \n",
" [[191, 157]]], dtype=int32),\n",
" array([[[175, 156]],\n",
" \n",
" [[176, 155]],\n",
" \n",
" [[177, 156]],\n",
" \n",
" [[176, 157]]], dtype=int32),\n",
" array([[[ 68, 155]],\n",
" \n",
" [[ 69, 156]],\n",
" \n",
" [[ 69, 157]],\n",
" \n",
" [[ 68, 158]],\n",
" \n",
" [[ 68, 159]],\n",
" \n",
" [[ 67, 160]],\n",
" \n",
" [[ 66, 160]],\n",
" \n",
" [[ 65, 159]],\n",
" \n",
" [[ 66, 158]],\n",
" \n",
" [[ 66, 157]]], dtype=int32),\n",
" array([[[196, 155]],\n",
" \n",
" [[197, 154]],\n",
" \n",
" [[198, 155]],\n",
" \n",
" [[197, 156]]], dtype=int32),\n",
" array([[[165, 155]],\n",
" \n",
" [[166, 154]],\n",
" \n",
" [[167, 155]],\n",
" \n",
" [[166, 156]]], dtype=int32),\n",
" array([[[193, 154]],\n",
" \n",
" [[194, 153]],\n",
" \n",
" [[195, 154]],\n",
" \n",
" [[195, 156]],\n",
" \n",
" [[194, 157]],\n",
" \n",
" [[193, 156]]], dtype=int32),\n",
" array([[[112, 154]],\n",
" \n",
" [[113, 153]],\n",
" \n",
" [[114, 154]],\n",
" \n",
" [[113, 155]]], dtype=int32),\n",
" array([[[108, 154]],\n",
" \n",
" [[109, 153]],\n",
" \n",
" [[110, 154]],\n",
" \n",
" [[109, 155]]], dtype=int32),\n",
" array([[[106, 154]],\n",
" \n",
" [[107, 153]],\n",
" \n",
" [[108, 154]],\n",
" \n",
" [[107, 155]]], dtype=int32),\n",
" array([[[195, 153]],\n",
" \n",
" [[196, 152]],\n",
" \n",
" [[197, 152]],\n",
" \n",
" [[198, 153]],\n",
" \n",
" [[197, 154]],\n",
" \n",
" [[196, 154]]], dtype=int32),\n",
" array([[[191, 153]],\n",
" \n",
" [[192, 152]],\n",
" \n",
" [[193, 153]],\n",
" \n",
" [[192, 154]]], dtype=int32),\n",
" array([[[187, 153]],\n",
" \n",
" [[188, 152]],\n",
" \n",
" [[189, 153]],\n",
" \n",
" [[189, 154]],\n",
" \n",
" [[188, 155]],\n",
" \n",
" [[187, 154]]], dtype=int32),\n",
" array([[[167, 153]],\n",
" \n",
" [[168, 152]],\n",
" \n",
" [[169, 153]],\n",
" \n",
" [[168, 154]]], dtype=int32),\n",
" array([[[122, 152]],\n",
" \n",
" [[123, 151]],\n",
" \n",
" [[124, 152]],\n",
" \n",
" [[123, 153]]], dtype=int32),\n",
" array([[[117, 151]],\n",
" \n",
" [[118, 152]],\n",
" \n",
" [[122, 152]],\n",
" \n",
" [[123, 153]],\n",
" \n",
" [[124, 152]],\n",
" \n",
" [[125, 153]],\n",
" \n",
" [[126, 152]],\n",
" \n",
" [[129, 152]],\n",
" \n",
" [[130, 153]],\n",
" \n",
" [[131, 152]],\n",
" \n",
" [[132, 152]],\n",
" \n",
" [[133, 153]],\n",
" \n",
" [[134, 152]],\n",
" \n",
" [[138, 152]],\n",
" \n",
" [[139, 151]],\n",
" \n",
" [[140, 151]],\n",
" \n",
" [[141, 152]],\n",
" \n",
" [[141, 153]],\n",
" \n",
" [[140, 154]],\n",
" \n",
" [[139, 154]],\n",
" \n",
" [[138, 155]],\n",
" \n",
" [[130, 155]],\n",
" \n",
" [[129, 156]],\n",
" \n",
" [[128, 155]],\n",
" \n",
" [[127, 156]],\n",
" \n",
" [[126, 156]],\n",
" \n",
" [[125, 155]],\n",
" \n",
" [[124, 156]],\n",
" \n",
" [[123, 155]],\n",
" \n",
" [[123, 156]],\n",
" \n",
" [[124, 156]],\n",
" \n",
" [[125, 157]],\n",
" \n",
" [[125, 158]],\n",
" \n",
" [[126, 159]],\n",
" \n",
" [[126, 160]],\n",
" \n",
" [[125, 161]],\n",
" \n",
" [[124, 160]],\n",
" \n",
" [[121, 160]],\n",
" \n",
" [[120, 161]],\n",
" \n",
" [[119, 160]],\n",
" \n",
" [[119, 159]],\n",
" \n",
" [[120, 158]],\n",
" \n",
" [[123, 158]],\n",
" \n",
" [[121, 158]],\n",
" \n",
" [[120, 157]],\n",
" \n",
" [[121, 156]],\n",
" \n",
" [[120, 156]],\n",
" \n",
" [[119, 157]],\n",
" \n",
" [[117, 155]],\n",
" \n",
" [[116, 155]],\n",
" \n",
" [[115, 154]],\n",
" \n",
" [[115, 153]]], dtype=int32),\n",
" array([[[197, 151]],\n",
" \n",
" [[198, 150]],\n",
" \n",
" [[199, 151]],\n",
" \n",
" [[199, 152]],\n",
" \n",
" [[198, 153]],\n",
" \n",
" [[197, 152]]], dtype=int32),\n",
" array([[[194, 151]],\n",
" \n",
" [[195, 150]],\n",
" \n",
" [[196, 150]],\n",
" \n",
" [[197, 151]],\n",
" \n",
" [[196, 152]],\n",
" \n",
" [[195, 152]]], dtype=int32),\n",
" array([[[192, 151]],\n",
" \n",
" [[193, 150]],\n",
" \n",
" [[194, 151]],\n",
" \n",
" [[194, 152]],\n",
" \n",
" [[193, 153]],\n",
" \n",
" [[192, 152]]], dtype=int32),\n",
" array([[[123, 151]],\n",
" \n",
" [[124, 150]],\n",
" \n",
" [[125, 150]],\n",
" \n",
" [[126, 151]],\n",
" \n",
" [[126, 152]],\n",
" \n",
" [[125, 153]]], dtype=int32),\n",
" array([[[141, 150]],\n",
" \n",
" [[142, 149]],\n",
" \n",
" [[143, 149]],\n",
" \n",
" [[144, 150]],\n",
" \n",
" [[143, 151]],\n",
" \n",
" [[142, 151]]], dtype=int32),\n",
" array([[[110, 150]],\n",
" \n",
" [[111, 149]],\n",
" \n",
" [[113, 151]],\n",
" \n",
" [[112, 152]],\n",
" \n",
" [[111, 152]],\n",
" \n",
" [[110, 151]]], dtype=int32),\n",
" array([[[196, 149]],\n",
" \n",
" [[197, 148]],\n",
" \n",
" [[198, 149]],\n",
" \n",
" [[197, 150]]], dtype=int32),\n",
" array([[[189, 149]],\n",
" \n",
" [[190, 148]],\n",
" \n",
" [[191, 149]],\n",
" \n",
" [[190, 150]]], dtype=int32),\n",
" array([[[182, 149]],\n",
" \n",
" [[183, 148]],\n",
" \n",
" [[184, 149]],\n",
" \n",
" [[183, 150]]], dtype=int32),\n",
" array([[[179, 149]],\n",
" \n",
" [[180, 148]],\n",
" \n",
" [[181, 149]],\n",
" \n",
" [[180, 150]]], dtype=int32),\n",
" array([[[124, 149]],\n",
" \n",
" [[125, 148]],\n",
" \n",
" [[126, 149]],\n",
" \n",
" [[125, 150]]], dtype=int32),\n",
" array([[[195, 148]],\n",
" \n",
" [[196, 147]],\n",
" \n",
" [[197, 148]],\n",
" \n",
" [[196, 149]]], dtype=int32),\n",
" array([[[193, 148]],\n",
" \n",
" [[194, 147]],\n",
" \n",
" [[195, 148]],\n",
" \n",
" [[194, 149]]], dtype=int32),\n",
" array([[[111, 148]],\n",
" \n",
" [[112, 147]],\n",
" \n",
" [[113, 148]],\n",
" \n",
" [[112, 149]]], dtype=int32),\n",
" array([[[108, 148]],\n",
" \n",
" [[109, 147]],\n",
" \n",
" [[111, 149]],\n",
" \n",
" [[110, 150]],\n",
" \n",
" [[109, 150]],\n",
" \n",
" [[108, 149]]], dtype=int32),\n",
" array([[[102, 148]],\n",
" \n",
" [[103, 147]],\n",
" \n",
" [[104, 148]],\n",
" \n",
" [[103, 149]]], dtype=int32),\n",
" array([[[188, 147]],\n",
" \n",
" [[189, 146]],\n",
" \n",
" [[190, 147]],\n",
" \n",
" [[189, 148]]], dtype=int32),\n",
" array([[[127, 147]],\n",
" \n",
" [[128, 146]],\n",
" \n",
" [[129, 147]],\n",
" \n",
" [[129, 148]],\n",
" \n",
" [[128, 149]],\n",
" \n",
" [[127, 148]]], dtype=int32),\n",
" array([[[ 72, 147]],\n",
" \n",
" [[ 73, 146]],\n",
" \n",
" [[ 74, 147]],\n",
" \n",
" [[ 73, 148]]], dtype=int32),\n",
" array([[[196, 146]],\n",
" \n",
" [[197, 145]],\n",
" \n",
" [[198, 146]],\n",
" \n",
" [[197, 147]]], dtype=int32),\n",
" array([[[192, 146]],\n",
" \n",
" [[193, 145]],\n",
" \n",
" [[194, 146]],\n",
" \n",
" [[193, 147]]], dtype=int32),\n",
" array([[[189, 146]],\n",
" \n",
" [[190, 145]],\n",
" \n",
" [[191, 146]],\n",
" \n",
" [[190, 147]]], dtype=int32),\n",
" array([[[194, 145]],\n",
" \n",
" [[195, 144]],\n",
" \n",
" [[196, 145]],\n",
" \n",
" [[195, 146]]], dtype=int32),\n",
" array([[[184, 145]],\n",
" \n",
" [[185, 144]],\n",
" \n",
" [[186, 144]],\n",
" \n",
" [[187, 145]],\n",
" \n",
" [[186, 146]],\n",
" \n",
" [[185, 146]]], dtype=int32),\n",
" array([[[142, 145]],\n",
" \n",
" [[143, 144]],\n",
" \n",
" [[144, 145]],\n",
" \n",
" [[143, 146]]], dtype=int32),\n",
" array([[[104, 145]],\n",
" \n",
" [[105, 144]],\n",
" \n",
" [[106, 144]],\n",
" \n",
" [[107, 145]],\n",
" \n",
" [[107, 148]],\n",
" \n",
" [[106, 149]],\n",
" \n",
" [[105, 148]],\n",
" \n",
" [[104, 148]],\n",
" \n",
" [[103, 147]],\n",
" \n",
" [[104, 146]],\n",
" \n",
" [[105, 146]]], dtype=int32),\n",
" array([[[197, 144]],\n",
" \n",
" [[198, 143]],\n",
" \n",
" [[199, 144]],\n",
" \n",
" [[198, 145]]], dtype=int32),\n",
" array([[[189, 144]],\n",
" \n",
" [[190, 143]],\n",
" \n",
" [[191, 144]],\n",
" \n",
" [[190, 145]]], dtype=int32),\n",
" array([[[106, 144]],\n",
" \n",
" [[107, 143]],\n",
" \n",
" [[108, 143]],\n",
" \n",
" [[109, 144]],\n",
" \n",
" [[108, 145]],\n",
" \n",
" [[107, 145]]], dtype=int32),\n",
" array([[[196, 143]],\n",
" \n",
" [[197, 142]],\n",
" \n",
" [[198, 143]],\n",
" \n",
" [[197, 144]]], dtype=int32),\n",
" array([[[172, 143]],\n",
" \n",
" [[173, 142]],\n",
" \n",
" [[174, 143]],\n",
" \n",
" [[173, 144]]], dtype=int32),\n",
" array([[[105, 143]],\n",
" \n",
" [[106, 142]],\n",
" \n",
" [[107, 143]],\n",
" \n",
" [[106, 144]]], dtype=int32),\n",
" array([[[103, 143]],\n",
" \n",
" [[104, 142]],\n",
" \n",
" [[105, 143]],\n",
" \n",
" [[104, 144]]], dtype=int32),\n",
" array([[[145, 142]],\n",
" \n",
" [[146, 141]],\n",
" \n",
" [[147, 142]],\n",
" \n",
" [[146, 143]]], dtype=int32),\n",
" array([[[143, 142]],\n",
" \n",
" [[144, 141]],\n",
" \n",
" [[145, 142]],\n",
" \n",
" [[144, 143]]], dtype=int32),\n",
" array([[[198, 141]],\n",
" \n",
" [[199, 140]],\n",
" \n",
" [[200, 141]],\n",
" \n",
" [[200, 143]],\n",
" \n",
" [[199, 144]],\n",
" \n",
" [[198, 143]]], dtype=int32),\n",
" array([[[107, 141]],\n",
" \n",
" [[108, 140]],\n",
" \n",
" [[109, 141]],\n",
" \n",
" [[108, 142]]], dtype=int32),\n",
" array([[[195, 140]],\n",
" \n",
" [[196, 139]],\n",
" \n",
" [[197, 140]],\n",
" \n",
" [[196, 141]]], dtype=int32),\n",
" array([[[143, 140]],\n",
" \n",
" [[144, 139]],\n",
" \n",
" [[145, 140]],\n",
" \n",
" [[144, 141]]], dtype=int32),\n",
" array([[[196, 139]],\n",
" \n",
" [[197, 138]],\n",
" \n",
" [[198, 139]],\n",
" \n",
" [[197, 140]]], dtype=int32),\n",
" array([[[146, 139]],\n",
" \n",
" [[147, 138]],\n",
" \n",
" [[148, 138]],\n",
" \n",
" [[149, 139]],\n",
" \n",
" [[148, 140]],\n",
" \n",
" [[147, 140]]], dtype=int32),\n",
" array([[[141, 139]],\n",
" \n",
" [[142, 138]],\n",
" \n",
" [[143, 139]],\n",
" \n",
" [[142, 140]]], dtype=int32),\n",
" array([[[194, 138]],\n",
" \n",
" [[195, 137]],\n",
" \n",
" [[196, 138]],\n",
" \n",
" [[195, 139]]], dtype=int32),\n",
" array([[[173, 138]],\n",
" \n",
" [[174, 137]],\n",
" \n",
" [[175, 138]],\n",
" \n",
" [[174, 139]]], dtype=int32),\n",
" array([[[140, 138]],\n",
" \n",
" [[141, 137]],\n",
" \n",
" [[142, 138]],\n",
" \n",
" [[141, 139]]], dtype=int32),\n",
" array([[[102, 138]],\n",
" \n",
" [[103, 137]],\n",
" \n",
" [[104, 138]],\n",
" \n",
" [[103, 139]]], dtype=int32),\n",
" array([[[145, 137]],\n",
" \n",
" [[146, 136]],\n",
" \n",
" [[147, 137]],\n",
" \n",
" [[146, 138]]], dtype=int32),\n",
" array([[[128, 137]],\n",
" \n",
" [[129, 136]],\n",
" \n",
" [[130, 137]],\n",
" \n",
" [[130, 138]],\n",
" \n",
" [[129, 139]],\n",
" \n",
" [[128, 138]]], dtype=int32),\n",
" array([[[123, 137]],\n",
" \n",
" [[124, 136]],\n",
" \n",
" [[125, 136]],\n",
" \n",
" [[126, 137]],\n",
" \n",
" [[127, 137]],\n",
" \n",
" [[128, 138]],\n",
" \n",
" [[128, 140]],\n",
" \n",
" [[127, 141]],\n",
" \n",
" [[128, 141]],\n",
" \n",
" [[129, 140]],\n",
" \n",
" [[131, 140]],\n",
" \n",
" [[130, 139]],\n",
" \n",
" [[131, 138]],\n",
" \n",
" [[132, 138]],\n",
" \n",
" [[132, 137]],\n",
" \n",
" [[133, 136]],\n",
" \n",
" [[134, 137]],\n",
" \n",
" [[134, 138]],\n",
" \n",
" [[135, 139]],\n",
" \n",
" [[135, 141]],\n",
" \n",
" [[136, 140]],\n",
" \n",
" [[137, 141]],\n",
" \n",
" [[137, 142]],\n",
" \n",
" [[136, 143]],\n",
" \n",
" [[136, 144]],\n",
" \n",
" [[135, 145]],\n",
" \n",
" [[134, 145]],\n",
" \n",
" [[132, 143]],\n",
" \n",
" [[131, 143]],\n",
" \n",
" [[129, 145]],\n",
" \n",
" [[127, 145]],\n",
" \n",
" [[125, 143]],\n",
" \n",
" [[125, 142]],\n",
" \n",
" [[124, 142]],\n",
" \n",
" [[123, 141]],\n",
" \n",
" [[124, 140]],\n",
" \n",
" [[124, 138]]], dtype=int32),\n",
" array([[[128, 143]]], dtype=int32),\n",
" array([[[133, 140]],\n",
" \n",
" [[133, 141]]], dtype=int32),\n",
" array([[[104, 137]],\n",
" \n",
" [[105, 136]],\n",
" \n",
" [[106, 137]],\n",
" \n",
" [[106, 138]],\n",
" \n",
" [[105, 139]],\n",
" \n",
" [[104, 138]]], dtype=int32),\n",
" array([[[201, 135]],\n",
" \n",
" [[203, 137]],\n",
" \n",
" [[202, 138]],\n",
" \n",
" [[201, 138]],\n",
" \n",
" [[200, 139]],\n",
" \n",
" [[199, 138]],\n",
" \n",
" [[199, 137]]], dtype=int32),\n",
" array([[[192, 136]],\n",
" \n",
" [[193, 135]],\n",
" \n",
" [[194, 136]],\n",
" \n",
" [[193, 137]]], dtype=int32),\n",
" array([[[190, 136]],\n",
" \n",
" [[191, 135]],\n",
" \n",
" [[192, 136]],\n",
" \n",
" [[191, 137]]], dtype=int32),\n",
" array([[[131, 136]],\n",
" \n",
" [[132, 135]],\n",
" \n",
" [[133, 136]],\n",
" \n",
" [[132, 137]]], dtype=int32),\n",
" array([[[129, 136]],\n",
" \n",
" [[130, 135]],\n",
" \n",
" [[131, 136]],\n",
" \n",
" [[130, 137]]], dtype=int32),\n",
" array([[[126, 136]],\n",
" \n",
" [[127, 135]],\n",
" \n",
" [[128, 136]],\n",
" \n",
" [[127, 137]]], dtype=int32),\n",
" array([[[194, 135]],\n",
" \n",
" [[195, 134]],\n",
" \n",
" [[196, 134]],\n",
" \n",
" [[197, 135]],\n",
" \n",
" [[196, 136]],\n",
" \n",
" [[195, 136]]], dtype=int32),\n",
" array([[[182, 135]],\n",
" \n",
" [[183, 134]],\n",
" \n",
" [[184, 134]],\n",
" \n",
" [[185, 135]],\n",
" \n",
" [[184, 136]],\n",
" \n",
" [[183, 136]]], dtype=int32),\n",
" array([[[127, 135]],\n",
" \n",
" [[128, 134]],\n",
" \n",
" [[129, 135]],\n",
" \n",
" [[128, 136]]], dtype=int32),\n",
" array([[[203, 133]],\n",
" \n",
" [[204, 134]],\n",
" \n",
" [[204, 135]],\n",
" \n",
" [[203, 136]],\n",
" \n",
" [[202, 136]],\n",
" \n",
" [[201, 135]]], dtype=int32),\n",
" array([[[194, 133]],\n",
" \n",
" [[195, 132]],\n",
" \n",
" [[196, 133]],\n",
" \n",
" [[195, 134]]], dtype=int32),\n",
" array([[[174, 133]],\n",
" \n",
" [[175, 132]],\n",
" \n",
" [[176, 133]],\n",
" \n",
" [[175, 134]]], dtype=int32),\n",
" array([[[198, 132]],\n",
" \n",
" [[199, 131]],\n",
" \n",
" [[200, 132]],\n",
" \n",
" [[199, 133]]], dtype=int32),\n",
" array([[[126, 132]],\n",
" \n",
" [[127, 131]],\n",
" \n",
" [[128, 132]],\n",
" \n",
" [[128, 133]],\n",
" \n",
" [[127, 134]],\n",
" \n",
" [[126, 133]]], dtype=int32),\n",
" array([[[197, 131]],\n",
" \n",
" [[198, 130]],\n",
" \n",
" [[199, 131]],\n",
" \n",
" [[198, 132]]], dtype=int32),\n",
" array([[[174, 131]],\n",
" \n",
" [[175, 130]],\n",
" \n",
" [[176, 130]],\n",
" \n",
" [[177, 131]],\n",
" \n",
" [[177, 132]],\n",
" \n",
" [[176, 133]]], dtype=int32),\n",
" array([[[129, 131]],\n",
" \n",
" [[130, 130]],\n",
" \n",
" [[134, 130]],\n",
" \n",
" [[135, 131]],\n",
" \n",
" [[134, 132]],\n",
" \n",
" [[133, 132]],\n",
" \n",
" [[133, 133]],\n",
" \n",
" [[134, 134]],\n",
" \n",
" [[133, 135]],\n",
" \n",
" [[132, 135]],\n",
" \n",
" [[131, 136]],\n",
" \n",
" [[130, 135]],\n",
" \n",
" [[130, 134]],\n",
" \n",
" [[129, 135]],\n",
" \n",
" [[128, 134]],\n",
" \n",
" [[128, 133]],\n",
" \n",
" [[129, 132]]], dtype=int32),\n",
" array([[[103, 131]],\n",
" \n",
" [[104, 130]],\n",
" \n",
" [[106, 132]],\n",
" \n",
" [[105, 133]],\n",
" \n",
" [[104, 133]],\n",
" \n",
" [[103, 132]]], dtype=int32),\n",
" array([[[200, 130]],\n",
" \n",
" [[201, 129]],\n",
" \n",
" [[202, 129]],\n",
" \n",
" [[203, 130]],\n",
" \n",
" [[203, 131]],\n",
" \n",
" [[204, 132]],\n",
" \n",
" [[202, 134]],\n",
" \n",
" [[201, 134]],\n",
" \n",
" [[201, 135]],\n",
" \n",
" [[200, 136]],\n",
" \n",
" [[199, 135]],\n",
" \n",
" [[199, 133]],\n",
" \n",
" [[200, 132]],\n",
" \n",
" [[201, 132]],\n",
" \n",
" [[201, 131]]], dtype=int32),\n",
" array([[[196, 130]],\n",
" \n",
" [[197, 129]],\n",
" \n",
" [[198, 130]],\n",
" \n",
" [[197, 131]]], dtype=int32),\n",
" array([[[191, 129]],\n",
" \n",
" [[192, 128]],\n",
" \n",
" [[193, 129]],\n",
" \n",
" [[192, 130]]], dtype=int32),\n",
" array([[[184, 129]],\n",
" \n",
" [[185, 128]],\n",
" \n",
" [[186, 129]],\n",
" \n",
" [[185, 130]]], dtype=int32),\n",
" array([[[176, 129]],\n",
" \n",
" [[177, 128]],\n",
" \n",
" [[178, 129]],\n",
" \n",
" [[177, 130]]], dtype=int32),\n",
" array([[[144, 129]],\n",
" \n",
" [[145, 128]],\n",
" \n",
" [[146, 129]],\n",
" \n",
" [[145, 130]]], dtype=int32),\n",
" array([[[130, 129]],\n",
" \n",
" [[131, 128]],\n",
" \n",
" [[133, 128]],\n",
" \n",
" [[134, 129]],\n",
" \n",
" [[133, 130]],\n",
" \n",
" [[131, 130]]], dtype=int32),\n",
" array([[[128, 129]],\n",
" \n",
" [[129, 128]],\n",
" \n",
" [[130, 129]],\n",
" \n",
" [[130, 130]],\n",
" \n",
" [[129, 131]],\n",
" \n",
" [[128, 130]]], dtype=int32),\n",
" array([[[205, 127]],\n",
" \n",
" [[206, 128]],\n",
" \n",
" [[206, 130]],\n",
" \n",
" [[205, 131]],\n",
" \n",
" [[203, 129]]], dtype=int32),\n",
" array([[[202, 127]],\n",
" \n",
" [[203, 126]],\n",
" \n",
" [[204, 126]],\n",
" \n",
" [[205, 127]],\n",
" \n",
" [[204, 128]],\n",
" \n",
" [[203, 128]]], dtype=int32),\n",
" array([[[181, 127]],\n",
" \n",
" [[182, 126]],\n",
" \n",
" [[183, 127]],\n",
" \n",
" [[182, 128]]], dtype=int32),\n",
" array([[[144, 127]],\n",
" \n",
" [[145, 126]],\n",
" \n",
" [[146, 127]],\n",
" \n",
" [[145, 128]]], dtype=int32),\n",
" array([[[130, 127]],\n",
" \n",
" [[131, 126]],\n",
" \n",
" [[132, 127]],\n",
" \n",
" [[131, 128]]], dtype=int32),\n",
" array([[[127, 127]],\n",
" \n",
" [[128, 126]],\n",
" \n",
" [[129, 127]],\n",
" \n",
" [[129, 128]],\n",
" \n",
" [[128, 129]],\n",
" \n",
" [[127, 128]]], dtype=int32),\n",
" array([[[197, 126]],\n",
" \n",
" [[198, 125]],\n",
" \n",
" [[199, 126]],\n",
" \n",
" [[198, 127]]], dtype=int32),\n",
" array([[[175, 126]],\n",
" \n",
" [[176, 125]],\n",
" \n",
" [[177, 125]],\n",
" \n",
" [[179, 127]],\n",
" \n",
" [[178, 128]],\n",
" \n",
" [[177, 128]]], dtype=int32),\n",
" array([[[126, 126]],\n",
" \n",
" [[127, 125]],\n",
" \n",
" [[128, 126]],\n",
" \n",
" [[127, 127]]], dtype=int32),\n",
" array([[[208, 125]],\n",
" \n",
" [[209, 124]],\n",
" \n",
" [[210, 125]],\n",
" \n",
" [[209, 126]]], dtype=int32),\n",
" array([[[207, 124]],\n",
" \n",
" [[209, 126]],\n",
" \n",
" [[209, 127]],\n",
" \n",
" [[208, 128]],\n",
" \n",
" [[206, 128]],\n",
" \n",
" [[205, 127]],\n",
" \n",
" [[205, 126]]], dtype=int32),\n",
" array([[[201, 125]],\n",
" \n",
" [[202, 124]],\n",
" \n",
" [[203, 125]],\n",
" \n",
" [[203, 126]],\n",
" \n",
" [[202, 127]],\n",
" \n",
" [[201, 126]]], dtype=int32),\n",
" array([[[124, 125]],\n",
" \n",
" [[125, 124]],\n",
" \n",
" [[126, 125]],\n",
" \n",
" [[125, 126]]], dtype=int32),\n",
" array([[[101, 125]],\n",
" \n",
" [[102, 124]],\n",
" \n",
" [[103, 125]],\n",
" \n",
" [[103, 126]],\n",
" \n",
" [[104, 125]],\n",
" \n",
" [[105, 126]],\n",
" \n",
" [[105, 128]],\n",
" \n",
" [[104, 129]],\n",
" \n",
" [[103, 128]],\n",
" \n",
" [[102, 128]],\n",
" \n",
" [[101, 127]]], dtype=int32),\n",
" array([[[ 89, 125]],\n",
" \n",
" [[ 90, 124]],\n",
" \n",
" [[ 91, 125]],\n",
" \n",
" [[ 91, 126]],\n",
" \n",
" [[ 90, 127]],\n",
" \n",
" [[ 89, 126]]], dtype=int32),\n",
" array([[[132, 124]],\n",
" \n",
" [[133, 123]],\n",
" \n",
" [[134, 124]],\n",
" \n",
" [[133, 125]]], dtype=int32),\n",
" array([[[207, 123]],\n",
" \n",
" [[208, 122]],\n",
" \n",
" [[209, 123]],\n",
" \n",
" [[208, 124]]], dtype=int32),\n",
" array([[[188, 123]],\n",
" \n",
" [[189, 122]],\n",
" \n",
" [[190, 123]],\n",
" \n",
" [[189, 124]]], dtype=int32),\n",
" array([[[142, 123]],\n",
" \n",
" [[143, 122]],\n",
" \n",
" [[144, 123]],\n",
" \n",
" [[144, 124]],\n",
" \n",
" [[143, 125]],\n",
" \n",
" [[142, 124]]], dtype=int32),\n",
" array([[[128, 123]],\n",
" \n",
" [[129, 122]],\n",
" \n",
" [[132, 122]],\n",
" \n",
" [[133, 123]],\n",
" \n",
" [[132, 124]],\n",
" \n",
" [[133, 125]],\n",
" \n",
" [[133, 126]],\n",
" \n",
" [[132, 127]],\n",
" \n",
" [[131, 126]],\n",
" \n",
" [[130, 127]],\n",
" \n",
" [[129, 126]],\n",
" \n",
" [[129, 125]],\n",
" \n",
" [[130, 124]],\n",
" \n",
" [[129, 124]]], dtype=int32),\n",
" array([[[ 90, 123]],\n",
" \n",
" [[ 91, 122]],\n",
" \n",
" [[ 92, 123]],\n",
" \n",
" [[ 92, 124]],\n",
" \n",
" [[ 91, 125]],\n",
" \n",
" [[ 90, 124]]], dtype=int32),\n",
" array([[[208, 122]],\n",
" \n",
" [[209, 121]],\n",
" \n",
" [[212, 121]],\n",
" \n",
" [[213, 122]],\n",
" \n",
" [[211, 124]],\n",
" \n",
" [[210, 123]],\n",
" \n",
" [[209, 123]]], dtype=int32),\n",
" array([[[177, 122]],\n",
" \n",
" [[178, 121]],\n",
" \n",
" [[179, 122]],\n",
" \n",
" [[178, 123]]], dtype=int32),\n",
" array([[[127, 121]],\n",
" \n",
" [[128, 122]],\n",
" \n",
" [[128, 123]],\n",
" \n",
" [[127, 124]],\n",
" \n",
" [[126, 124]],\n",
" \n",
" [[125, 123]]], dtype=int32),\n",
" array([[[119, 122]],\n",
" \n",
" [[120, 121]],\n",
" \n",
" [[121, 121]],\n",
" \n",
" [[122, 122]],\n",
" \n",
" [[121, 123]],\n",
" \n",
" [[120, 123]]], dtype=int32),\n",
" array([[[178, 121]],\n",
" \n",
" [[179, 120]],\n",
" \n",
" [[180, 121]],\n",
" \n",
" [[179, 122]]], dtype=int32),\n",
" array([[[214, 120]],\n",
" \n",
" [[215, 119]],\n",
" \n",
" [[216, 119]],\n",
" \n",
" [[217, 120]],\n",
" \n",
" [[216, 121]],\n",
" \n",
" [[215, 121]]], dtype=int32),\n",
" array([[[206, 120]],\n",
" \n",
" [[207, 119]],\n",
" \n",
" [[208, 120]],\n",
" \n",
" [[208, 121]],\n",
" \n",
" [[207, 122]],\n",
" \n",
" [[206, 121]]], dtype=int32),\n",
" array([[[211, 119]],\n",
" \n",
" [[212, 118]],\n",
" \n",
" [[213, 119]],\n",
" \n",
" [[212, 120]]], dtype=int32),\n",
" array([[[183, 119]],\n",
" \n",
" [[184, 118]],\n",
" \n",
" [[185, 119]],\n",
" \n",
" [[184, 120]]], dtype=int32),\n",
" array([[[216, 118]],\n",
" \n",
" [[217, 117]],\n",
" \n",
" [[218, 117]],\n",
" \n",
" [[219, 118]],\n",
" \n",
" [[217, 120]],\n",
" \n",
" [[216, 119]]], dtype=int32),\n",
" array([[[212, 118]],\n",
" \n",
" [[213, 117]],\n",
" \n",
" [[214, 118]],\n",
" \n",
" [[213, 119]]], dtype=int32),\n",
" array([[[210, 118]],\n",
" \n",
" [[211, 117]],\n",
" \n",
" [[212, 118]],\n",
" \n",
" [[211, 119]]], dtype=int32),\n",
" array([[[179, 118]],\n",
" \n",
" [[180, 117]],\n",
" \n",
" [[181, 118]],\n",
" \n",
" [[180, 119]]], dtype=int32),\n",
" array([[[ 47, 118]],\n",
" \n",
" [[ 48, 117]],\n",
" \n",
" [[ 49, 117]],\n",
" \n",
" [[ 50, 118]],\n",
" \n",
" [[ 49, 119]],\n",
" \n",
" [[ 48, 119]]], dtype=int32),\n",
" array([[[222, 116]],\n",
" \n",
" [[223, 117]],\n",
" \n",
" [[223, 118]],\n",
" \n",
" [[222, 119]],\n",
" \n",
" [[221, 119]],\n",
" \n",
" [[220, 118]]], dtype=int32),\n",
" array([[[200, 117]],\n",
" \n",
" [[201, 116]],\n",
" \n",
" [[202, 117]],\n",
" \n",
" [[201, 118]]], dtype=int32),\n",
" array([[[218, 116]],\n",
" \n",
" [[219, 115]],\n",
" \n",
" [[220, 116]],\n",
" \n",
" [[219, 117]]], dtype=int32),\n",
" array([[[216, 116]],\n",
" \n",
" [[217, 115]],\n",
" \n",
" [[218, 116]],\n",
" \n",
" [[217, 117]]], dtype=int32),\n",
" array([[[ 49, 116]],\n",
" \n",
" [[ 50, 115]],\n",
" \n",
" [[ 51, 116]],\n",
" \n",
" [[ 50, 117]]], dtype=int32),\n",
" array([[[180, 115]],\n",
" \n",
" [[181, 114]],\n",
" \n",
" [[182, 115]],\n",
" \n",
" [[181, 116]]], dtype=int32),\n",
" array([[[ 50, 115]],\n",
" \n",
" [[ 51, 114]],\n",
" \n",
" [[ 52, 115]],\n",
" \n",
" [[ 51, 116]]], dtype=int32),\n",
" array([[[219, 114]],\n",
" \n",
" [[220, 113]],\n",
" \n",
" [[221, 114]],\n",
" \n",
" [[220, 115]]], dtype=int32),\n",
" array([[[215, 114]],\n",
" \n",
" [[216, 113]],\n",
" \n",
" [[217, 114]],\n",
" \n",
" [[216, 115]]], dtype=int32),\n",
" array([[[ 95, 114]],\n",
" \n",
" [[ 96, 113]],\n",
" \n",
" [[ 97, 114]],\n",
" \n",
" [[ 97, 115]],\n",
" \n",
" [[ 96, 116]],\n",
" \n",
" [[ 95, 115]]], dtype=int32),\n",
" array([[[ 96, 113]],\n",
" \n",
" [[ 97, 112]],\n",
" \n",
" [[ 98, 113]],\n",
" \n",
" [[ 97, 114]]], dtype=int32),\n",
" array([[[220, 112]],\n",
" \n",
" [[221, 111]],\n",
" \n",
" [[222, 112]],\n",
" \n",
" [[221, 113]]], dtype=int32),\n",
" array([[[179, 112]],\n",
" \n",
" [[180, 111]],\n",
" \n",
" [[181, 112]],\n",
" \n",
" [[180, 113]]], dtype=int32),\n",
" array([[[181, 111]],\n",
" \n",
" [[182, 110]],\n",
" \n",
" [[184, 112]],\n",
" \n",
" [[183, 113]],\n",
" \n",
" [[182, 113]],\n",
" \n",
" [[181, 112]]], dtype=int32),\n",
" array([[[ 97, 111]],\n",
" \n",
" [[ 98, 110]],\n",
" \n",
" [[ 99, 111]],\n",
" \n",
" [[ 99, 112]],\n",
" \n",
" [[ 98, 113]],\n",
" \n",
" [[ 97, 112]]], dtype=int32),\n",
" array([[[ 54, 111]],\n",
" \n",
" [[ 55, 110]],\n",
" \n",
" [[ 56, 111]],\n",
" \n",
" [[ 55, 112]]], dtype=int32),\n",
" array([[[ 98, 110]],\n",
" \n",
" [[ 99, 109]],\n",
" \n",
" [[100, 110]],\n",
" \n",
" [[ 99, 111]]], dtype=int32),\n",
" array([[[220, 109]],\n",
" \n",
" [[221, 108]],\n",
" \n",
" [[222, 109]],\n",
" \n",
" [[221, 110]]], dtype=int32),\n",
" array([[[117, 109]],\n",
" \n",
" [[118, 108]],\n",
" \n",
" [[119, 109]],\n",
" \n",
" [[118, 110]]], dtype=int32),\n",
" array([[[216, 108]],\n",
" \n",
" [[217, 107]],\n",
" \n",
" [[218, 108]],\n",
" \n",
" [[217, 109]]], dtype=int32),\n",
" array([[[222, 107]],\n",
" \n",
" [[223, 106]],\n",
" \n",
" [[224, 107]],\n",
" \n",
" [[223, 108]]], dtype=int32),\n",
" array([[[101, 106]],\n",
" \n",
" [[102, 107]],\n",
" \n",
" [[102, 108]],\n",
" \n",
" [[100, 110]],\n",
" \n",
" [[ 99, 109]],\n",
" \n",
" [[ 99, 108]]], dtype=int32),\n",
" array([[[215, 106]],\n",
" \n",
" [[216, 105]],\n",
" \n",
" [[217, 105]],\n",
" \n",
" [[218, 106]],\n",
" \n",
" [[217, 107]],\n",
" \n",
" [[216, 107]]], dtype=int32),\n",
" array([[[212, 105]],\n",
" \n",
" [[213, 104]],\n",
" \n",
" [[214, 105]],\n",
" \n",
" [[213, 106]]], dtype=int32),\n",
" array([[[203, 104]],\n",
" \n",
" [[204, 103]],\n",
" \n",
" [[205, 104]],\n",
" \n",
" [[204, 105]]], dtype=int32),\n",
" array([[[221, 103]],\n",
" \n",
" [[222, 102]],\n",
" \n",
" [[223, 103]],\n",
" \n",
" [[222, 104]]], dtype=int32),\n",
" array([[[188, 103]],\n",
" \n",
" [[189, 102]],\n",
" \n",
" [[190, 103]],\n",
" \n",
" [[189, 104]]], dtype=int32),\n",
" array([[[114, 103]],\n",
" \n",
" [[115, 102]],\n",
" \n",
" [[116, 103]],\n",
" \n",
" [[115, 104]]], dtype=int32),\n",
" array([[[103, 103]],\n",
" \n",
" [[104, 102]],\n",
" \n",
" [[105, 102]],\n",
" \n",
" [[106, 103]],\n",
" \n",
" [[104, 105]],\n",
" \n",
" [[103, 104]]], dtype=int32),\n",
" array([[[ 57, 103]],\n",
" \n",
" [[ 58, 102]],\n",
" \n",
" [[ 59, 103]],\n",
" \n",
" [[ 58, 104]]], dtype=int32),\n",
" array([[[185, 101]],\n",
" \n",
" [[186, 102]],\n",
" \n",
" [[186, 103]],\n",
" \n",
" [[184, 105]],\n",
" \n",
" [[183, 104]],\n",
" \n",
" [[183, 103]]], dtype=int32),\n",
" array([[[ 58, 102]],\n",
" \n",
" [[ 59, 101]],\n",
" \n",
" [[ 60, 102]],\n",
" \n",
" [[ 59, 103]]], dtype=int32),\n",
" array([[[ 57, 101]],\n",
" \n",
" [[ 58, 100]],\n",
" \n",
" [[ 59, 101]],\n",
" \n",
" [[ 58, 102]]], dtype=int32),\n",
" array([[[221, 100]],\n",
" \n",
" [[222, 99]],\n",
" \n",
" [[223, 100]],\n",
" \n",
" [[222, 101]]], dtype=int32),\n",
" array([[[195, 100]],\n",
" \n",
" [[196, 99]],\n",
" \n",
" [[197, 100]],\n",
" \n",
" [[196, 101]]], dtype=int32),\n",
" array([[[126, 100]],\n",
" \n",
" [[127, 99]],\n",
" \n",
" [[128, 100]],\n",
" \n",
" [[127, 101]]], dtype=int32),\n",
" array([[[114, 99]],\n",
" \n",
" [[115, 98]],\n",
" \n",
" [[116, 99]],\n",
" \n",
" [[115, 100]]], dtype=int32),\n",
" array([[[219, 96]],\n",
" \n",
" [[220, 95]],\n",
" \n",
" [[221, 96]],\n",
" \n",
" [[220, 97]]], dtype=int32),\n",
" array([[[207, 96]],\n",
" \n",
" [[208, 95]],\n",
" \n",
" [[209, 96]],\n",
" \n",
" [[208, 97]]], dtype=int32),\n",
" array([[[188, 94]],\n",
" \n",
" [[189, 95]],\n",
" \n",
" [[189, 97]],\n",
" \n",
" [[188, 98]],\n",
" \n",
" [[188, 99]],\n",
" \n",
" [[187, 100]],\n",
" \n",
" [[186, 99]],\n",
" \n",
" [[186, 96]]], dtype=int32),\n",
" array([[[73, 95]],\n",
" \n",
" [[74, 94]],\n",
" \n",
" [[75, 95]],\n",
" \n",
" [[74, 96]]], dtype=int32),\n",
" array([[[68, 95]],\n",
" \n",
" [[69, 94]],\n",
" \n",
" [[71, 94]],\n",
" \n",
" [[72, 95]],\n",
" \n",
" [[71, 96]],\n",
" \n",
" [[71, 97]],\n",
" \n",
" [[70, 98]],\n",
" \n",
" [[69, 98]],\n",
" \n",
" [[68, 97]]], dtype=int32),\n",
" array([[[70, 92]],\n",
" \n",
" [[71, 91]],\n",
" \n",
" [[72, 92]],\n",
" \n",
" [[71, 93]]], dtype=int32),\n",
" array([[[62, 90]],\n",
" \n",
" [[63, 89]],\n",
" \n",
" [[64, 90]],\n",
" \n",
" [[64, 91]],\n",
" \n",
" [[63, 92]],\n",
" \n",
" [[62, 91]]], dtype=int32),\n",
" array([[[190, 89]],\n",
" \n",
" [[191, 88]],\n",
" \n",
" [[193, 90]],\n",
" \n",
" [[192, 91]],\n",
" \n",
" [[191, 91]],\n",
" \n",
" [[190, 90]]], dtype=int32),\n",
" array([[[189, 88]],\n",
" \n",
" [[190, 87]],\n",
" \n",
" [[191, 88]],\n",
" \n",
" [[190, 89]]], dtype=int32),\n",
" array([[[221, 87]],\n",
" \n",
" [[222, 86]],\n",
" \n",
" [[223, 87]],\n",
" \n",
" [[222, 88]]], dtype=int32),\n",
" array([[[120, 87]],\n",
" \n",
" [[121, 86]],\n",
" \n",
" [[122, 87]],\n",
" \n",
" [[121, 88]]], dtype=int32),\n",
" array([[[77, 86]],\n",
" \n",
" [[79, 88]],\n",
" \n",
" [[76, 91]],\n",
" \n",
" [[74, 91]],\n",
" \n",
" [[73, 90]],\n",
" \n",
" [[74, 89]],\n",
" \n",
" [[75, 89]],\n",
" \n",
" [[75, 88]]], dtype=int32),\n",
" array([[[121, 86]],\n",
" \n",
" [[122, 85]],\n",
" \n",
" [[123, 86]],\n",
" \n",
" [[122, 87]]], dtype=int32),\n",
" array([[[222, 85]],\n",
" \n",
" [[223, 84]],\n",
" \n",
" [[224, 85]],\n",
" \n",
" [[223, 86]]], dtype=int32),\n",
" array([[[86, 85]],\n",
" \n",
" [[87, 84]],\n",
" \n",
" [[88, 85]],\n",
" \n",
" [[87, 86]]], dtype=int32),\n",
" array([[[63, 85]],\n",
" \n",
" [[64, 84]],\n",
" \n",
" [[65, 85]],\n",
" \n",
" [[64, 86]]], dtype=int32),\n",
" array([[[61, 85]],\n",
" \n",
" [[62, 84]],\n",
" \n",
" [[63, 85]],\n",
" \n",
" [[62, 86]]], dtype=int32),\n",
" array([[[123, 84]],\n",
" \n",
" [[124, 83]],\n",
" \n",
" [[125, 84]],\n",
" \n",
" [[124, 85]]], dtype=int32),\n",
" array([[[69, 84]],\n",
" \n",
" [[70, 83]],\n",
" \n",
" [[71, 84]],\n",
" \n",
" [[70, 85]]], dtype=int32),\n",
" array([[[59, 84]],\n",
" \n",
" [[60, 83]],\n",
" \n",
" [[61, 83]],\n",
" \n",
" [[62, 84]],\n",
" \n",
" [[61, 85]],\n",
" \n",
" [[60, 85]]], dtype=int32),\n",
" array([[[125, 83]],\n",
" \n",
" [[126, 82]],\n",
" \n",
" [[127, 83]],\n",
" \n",
" [[126, 84]]], dtype=int32),\n",
" array([[[85, 83]],\n",
" \n",
" [[86, 82]],\n",
" \n",
" [[87, 83]],\n",
" \n",
" [[86, 84]]], dtype=int32),\n",
" array([[[79, 83]],\n",
" \n",
" [[80, 82]],\n",
" \n",
" [[81, 83]],\n",
" \n",
" [[80, 84]]], dtype=int32),\n",
" array([[[71, 83]],\n",
" \n",
" [[72, 82]],\n",
" \n",
" [[73, 83]],\n",
" \n",
" [[73, 84]],\n",
" \n",
" [[72, 85]],\n",
" \n",
" [[71, 84]]], dtype=int32),\n",
" array([[[62, 82]],\n",
" \n",
" [[63, 81]],\n",
" \n",
" [[64, 81]],\n",
" \n",
" [[65, 82]],\n",
" \n",
" [[64, 83]],\n",
" \n",
" [[63, 83]]], dtype=int32),\n",
" array([[[126, 81]],\n",
" \n",
" [[127, 80]],\n",
" \n",
" [[128, 81]],\n",
" \n",
" [[128, 82]],\n",
" \n",
" [[127, 83]],\n",
" \n",
" [[126, 82]]], dtype=int32),\n",
" array([[[128, 80]],\n",
" \n",
" [[129, 79]],\n",
" \n",
" [[130, 80]],\n",
" \n",
" [[129, 81]]], dtype=int32),\n",
" array([[[84, 80]],\n",
" \n",
" [[85, 79]],\n",
" \n",
" [[86, 80]],\n",
" \n",
" [[85, 81]]], dtype=int32),\n",
" array([[[79, 80]],\n",
" \n",
" [[80, 79]],\n",
" \n",
" [[81, 79]],\n",
" \n",
" [[82, 80]],\n",
" \n",
" [[82, 81]],\n",
" \n",
" [[81, 82]],\n",
" \n",
" [[80, 82]],\n",
" \n",
" [[79, 81]]], dtype=int32),\n",
" array([[[193, 79]],\n",
" \n",
" [[194, 78]],\n",
" \n",
" [[195, 79]],\n",
" \n",
" [[194, 80]]], dtype=int32),\n",
" array([[[87, 79]],\n",
" \n",
" [[88, 78]],\n",
" \n",
" [[89, 79]],\n",
" \n",
" [[88, 80]]], dtype=int32),\n",
" array([[[78, 79]],\n",
" \n",
" [[79, 78]],\n",
" \n",
" [[80, 79]],\n",
" \n",
" [[79, 80]]], dtype=int32),\n",
" array([[[59, 79]],\n",
" \n",
" [[60, 78]],\n",
" \n",
" [[61, 78]],\n",
" \n",
" [[62, 79]],\n",
" \n",
" [[61, 80]],\n",
" \n",
" [[60, 80]]], dtype=int32),\n",
" array([[[207, 78]],\n",
" \n",
" [[208, 77]],\n",
" \n",
" [[209, 78]],\n",
" \n",
" [[208, 79]]], dtype=int32),\n",
" array([[[108, 78]],\n",
" \n",
" [[109, 77]],\n",
" \n",
" [[110, 78]],\n",
" \n",
" [[109, 79]]], dtype=int32),\n",
" array([[[88, 78]],\n",
" \n",
" [[89, 77]],\n",
" \n",
" [[90, 78]],\n",
" \n",
" [[89, 79]]], dtype=int32),\n",
" array([[[84, 78]],\n",
" \n",
" [[85, 77]],\n",
" \n",
" [[86, 78]],\n",
" \n",
" [[85, 79]]], dtype=int32),\n",
" array([[[62, 78]],\n",
" \n",
" [[63, 77]],\n",
" \n",
" [[64, 78]],\n",
" \n",
" [[63, 79]]], dtype=int32),\n",
" array([[[86, 77]],\n",
" \n",
" [[87, 76]],\n",
" \n",
" [[88, 77]],\n",
" \n",
" [[87, 78]]], dtype=int32),\n",
" array([[[81, 76]],\n",
" \n",
" [[83, 78]],\n",
" \n",
" [[84, 78]],\n",
" \n",
" [[85, 79]],\n",
" \n",
" [[84, 80]],\n",
" \n",
" [[82, 80]],\n",
" \n",
" [[81, 79]],\n",
" \n",
" [[80, 79]],\n",
" \n",
" [[79, 78]]], dtype=int32),\n",
" array([[[115, 76]],\n",
" \n",
" [[116, 75]],\n",
" \n",
" [[117, 76]],\n",
" \n",
" [[116, 77]]], dtype=int32),\n",
" array([[[76, 76]],\n",
" \n",
" [[77, 75]],\n",
" \n",
" [[78, 76]],\n",
" \n",
" [[77, 77]]], dtype=int32),\n",
" array([[[220, 75]],\n",
" \n",
" [[221, 74]],\n",
" \n",
" [[222, 75]],\n",
" \n",
" [[221, 76]]], dtype=int32),\n",
" array([[[82, 75]],\n",
" \n",
" [[83, 74]],\n",
" \n",
" [[84, 74]],\n",
" \n",
" [[86, 76]],\n",
" \n",
" [[84, 78]],\n",
" \n",
" [[83, 77]],\n",
" \n",
" [[83, 76]]], dtype=int32),\n",
" array([[[205, 74]],\n",
" \n",
" [[206, 73]],\n",
" \n",
" [[207, 74]],\n",
" \n",
" [[206, 75]]], dtype=int32),\n",
" array([[[197, 74]],\n",
" \n",
" [[198, 73]],\n",
" \n",
" [[199, 74]],\n",
" \n",
" [[198, 75]]], dtype=int32),\n",
" array([[[173, 74]],\n",
" \n",
" [[174, 73]],\n",
" \n",
" [[175, 73]],\n",
" \n",
" [[176, 74]],\n",
" \n",
" [[176, 75]],\n",
" \n",
" [[174, 77]],\n",
" \n",
" [[173, 77]],\n",
" \n",
" [[173, 78]],\n",
" \n",
" [[171, 80]],\n",
" \n",
" [[170, 80]],\n",
" \n",
" [[168, 82]],\n",
" \n",
" [[166, 82]],\n",
" \n",
" [[166, 83]],\n",
" \n",
" [[165, 84]],\n",
" \n",
" [[161, 84]],\n",
" \n",
" [[160, 85]],\n",
" \n",
" [[159, 85]],\n",
" \n",
" [[158, 84]],\n",
" \n",
" [[157, 85]],\n",
" \n",
" [[157, 87]],\n",
" \n",
" [[159, 89]],\n",
" \n",
" [[159, 92]],\n",
" \n",
" [[158, 93]],\n",
" \n",
" [[157, 92]],\n",
" \n",
" [[157, 91]],\n",
" \n",
" [[156, 90]],\n",
" \n",
" [[156, 89]],\n",
" \n",
" [[155, 89]],\n",
" \n",
" [[153, 87]],\n",
" \n",
" [[153, 86]],\n",
" \n",
" [[153, 87]],\n",
" \n",
" [[155, 89]],\n",
" \n",
" [[155, 91]],\n",
" \n",
" [[156, 90]],\n",
" \n",
" [[157, 91]],\n",
" \n",
" [[157, 93]],\n",
" \n",
" [[158, 94]],\n",
" \n",
" [[158, 98]],\n",
" \n",
" [[159, 99]],\n",
" \n",
" [[159, 101]],\n",
" \n",
" [[160, 102]],\n",
" \n",
" [[160, 109]],\n",
" \n",
" [[161, 110]],\n",
" \n",
" [[161, 123]],\n",
" \n",
" [[162, 124]],\n",
" \n",
" [[162, 136]],\n",
" \n",
" [[163, 137]],\n",
" \n",
" [[163, 142]],\n",
" \n",
" [[164, 143]],\n",
" \n",
" [[164, 150]],\n",
" \n",
" [[165, 151]],\n",
" \n",
" [[165, 163]],\n",
" \n",
" [[166, 164]],\n",
" \n",
" [[166, 168]],\n",
" \n",
" [[165, 169]],\n",
" \n",
" [[165, 178]],\n",
" \n",
" [[164, 179]],\n",
" \n",
" [[164, 187]],\n",
" \n",
" [[163, 188]],\n",
" \n",
" [[163, 194]],\n",
" \n",
" [[164, 195]],\n",
" \n",
" [[162, 197]],\n",
" \n",
" [[163, 198]],\n",
" \n",
" [[163, 200]],\n",
" \n",
" [[164, 201]],\n",
" \n",
" [[163, 202]],\n",
" \n",
" [[162, 202]],\n",
" \n",
" [[161, 201]],\n",
" \n",
" [[161, 200]],\n",
" \n",
" [[160, 199]],\n",
" \n",
" [[160, 197]],\n",
" \n",
" [[159, 196]],\n",
" \n",
" [[159, 193]],\n",
" \n",
" [[158, 192]],\n",
" \n",
" [[158, 190]],\n",
" \n",
" [[157, 189]],\n",
" \n",
" [[157, 188]],\n",
" \n",
" [[156, 187]],\n",
" \n",
" [[156, 186]],\n",
" \n",
" [[155, 185]],\n",
" \n",
" [[155, 184]],\n",
" \n",
" [[153, 182]],\n",
" \n",
" [[153, 181]],\n",
" \n",
" [[149, 177]],\n",
" \n",
" [[148, 177]],\n",
" \n",
" [[146, 175]],\n",
" \n",
" [[145, 175]],\n",
" \n",
" [[144, 174]],\n",
" \n",
" [[143, 174]],\n",
" \n",
" [[142, 173]],\n",
" \n",
" [[140, 173]],\n",
" \n",
" [[139, 172]],\n",
" \n",
" [[138, 172]],\n",
" \n",
" [[137, 171]],\n",
" \n",
" [[135, 171]],\n",
" \n",
" [[134, 170]],\n",
" \n",
" [[135, 169]],\n",
" \n",
" [[134, 168]],\n",
" \n",
" [[135, 167]],\n",
" \n",
" [[135, 165]],\n",
" \n",
" [[137, 163]],\n",
" \n",
" [[137, 161]],\n",
" \n",
" [[140, 158]],\n",
" \n",
" [[140, 157]],\n",
" \n",
" [[142, 155]],\n",
" \n",
" [[141, 154]],\n",
" \n",
" [[141, 153]],\n",
" \n",
" [[144, 150]],\n",
" \n",
" [[144, 149]],\n",
" \n",
" [[145, 148]],\n",
" \n",
" [[145, 147]],\n",
" \n",
" [[144, 146]],\n",
" \n",
" [[144, 145]],\n",
" \n",
" [[145, 144]],\n",
" \n",
" [[146, 145]],\n",
" \n",
" [[147, 144]],\n",
" \n",
" [[146, 143]],\n",
" \n",
" [[147, 142]],\n",
" \n",
" [[148, 142]],\n",
" \n",
" [[147, 141]],\n",
" \n",
" [[150, 138]],\n",
" \n",
" [[149, 139]],\n",
" \n",
" [[148, 138]],\n",
" \n",
" [[148, 136]],\n",
" \n",
" [[147, 135]],\n",
" \n",
" [[148, 134]],\n",
" \n",
" [[148, 133]],\n",
" \n",
" [[148, 134]],\n",
" \n",
" [[147, 135]],\n",
" \n",
" [[146, 134]],\n",
" \n",
" [[146, 132]],\n",
" \n",
" [[149, 129]],\n",
" \n",
" [[149, 128]],\n",
" \n",
" [[147, 130]],\n",
" \n",
" [[146, 129]],\n",
" \n",
" [[146, 127]],\n",
" \n",
" [[147, 126]],\n",
" \n",
" [[147, 125]],\n",
" \n",
" [[146, 125]],\n",
" \n",
" [[145, 124]],\n",
" \n",
" [[145, 123]],\n",
" \n",
" [[144, 123]],\n",
" \n",
" [[143, 122]],\n",
" \n",
" [[144, 121]],\n",
" \n",
" [[146, 121]],\n",
" \n",
" [[147, 120]],\n",
" \n",
" [[148, 120]],\n",
" \n",
" [[148, 115]],\n",
" \n",
" [[147, 116]],\n",
" \n",
" [[147, 118]],\n",
" \n",
" [[143, 122]],\n",
" \n",
" [[142, 121]],\n",
" \n",
" [[142, 120]],\n",
" \n",
" [[141, 119]],\n",
" \n",
" [[142, 120]],\n",
" \n",
" [[141, 121]],\n",
" \n",
" [[139, 121]],\n",
" \n",
" [[138, 120]],\n",
" \n",
" [[138, 117]],\n",
" \n",
" [[143, 112]],\n",
" \n",
" [[143, 111]],\n",
" \n",
" [[144, 110]],\n",
" \n",
" [[146, 110]],\n",
" \n",
" [[147, 109]],\n",
" \n",
" [[148, 109]],\n",
" \n",
" [[149, 108]],\n",
" \n",
" [[151, 108]],\n",
" \n",
" [[151, 103]],\n",
" \n",
" [[150, 102]],\n",
" \n",
" [[150, 98]],\n",
" \n",
" [[149, 97]],\n",
" \n",
" [[149, 93]],\n",
" \n",
" [[148, 92]],\n",
" \n",
" [[149, 91]],\n",
" \n",
" [[148, 91]],\n",
" \n",
" [[147, 90]],\n",
" \n",
" [[147, 89]],\n",
" \n",
" [[146, 88]],\n",
" \n",
" [[149, 85]],\n",
" \n",
" [[150, 85]],\n",
" \n",
" [[151, 84]],\n",
" \n",
" [[152, 84]],\n",
" \n",
" [[153, 83]],\n",
" \n",
" [[155, 83]],\n",
" \n",
" [[157, 81]],\n",
" \n",
" [[158, 81]],\n",
" \n",
" [[159, 80]],\n",
" \n",
" [[160, 80]],\n",
" \n",
" [[161, 79]],\n",
" \n",
" [[162, 79]],\n",
" \n",
" [[163, 78]],\n",
" \n",
" [[165, 78]],\n",
" \n",
" [[166, 77]],\n",
" \n",
" [[167, 77]],\n",
" \n",
" [[168, 76]],\n",
" \n",
" [[169, 76]],\n",
" \n",
" [[170, 75]],\n",
" \n",
" [[171, 75]],\n",
" \n",
" [[172, 74]]], dtype=int32),\n",
" array([[[150, 132]],\n",
" \n",
" [[150, 134]]], dtype=int32),\n",
" array([[[151, 128]],\n",
" \n",
" [[151, 129]]], dtype=int32),\n",
" array([[[149, 125]],\n",
" \n",
" [[149, 126]]], dtype=int32),\n",
" array([[[145, 112]]], dtype=int32),\n",
" array([[[151, 111]]], dtype=int32),\n",
" array([[[152, 91]]], dtype=int32),\n",
" array([[[106, 74]],\n",
" \n",
" [[107, 73]],\n",
" \n",
" [[109, 73]],\n",
" \n",
" [[110, 74]],\n",
" \n",
" [[110, 76]],\n",
" \n",
" [[109, 77]]], dtype=int32),\n",
" array([[[89, 74]],\n",
" \n",
" [[90, 73]],\n",
" \n",
" [[91, 74]],\n",
" \n",
" [[91, 75]],\n",
" \n",
" [[90, 76]],\n",
" \n",
" [[89, 75]]], dtype=int32),\n",
" array([[[84, 74]],\n",
" \n",
" [[85, 73]],\n",
" \n",
" [[86, 74]],\n",
" \n",
" [[85, 75]]], dtype=int32),\n",
" array([[[78, 74]],\n",
" \n",
" [[79, 73]],\n",
" \n",
" [[80, 74]],\n",
" \n",
" [[80, 75]],\n",
" \n",
" [[79, 76]],\n",
" \n",
" [[78, 75]]], dtype=int32),\n",
" array([[[72, 74]],\n",
" \n",
" [[73, 73]],\n",
" \n",
" [[74, 74]],\n",
" \n",
" [[73, 75]]], dtype=int32),\n",
" array([[[207, 73]],\n",
" \n",
" [[208, 72]],\n",
" \n",
" [[209, 73]],\n",
" \n",
" [[208, 74]]], dtype=int32),\n",
" array([[[175, 73]],\n",
" \n",
" [[176, 72]],\n",
" \n",
" [[177, 73]],\n",
" \n",
" [[176, 74]]], dtype=int32),\n",
" array([[[110, 73]],\n",
" \n",
" [[111, 72]],\n",
" \n",
" [[112, 73]],\n",
" \n",
" [[111, 74]]], dtype=int32),\n",
" array([[[69, 73]],\n",
" \n",
" [[70, 72]],\n",
" \n",
" [[71, 73]],\n",
" \n",
" [[70, 74]]], dtype=int32),\n",
" array([[[112, 72]],\n",
" \n",
" [[113, 71]],\n",
" \n",
" [[114, 72]],\n",
" \n",
" [[113, 73]]], dtype=int32),\n",
" array([[[88, 72]],\n",
" \n",
" [[89, 71]],\n",
" \n",
" [[90, 72]],\n",
" \n",
" [[89, 73]]], dtype=int32),\n",
" array([[[86, 72]],\n",
" \n",
" [[87, 71]],\n",
" \n",
" [[88, 72]],\n",
" \n",
" [[88, 73]],\n",
" \n",
" [[87, 74]],\n",
" \n",
" [[86, 73]]], dtype=int32),\n",
" array([[[169, 71]],\n",
" \n",
" [[170, 70]],\n",
" \n",
" [[171, 71]],\n",
" \n",
" [[170, 72]]], dtype=int32),\n",
" array([[[94, 71]],\n",
" \n",
" [[95, 70]],\n",
" \n",
" [[96, 71]],\n",
" \n",
" [[95, 72]]], dtype=int32),\n",
" array([[[84, 71]],\n",
" \n",
" [[85, 70]],\n",
" \n",
" [[86, 70]],\n",
" \n",
" [[87, 71]],\n",
" \n",
" [[86, 72]],\n",
" \n",
" [[85, 72]]], dtype=int32),\n",
" array([[[73, 71]],\n",
" \n",
" [[74, 70]],\n",
" \n",
" [[75, 70]],\n",
" \n",
" [[76, 71]],\n",
" \n",
" [[74, 73]],\n",
" \n",
" [[73, 72]]], dtype=int32),\n",
" array([[[59, 71]],\n",
" \n",
" [[60, 70]],\n",
" \n",
" [[61, 71]],\n",
" \n",
" [[60, 72]]], dtype=int32),\n",
" array([[[174, 70]],\n",
" \n",
" [[175, 69]],\n",
" \n",
" [[176, 70]],\n",
" \n",
" [[175, 71]]], dtype=int32),\n",
" array([[[86, 70]],\n",
" \n",
" [[87, 69]],\n",
" \n",
" [[88, 70]],\n",
" \n",
" [[87, 71]]], dtype=int32),\n",
" array([[[72, 70]],\n",
" \n",
" [[73, 69]],\n",
" \n",
" [[74, 70]],\n",
" \n",
" [[73, 71]]], dtype=int32),\n",
" array([[[91, 69]],\n",
" \n",
" [[92, 68]],\n",
" \n",
" [[93, 69]],\n",
" \n",
" [[92, 70]]], dtype=int32),\n",
" array([[[87, 69]],\n",
" \n",
" [[88, 68]],\n",
" \n",
" [[89, 69]],\n",
" \n",
" [[88, 70]]], dtype=int32),\n",
" array([[[80, 68]],\n",
" \n",
" [[82, 70]],\n",
" \n",
" [[81, 71]],\n",
" \n",
" [[80, 71]],\n",
" \n",
" [[80, 72]],\n",
" \n",
" [[75, 77]],\n",
" \n",
" [[73, 75]],\n",
" \n",
" [[76, 72]],\n",
" \n",
" [[77, 72]],\n",
" \n",
" [[77, 71]]], dtype=int32),\n",
" array([[[74, 69]],\n",
" \n",
" [[75, 68]],\n",
" \n",
" [[76, 68]],\n",
" \n",
" [[77, 69]],\n",
" \n",
" [[76, 70]],\n",
" \n",
" [[75, 70]]], dtype=int32),\n",
" array([[[60, 69]],\n",
" \n",
" [[61, 68]],\n",
" \n",
" [[62, 69]],\n",
" \n",
" [[61, 70]]], dtype=int32),\n",
" array([[[81, 68]],\n",
" \n",
" [[82, 67]],\n",
" \n",
" [[83, 68]],\n",
" \n",
" [[83, 69]],\n",
" \n",
" [[82, 70]],\n",
" \n",
" [[81, 69]]], dtype=int32),\n",
" array([[[57, 68]],\n",
" \n",
" [[58, 67]],\n",
" \n",
" [[59, 68]],\n",
" \n",
" [[58, 69]]], dtype=int32),\n",
" array([[[89, 67]],\n",
" \n",
" [[90, 66]],\n",
" \n",
" [[91, 67]],\n",
" \n",
" [[90, 68]]], dtype=int32),\n",
" array([[[87, 67]],\n",
" \n",
" [[88, 66]],\n",
" \n",
" [[89, 67]],\n",
" \n",
" [[88, 68]]], dtype=int32),\n",
" array([[[59, 67]],\n",
" \n",
" [[60, 66]],\n",
" \n",
" [[61, 67]],\n",
" \n",
" [[60, 68]]], dtype=int32),\n",
" array([[[90, 66]],\n",
" \n",
" [[91, 65]],\n",
" \n",
" [[92, 66]],\n",
" \n",
" [[91, 67]]], dtype=int32),\n",
" array([[[82, 66]],\n",
" \n",
" [[83, 65]],\n",
" \n",
" [[84, 66]],\n",
" \n",
" [[84, 67]],\n",
" \n",
" [[83, 68]],\n",
" \n",
" [[82, 67]]], dtype=int32),\n",
" array([[[58, 66]],\n",
" \n",
" [[59, 65]],\n",
" \n",
" [[60, 66]],\n",
" \n",
" [[59, 67]]], dtype=int32),\n",
" array([[[105, 65]],\n",
" \n",
" [[106, 64]],\n",
" \n",
" [[107, 65]],\n",
" \n",
" [[106, 66]]], dtype=int32),\n",
" array([[[84, 65]],\n",
" \n",
" [[85, 64]],\n",
" \n",
" [[86, 65]],\n",
" \n",
" [[86, 66]],\n",
" \n",
" [[85, 67]],\n",
" \n",
" [[84, 66]]], dtype=int32),\n",
" array([[[80, 65]],\n",
" \n",
" [[81, 64]],\n",
" \n",
" [[82, 65]],\n",
" \n",
" [[81, 66]]], dtype=int32),\n",
" array([[[217, 64]],\n",
" \n",
" [[218, 63]],\n",
" \n",
" [[219, 64]],\n",
" \n",
" [[218, 65]]], dtype=int32),\n",
" array([[[88, 64]],\n",
" \n",
" [[89, 63]],\n",
" \n",
" [[90, 64]],\n",
" \n",
" [[89, 65]]], dtype=int32),\n",
" array([[[82, 64]],\n",
" \n",
" [[83, 63]],\n",
" \n",
" [[84, 64]],\n",
" \n",
" [[83, 65]]], dtype=int32),\n",
" array([[[219, 63]],\n",
" \n",
" [[220, 62]],\n",
" \n",
" [[221, 63]],\n",
" \n",
" [[220, 64]]], dtype=int32),\n",
" array([[[203, 62]],\n",
" \n",
" [[204, 61]],\n",
" \n",
" [[205, 61]],\n",
" \n",
" [[206, 62]],\n",
" \n",
" [[205, 63]],\n",
" \n",
" [[204, 63]]], dtype=int32),\n",
" array([[[88, 62]],\n",
" \n",
" [[89, 61]],\n",
" \n",
" [[90, 62]],\n",
" \n",
" [[89, 63]]], dtype=int32),\n",
" array([[[80, 62]],\n",
" \n",
" [[81, 61]],\n",
" \n",
" [[82, 62]],\n",
" \n",
" [[81, 63]]], dtype=int32),\n",
" array([[[84, 61]],\n",
" \n",
" [[85, 60]],\n",
" \n",
" [[86, 61]],\n",
" \n",
" [[85, 62]]], dtype=int32),\n",
" array([[[150, 60]],\n",
" \n",
" [[151, 59]],\n",
" \n",
" [[152, 60]],\n",
" \n",
" [[151, 61]]], dtype=int32),\n",
" array([[[87, 60]],\n",
" \n",
" [[88, 59]],\n",
" \n",
" [[89, 60]],\n",
" \n",
" [[88, 61]]], dtype=int32),\n",
" array([[[156, 59]],\n",
" \n",
" [[157, 58]],\n",
" \n",
" [[158, 59]],\n",
" \n",
" [[157, 60]]], dtype=int32),\n",
" array([[[153, 58]],\n",
" \n",
" [[154, 57]],\n",
" \n",
" [[155, 58]],\n",
" \n",
" [[154, 59]]], dtype=int32),\n",
" array([[[89, 58]],\n",
" \n",
" [[90, 57]],\n",
" \n",
" [[91, 58]],\n",
" \n",
" [[90, 59]]], dtype=int32),\n",
" array([[[148, 57]],\n",
" \n",
" [[149, 56]],\n",
" \n",
" [[150, 57]],\n",
" \n",
" [[149, 58]]], dtype=int32),\n",
" array([[[77, 56]],\n",
" \n",
" [[78, 55]],\n",
" \n",
" [[79, 56]],\n",
" \n",
" [[78, 57]]], dtype=int32),\n",
" array([[[79, 52]],\n",
" \n",
" [[80, 51]],\n",
" \n",
" [[82, 51]],\n",
" \n",
" [[83, 52]],\n",
" \n",
" [[83, 53]],\n",
" \n",
" [[84, 54]],\n",
" \n",
" [[83, 55]],\n",
" \n",
" [[82, 55]],\n",
" \n",
" [[82, 57]],\n",
" \n",
" [[82, 56]],\n",
" \n",
" [[84, 54]],\n",
" \n",
" [[86, 56]],\n",
" \n",
" [[81, 61]],\n",
" \n",
" [[79, 61]],\n",
" \n",
" [[78, 60]],\n",
" \n",
" [[78, 58]],\n",
" \n",
" [[79, 57]],\n",
" \n",
" [[80, 57]],\n",
" \n",
" [[79, 56]],\n",
" \n",
" [[80, 55]],\n",
" \n",
" [[79, 55]],\n",
" \n",
" [[77, 53]],\n",
" \n",
" [[78, 52]]], dtype=int32),\n",
" array([[[76, 52]],\n",
" \n",
" [[77, 51]],\n",
" \n",
" [[78, 52]],\n",
" \n",
" [[77, 53]]], dtype=int32),\n",
" array([[[82, 50]],\n",
" \n",
" [[83, 49]],\n",
" \n",
" [[84, 50]],\n",
" \n",
" [[84, 51]],\n",
" \n",
" [[83, 52]],\n",
" \n",
" [[82, 51]]], dtype=int32),\n",
" array([[[77, 50]],\n",
" \n",
" [[78, 49]],\n",
" \n",
" [[79, 50]],\n",
" \n",
" [[78, 51]]], dtype=int32),\n",
" array([[[75, 50]],\n",
" \n",
" [[76, 49]],\n",
" \n",
" [[77, 50]],\n",
" \n",
" [[76, 51]]], dtype=int32),\n",
" array([[[212, 49]],\n",
" \n",
" [[213, 48]],\n",
" \n",
" [[214, 48]],\n",
" \n",
" [[215, 49]],\n",
" \n",
" [[214, 50]],\n",
" \n",
" [[213, 50]]], dtype=int32),\n",
" array([[[83, 49]],\n",
" \n",
" [[84, 48]],\n",
" \n",
" [[85, 48]],\n",
" \n",
" [[86, 49]],\n",
" \n",
" [[85, 50]],\n",
" \n",
" [[84, 50]]], dtype=int32),\n",
" array([[[80, 49]],\n",
" \n",
" [[81, 48]],\n",
" \n",
" [[82, 49]],\n",
" \n",
" [[81, 50]]], dtype=int32),\n",
" array([[[74, 49]],\n",
" \n",
" [[75, 48]],\n",
" \n",
" [[76, 49]],\n",
" \n",
" [[75, 50]]], dtype=int32),\n",
" array([[[178, 48]],\n",
" \n",
" [[179, 47]],\n",
" \n",
" [[180, 48]],\n",
" \n",
" [[179, 49]]], dtype=int32),\n",
" array([[[91, 48]],\n",
" \n",
" [[92, 47]],\n",
" \n",
" [[93, 48]],\n",
" \n",
" [[94, 47]],\n",
" \n",
" [[95, 47]],\n",
" \n",
" [[96, 48]],\n",
" \n",
" [[93, 51]],\n",
" \n",
" [[92, 51]],\n",
" \n",
" [[89, 54]],\n",
" \n",
" [[88, 54]],\n",
" \n",
" [[88, 55]],\n",
" \n",
" [[87, 56]],\n",
" \n",
" [[86, 56]],\n",
" \n",
" [[83, 53]],\n",
" \n",
" [[83, 52]],\n",
" \n",
" [[85, 50]],\n",
" \n",
" [[87, 50]],\n",
" \n",
" [[88, 51]],\n",
" \n",
" [[87, 50]],\n",
" \n",
" [[88, 49]],\n",
" \n",
" [[91, 49]]], dtype=int32),\n",
" array([[[86, 52]],\n",
" \n",
" [[86, 53]]], dtype=int32),\n",
" array([[[89, 48]],\n",
" \n",
" [[90, 47]],\n",
" \n",
" [[91, 48]],\n",
" \n",
" [[90, 49]]], dtype=int32),\n",
" array([[[86, 48]],\n",
" \n",
" [[87, 47]],\n",
" \n",
" [[88, 48]],\n",
" \n",
" [[87, 49]]], dtype=int32),\n",
" array([[[176, 47]],\n",
" \n",
" [[177, 46]],\n",
" \n",
" [[178, 47]],\n",
" \n",
" [[177, 48]]], dtype=int32),\n",
" array([[[95, 47]],\n",
" \n",
" [[96, 46]],\n",
" \n",
" [[97, 47]],\n",
" \n",
" [[96, 48]]], dtype=int32),\n",
" array([[[88, 47]],\n",
" \n",
" [[89, 46]],\n",
" \n",
" [[90, 47]],\n",
" \n",
" [[89, 48]]], dtype=int32),\n",
" array([[[85, 47]],\n",
" \n",
" [[86, 46]],\n",
" \n",
" [[87, 47]],\n",
" \n",
" [[86, 48]]], dtype=int32),\n",
" array([[[178, 46]],\n",
" \n",
" [[179, 45]],\n",
" \n",
" [[180, 46]],\n",
" \n",
" [[179, 47]]], dtype=int32),\n",
" array([[[147, 46]],\n",
" \n",
" [[148, 45]],\n",
" \n",
" [[149, 46]],\n",
" \n",
" [[148, 47]]], dtype=int32),\n",
" array([[[90, 46]],\n",
" \n",
" [[91, 45]],\n",
" \n",
" [[92, 46]],\n",
" \n",
" [[92, 47]],\n",
" \n",
" [[91, 48]],\n",
" \n",
" [[90, 47]]], dtype=int32),\n",
" array([[[176, 45]],\n",
" \n",
" [[177, 44]],\n",
" \n",
" [[178, 45]],\n",
" \n",
" [[177, 46]]], dtype=int32),\n",
" array([[[157, 45]],\n",
" \n",
" [[158, 44]],\n",
" \n",
" [[159, 45]],\n",
" \n",
" [[158, 46]]], dtype=int32),\n",
" array([[[153, 45]],\n",
" \n",
" [[154, 44]],\n",
" \n",
" [[155, 45]],\n",
" \n",
" [[154, 46]]], dtype=int32),\n",
" array([[[151, 45]],\n",
" \n",
" [[152, 44]],\n",
" \n",
" [[153, 45]],\n",
" \n",
" [[152, 46]]], dtype=int32),\n",
" array([[[96, 45]],\n",
" \n",
" [[97, 44]],\n",
" \n",
" [[98, 44]],\n",
" \n",
" [[99, 45]],\n",
" \n",
" [[99, 46]],\n",
" \n",
" [[98, 47]],\n",
" \n",
" [[97, 47]],\n",
" \n",
" [[96, 46]]], dtype=int32),\n",
" array([[[86, 45]],\n",
" \n",
" [[87, 44]],\n",
" \n",
" [[89, 44]],\n",
" \n",
" [[90, 45]],\n",
" \n",
" [[89, 46]],\n",
" \n",
" [[87, 46]]], dtype=int32),\n",
" array([[[83, 45]],\n",
" \n",
" [[84, 44]],\n",
" \n",
" [[85, 45]],\n",
" \n",
" [[84, 46]]], dtype=int32),\n",
" array([[[170, 44]],\n",
" \n",
" [[171, 43]],\n",
" \n",
" [[172, 44]],\n",
" \n",
" [[171, 45]]], dtype=int32),\n",
" array([[[92, 44]],\n",
" \n",
" [[93, 43]],\n",
" \n",
" [[94, 44]],\n",
" \n",
" [[95, 44]],\n",
" \n",
" [[96, 45]],\n",
" \n",
" [[96, 46]],\n",
" \n",
" [[95, 47]],\n",
" \n",
" [[94, 46]],\n",
" \n",
" [[94, 47]],\n",
" \n",
" [[93, 48]],\n",
" \n",
" [[92, 47]]], dtype=int32),\n",
" array([[[179, 43]],\n",
" \n",
" [[180, 42]],\n",
" \n",
" [[181, 42]],\n",
" \n",
" [[182, 43]],\n",
" \n",
" [[181, 44]],\n",
" \n",
" [[180, 44]]], dtype=int32),\n",
" array([[[176, 43]],\n",
" \n",
" [[177, 42]],\n",
" \n",
" [[178, 43]],\n",
" \n",
" [[177, 44]]], dtype=int32),\n",
" array([[[155, 43]],\n",
" \n",
" [[156, 42]],\n",
" \n",
" [[157, 43]],\n",
" \n",
" [[156, 44]]], dtype=int32),\n",
" array([[[93, 43]],\n",
" \n",
" [[94, 42]],\n",
" \n",
" [[95, 43]],\n",
" \n",
" [[94, 44]]], dtype=int32),\n",
" array([[[80, 43]],\n",
" \n",
" [[81, 42]],\n",
" \n",
" [[83, 44]],\n",
" \n",
" [[81, 46]],\n",
" \n",
" [[80, 45]]], dtype=int32),\n",
" array([[[171, 42]],\n",
" \n",
" [[172, 41]],\n",
" \n",
" [[173, 42]],\n",
" \n",
" [[172, 43]]], dtype=int32),\n",
" array([[[148, 42]],\n",
" \n",
" [[149, 41]],\n",
" \n",
" [[150, 42]],\n",
" \n",
" [[149, 43]]], dtype=int32),\n",
" array([[[222, 40]],\n",
" \n",
" [[223, 39]],\n",
" \n",
" [[224, 40]],\n",
" \n",
" [[223, 41]]], dtype=int32),\n",
" array([[[90, 40]],\n",
" \n",
" [[91, 39]],\n",
" \n",
" [[92, 40]],\n",
" \n",
" [[91, 41]]], dtype=int32),\n",
" array([[[221, 39]],\n",
" \n",
" [[222, 38]],\n",
" \n",
" [[223, 39]],\n",
" \n",
" [[222, 40]]], dtype=int32),\n",
" array([[[148, 39]],\n",
" \n",
" [[149, 38]],\n",
" \n",
" [[150, 39]],\n",
" \n",
" [[149, 40]]], dtype=int32),\n",
" array([[[92, 39]],\n",
" \n",
" [[93, 38]],\n",
" \n",
" [[94, 39]],\n",
" \n",
" [[93, 40]]], dtype=int32),\n",
" array([[[87, 39]],\n",
" \n",
" [[88, 38]],\n",
" \n",
" [[89, 39]],\n",
" \n",
" [[88, 40]]], dtype=int32),\n",
" array([[[83, 38]],\n",
" \n",
" [[84, 37]],\n",
" \n",
" [[87, 40]],\n",
" \n",
" [[87, 41]],\n",
" \n",
" [[88, 41]],\n",
" \n",
" [[89, 42]],\n",
" \n",
" [[89, 43]],\n",
" \n",
" [[88, 44]],\n",
" \n",
" [[87, 43]],\n",
" \n",
" [[86, 44]],\n",
" \n",
" [[84, 42]],\n",
" \n",
" [[85, 41]],\n",
" \n",
" [[83, 39]]], dtype=int32),\n",
" array([[[177, 37]],\n",
" \n",
" [[178, 36]],\n",
" \n",
" [[179, 37]],\n",
" \n",
" [[178, 38]]], dtype=int32),\n",
" array([[[174, 37]],\n",
" \n",
" [[175, 36]],\n",
" \n",
" [[176, 36]],\n",
" \n",
" [[177, 37]],\n",
" \n",
" [[175, 39]],\n",
" \n",
" [[174, 38]]], dtype=int32),\n",
" array([[[93, 37]],\n",
" \n",
" [[94, 36]],\n",
" \n",
" [[95, 37]],\n",
" \n",
" [[95, 38]],\n",
" \n",
" [[94, 39]],\n",
" \n",
" [[93, 38]]], dtype=int32),\n",
" array([[[86, 37]],\n",
" \n",
" [[87, 36]],\n",
" \n",
" [[88, 37]],\n",
" \n",
" [[87, 38]]], dtype=int32),\n",
" array([[[84, 37]],\n",
" \n",
" [[85, 36]],\n",
" \n",
" [[86, 37]],\n",
" \n",
" [[85, 38]]], dtype=int32),\n",
" array([[[178, 36]],\n",
" \n",
" [[179, 35]],\n",
" \n",
" [[180, 36]],\n",
" \n",
" [[179, 37]]], dtype=int32),\n",
" array([[[171, 36]],\n",
" \n",
" [[172, 35]],\n",
" \n",
" [[173, 36]],\n",
" \n",
" [[172, 37]]], dtype=int32),\n",
" array([[[149, 36]],\n",
" \n",
" [[150, 35]],\n",
" \n",
" [[151, 36]],\n",
" \n",
" [[150, 37]]], dtype=int32),\n",
" array([[[147, 36]],\n",
" \n",
" [[148, 35]],\n",
" \n",
" [[149, 36]],\n",
" \n",
" [[148, 37]]], dtype=int32),\n",
" array([[[85, 36]],\n",
" \n",
" [[86, 35]],\n",
" \n",
" [[87, 36]],\n",
" \n",
" [[86, 37]]], dtype=int32),\n",
" array([[[83, 35]],\n",
" \n",
" [[84, 36]],\n",
" \n",
" [[84, 37]],\n",
" \n",
" [[83, 38]],\n",
" \n",
" [[82, 38]],\n",
" \n",
" [[81, 37]]], dtype=int32),\n",
" array([[[222, 35]],\n",
" \n",
" [[223, 34]],\n",
" \n",
" [[224, 35]],\n",
" \n",
" [[223, 36]]], dtype=int32),\n",
" array([[[185, 35]],\n",
" \n",
" [[186, 34]],\n",
" \n",
" [[187, 35]],\n",
" \n",
" [[186, 36]]], dtype=int32),\n",
" array([[[182, 35]],\n",
" \n",
" [[183, 34]],\n",
" \n",
" [[184, 35]],\n",
" \n",
" [[184, 37]],\n",
" \n",
" [[183, 38]],\n",
" \n",
" [[182, 37]]], dtype=int32),\n",
" array([[[175, 35]],\n",
" \n",
" [[176, 34]],\n",
" \n",
" [[177, 35]],\n",
" \n",
" [[176, 36]]], dtype=int32),\n",
" array([[[166, 35]],\n",
" \n",
" [[167, 34]],\n",
" \n",
" [[168, 35]],\n",
" \n",
" [[167, 36]]], dtype=int32),\n",
" array([[[146, 35]],\n",
" \n",
" [[147, 34]],\n",
" \n",
" [[148, 35]],\n",
" \n",
" [[147, 36]]], dtype=int32),\n",
" array([[[90, 35]],\n",
" \n",
" [[91, 34]],\n",
" \n",
" [[92, 35]],\n",
" \n",
" [[91, 36]]], dtype=int32),\n",
" array([[[84, 35]],\n",
" \n",
" [[85, 34]],\n",
" \n",
" [[86, 35]],\n",
" \n",
" [[85, 36]]], dtype=int32),\n",
" array([[[176, 34]],\n",
" \n",
" [[177, 33]],\n",
" \n",
" [[178, 34]],\n",
" \n",
" [[177, 35]]], dtype=int32),\n",
" array([[[173, 34]],\n",
" \n",
" [[174, 33]],\n",
" \n",
" [[175, 34]],\n",
" \n",
" [[174, 35]]], dtype=int32),\n",
" array([[[92, 34]],\n",
" \n",
" [[93, 33]],\n",
" \n",
" [[94, 34]],\n",
" \n",
" [[93, 35]]], dtype=int32),\n",
" array([[[89, 34]],\n",
" \n",
" [[90, 33]],\n",
" \n",
" [[91, 34]],\n",
" \n",
" [[90, 35]]], dtype=int32),\n",
" array([[[85, 34]],\n",
" \n",
" [[86, 33]],\n",
" \n",
" [[87, 33]],\n",
" \n",
" [[88, 34]],\n",
" \n",
" [[88, 35]],\n",
" \n",
" [[87, 36]]], dtype=int32),\n",
" array([[[183, 33]],\n",
" \n",
" [[184, 32]],\n",
" \n",
" [[185, 33]],\n",
" \n",
" [[184, 34]]], dtype=int32),\n",
" array([[[93, 33]],\n",
" \n",
" [[94, 32]],\n",
" \n",
" [[95, 33]],\n",
" \n",
" [[94, 34]]], dtype=int32),\n",
" array([[[88, 33]],\n",
" \n",
" [[89, 32]],\n",
" \n",
" [[90, 33]],\n",
" \n",
" [[89, 34]]], dtype=int32),\n",
" array([[[190, 32]],\n",
" \n",
" [[191, 31]],\n",
" \n",
" [[192, 32]],\n",
" \n",
" [[191, 33]]], dtype=int32),\n",
" array([[[181, 31]],\n",
" \n",
" [[182, 32]],\n",
" \n",
" [[182, 33]],\n",
" \n",
" [[181, 34]],\n",
" \n",
" [[180, 34]],\n",
" \n",
" [[179, 33]]], dtype=int32),\n",
" array([[[183, 31]],\n",
" \n",
" [[184, 30]],\n",
" \n",
" [[185, 31]],\n",
" \n",
" [[184, 32]]], dtype=int32),\n",
" array([[[167, 31]],\n",
" \n",
" [[168, 30]],\n",
" \n",
" [[169, 31]],\n",
" \n",
" [[168, 32]]], dtype=int32),\n",
" array([[[163, 31]],\n",
" \n",
" [[164, 30]],\n",
" \n",
" [[165, 31]],\n",
" \n",
" [[164, 32]]], dtype=int32),\n",
" array([[[160, 31]],\n",
" \n",
" [[161, 30]],\n",
" \n",
" [[163, 32]],\n",
" \n",
" [[163, 34]],\n",
" \n",
" [[164, 34]],\n",
" \n",
" [[165, 35]],\n",
" \n",
" [[165, 36]],\n",
" \n",
" [[166, 36]],\n",
" \n",
" [[167, 37]],\n",
" \n",
" [[167, 39]],\n",
" \n",
" [[168, 39]],\n",
" \n",
" [[169, 40]],\n",
" \n",
" [[168, 41]],\n",
" \n",
" [[169, 40]],\n",
" \n",
" [[170, 40]],\n",
" \n",
" [[171, 41]],\n",
" \n",
" [[169, 43]],\n",
" \n",
" [[169, 44]],\n",
" \n",
" [[170, 44]],\n",
" \n",
" [[171, 45]],\n",
" \n",
" [[171, 46]],\n",
" \n",
" [[172, 47]],\n",
" \n",
" [[173, 46]],\n",
" \n",
" [[174, 47]],\n",
" \n",
" [[174, 48]],\n",
" \n",
" [[170, 52]],\n",
" \n",
" [[169, 52]],\n",
" \n",
" [[165, 56]],\n",
" \n",
" [[164, 56]],\n",
" \n",
" [[162, 58]],\n",
" \n",
" [[161, 58]],\n",
" \n",
" [[160, 59]],\n",
" \n",
" [[158, 59]],\n",
" \n",
" [[157, 58]],\n",
" \n",
" [[157, 57]],\n",
" \n",
" [[158, 56]],\n",
" \n",
" [[158, 49]],\n",
" \n",
" [[159, 48]],\n",
" \n",
" [[160, 49]],\n",
" \n",
" [[159, 48]],\n",
" \n",
" [[159, 44]],\n",
" \n",
" [[158, 43]],\n",
" \n",
" [[159, 42]],\n",
" \n",
" [[160, 42]],\n",
" \n",
" [[160, 41]],\n",
" \n",
" [[159, 42]],\n",
" \n",
" [[158, 41]],\n",
" \n",
" [[158, 40]],\n",
" \n",
" [[159, 39]],\n",
" \n",
" [[160, 39]],\n",
" \n",
" [[159, 39]],\n",
" \n",
" [[158, 38]],\n",
" \n",
" [[159, 37]],\n",
" \n",
" [[159, 36]],\n",
" \n",
" [[158, 35]],\n",
" \n",
" [[158, 33]],\n",
" \n",
" [[159, 32]],\n",
" \n",
" [[160, 33]]], dtype=int32),\n",
" array([[[160, 52]],\n",
" \n",
" [[160, 53]]], dtype=int32),\n",
" array([[[89, 31]],\n",
" \n",
" [[90, 30]],\n",
" \n",
" [[92, 32]],\n",
" \n",
" [[92, 33]],\n",
" \n",
" [[91, 34]],\n",
" \n",
" [[89, 32]]], dtype=int32),\n",
" array([[[85, 31]],\n",
" \n",
" [[86, 30]],\n",
" \n",
" [[88, 30]],\n",
" \n",
" [[89, 31]],\n",
" \n",
" [[89, 32]],\n",
" \n",
" [[88, 33]],\n",
" \n",
" [[86, 33]],\n",
" \n",
" [[85, 32]]], dtype=int32),\n",
" array([[[63, 31]],\n",
" \n",
" [[64, 30]],\n",
" \n",
" [[65, 30]],\n",
" \n",
" [[66, 31]],\n",
" \n",
" [[65, 32]],\n",
" \n",
" [[64, 32]]], dtype=int32),\n",
" array([[[180, 30]],\n",
" \n",
" [[181, 29]],\n",
" \n",
" [[182, 30]],\n",
" \n",
" [[181, 31]]], dtype=int32),\n",
" array([[[175, 30]],\n",
" \n",
" [[176, 29]],\n",
" \n",
" [[177, 30]],\n",
" \n",
" [[176, 31]]], dtype=int32),\n",
" array([[[154, 30]],\n",
" \n",
" [[155, 29]],\n",
" \n",
" [[156, 30]],\n",
" \n",
" [[156, 31]],\n",
" \n",
" [[155, 32]],\n",
" \n",
" [[154, 31]]], dtype=int32),\n",
" array([[[90, 30]],\n",
" \n",
" [[91, 29]],\n",
" \n",
" [[92, 30]],\n",
" \n",
" [[91, 31]]], dtype=int32),\n",
" array([[[147, 29]],\n",
" \n",
" [[148, 28]],\n",
" \n",
" [[149, 29]],\n",
" \n",
" [[148, 30]]], dtype=int32),\n",
" array([[[92, 29]],\n",
" \n",
" [[93, 28]],\n",
" \n",
" [[94, 29]],\n",
" \n",
" [[94, 30]],\n",
" \n",
" [[93, 31]],\n",
" \n",
" [[92, 30]]], dtype=int32),\n",
" array([[[78, 29]],\n",
" \n",
" [[79, 28]],\n",
" \n",
" [[80, 28]],\n",
" \n",
" [[81, 29]],\n",
" \n",
" [[81, 30]],\n",
" \n",
" [[82, 31]],\n",
" \n",
" [[81, 32]],\n",
" \n",
" [[80, 32]],\n",
" \n",
" [[78, 30]]], dtype=int32),\n",
" array([[[62, 29]],\n",
" \n",
" [[63, 28]],\n",
" \n",
" [[64, 29]],\n",
" \n",
" [[64, 30]],\n",
" \n",
" [[63, 31]],\n",
" \n",
" [[62, 30]]], dtype=int32),\n",
" array([[[180, 28]],\n",
" \n",
" [[181, 27]],\n",
" \n",
" [[182, 28]],\n",
" \n",
" [[181, 29]]], dtype=int32),\n",
" array([[[169, 28]],\n",
" \n",
" [[170, 27]],\n",
" \n",
" [[172, 27]],\n",
" \n",
" [[173, 28]],\n",
" \n",
" [[172, 29]],\n",
" \n",
" [[170, 29]]], dtype=int32),\n",
" array([[[165, 28]],\n",
" \n",
" [[166, 27]],\n",
" \n",
" [[167, 28]],\n",
" \n",
" [[166, 29]]], dtype=int32),\n",
" array([[[150, 28]],\n",
" \n",
" [[151, 27]],\n",
" \n",
" [[152, 28]],\n",
" \n",
" [[151, 29]]], dtype=int32),\n",
" array([[[146, 28]],\n",
" \n",
" [[147, 27]],\n",
" \n",
" [[148, 28]],\n",
" \n",
" [[147, 29]]], dtype=int32),\n",
" array([[[88, 27]],\n",
" \n",
" [[89, 26]],\n",
" \n",
" [[90, 27]],\n",
" \n",
" [[89, 28]]], dtype=int32),\n",
" array([[[85, 27]],\n",
" \n",
" [[86, 26]],\n",
" \n",
" [[87, 27]],\n",
" \n",
" [[87, 28]],\n",
" \n",
" [[88, 28]],\n",
" \n",
" [[89, 29]],\n",
" \n",
" [[88, 30]],\n",
" \n",
" [[85, 30]],\n",
" \n",
" [[84, 31]],\n",
" \n",
" [[83, 30]],\n",
" \n",
" [[83, 29]],\n",
" \n",
" [[84, 28]],\n",
" \n",
" [[85, 28]]], dtype=int32),\n",
" array([[[186, 26]],\n",
" \n",
" [[187, 25]],\n",
" \n",
" [[188, 26]],\n",
" \n",
" [[187, 27]]], dtype=int32),\n",
" array([[[171, 26]],\n",
" \n",
" [[172, 25]],\n",
" \n",
" [[173, 26]],\n",
" \n",
" [[172, 27]]], dtype=int32),\n",
" array([[[165, 26]],\n",
" \n",
" [[166, 25]],\n",
" \n",
" [[167, 26]],\n",
" \n",
" [[166, 27]]], dtype=int32),\n",
" array([[[62, 26]],\n",
" \n",
" [[63, 25]],\n",
" \n",
" [[64, 26]],\n",
" \n",
" [[63, 27]]], dtype=int32),\n",
" array([[[182, 25]],\n",
" \n",
" [[183, 24]],\n",
" \n",
" [[184, 25]],\n",
" \n",
" [[183, 26]]], dtype=int32),\n",
" array([[[175, 25]],\n",
" \n",
" [[176, 24]],\n",
" \n",
" [[177, 25]],\n",
" \n",
" [[176, 26]]], dtype=int32),\n",
" array([[[166, 25]],\n",
" \n",
" [[167, 24]],\n",
" \n",
" [[168, 25]],\n",
" \n",
" [[167, 26]]], dtype=int32),\n",
" array([[[163, 25]],\n",
" \n",
" [[164, 24]],\n",
" \n",
" [[165, 25]],\n",
" \n",
" [[164, 26]]], dtype=int32),\n",
" array([[[75, 25]],\n",
" \n",
" [[76, 24]],\n",
" \n",
" [[77, 25]],\n",
" \n",
" [[77, 26]],\n",
" \n",
" [[76, 27]],\n",
" \n",
" [[75, 26]]], dtype=int32),\n",
" array([[[185, 24]],\n",
" \n",
" [[186, 23]],\n",
" \n",
" [[187, 24]],\n",
" \n",
" [[186, 25]]], dtype=int32),\n",
" array([[[178, 24]],\n",
" \n",
" [[179, 23]],\n",
" \n",
" [[180, 24]],\n",
" \n",
" [[180, 26]],\n",
" \n",
" [[179, 27]],\n",
" \n",
" [[178, 26]]], dtype=int32),\n",
" array([[[165, 24]],\n",
" \n",
" [[166, 23]],\n",
" \n",
" [[167, 24]],\n",
" \n",
" [[166, 25]]], dtype=int32),\n",
" array([[[157, 24]],\n",
" \n",
" [[158, 23]],\n",
" \n",
" [[159, 24]],\n",
" \n",
" [[158, 25]]], dtype=int32),\n",
" array([[[155, 24]],\n",
" \n",
" [[156, 23]],\n",
" \n",
" [[157, 24]],\n",
" \n",
" [[156, 25]]], dtype=int32),\n",
" array([[[74, 24]],\n",
" \n",
" [[75, 23]],\n",
" \n",
" [[76, 24]],\n",
" \n",
" [[75, 25]]], dtype=int32),\n",
" array([[[73, 23]],\n",
" \n",
" [[74, 24]],\n",
" \n",
" [[74, 25]],\n",
" \n",
" [[73, 26]],\n",
" \n",
" [[72, 26]],\n",
" \n",
" [[71, 25]]], dtype=int32),\n",
" array([[[66, 24]],\n",
" \n",
" [[67, 23]],\n",
" \n",
" [[68, 24]],\n",
" \n",
" [[68, 25]],\n",
" \n",
" [[68, 24]],\n",
" \n",
" [[69, 23]],\n",
" \n",
" [[71, 25]],\n",
" \n",
" [[71, 26]],\n",
" \n",
" [[69, 28]],\n",
" \n",
" [[68, 28]],\n",
" \n",
" [[68, 30]],\n",
" \n",
" [[67, 31]],\n",
" \n",
" [[66, 31]],\n",
" \n",
" [[65, 30]],\n",
" \n",
" [[65, 29]],\n",
" \n",
" [[63, 27]],\n",
" \n",
" [[64, 26]],\n",
" \n",
" [[65, 26]],\n",
" \n",
" [[66, 27]],\n",
" \n",
" [[65, 26]],\n",
" \n",
" [[64, 26]],\n",
" \n",
" [[63, 25]],\n",
" \n",
" [[64, 24]]], dtype=int32),\n",
" array([[[176, 23]],\n",
" \n",
" [[177, 22]],\n",
" \n",
" [[178, 23]],\n",
" \n",
" [[178, 24]],\n",
" \n",
" [[177, 25]],\n",
" \n",
" [[176, 24]]], dtype=int32),\n",
" array([[[153, 23]],\n",
" \n",
" [[154, 22]],\n",
" \n",
" [[155, 23]],\n",
" \n",
" [[154, 24]]], dtype=int32),\n",
" array([[[83, 23]],\n",
" \n",
" [[84, 22]],\n",
" \n",
" [[85, 23]],\n",
" \n",
" [[84, 24]]], dtype=int32),\n",
" array([[[178, 22]],\n",
" \n",
" [[179, 21]],\n",
" \n",
" [[180, 22]],\n",
" \n",
" [[179, 23]]], dtype=int32),\n",
" array([[[175, 22]],\n",
" \n",
" [[176, 21]],\n",
" \n",
" [[177, 22]],\n",
" \n",
" [[176, 23]]], dtype=int32),\n",
" array([[[150, 22]],\n",
" \n",
" [[151, 21]],\n",
" \n",
" [[152, 22]],\n",
" \n",
" [[151, 23]]], dtype=int32),\n",
" array([[[128, 22]],\n",
" \n",
" [[129, 21]],\n",
" \n",
" [[130, 22]],\n",
" \n",
" [[131, 22]],\n",
" \n",
" [[132, 23]],\n",
" \n",
" [[132, 24]],\n",
" \n",
" [[130, 26]],\n",
" \n",
" [[128, 24]]], dtype=int32),\n",
" array([[[82, 22]],\n",
" \n",
" [[83, 21]],\n",
" \n",
" [[84, 22]],\n",
" \n",
" [[83, 23]]], dtype=int32),\n",
" array([[[78, 21]],\n",
" \n",
" [[79, 22]],\n",
" \n",
" [[80, 21]],\n",
" \n",
" [[82, 23]],\n",
" \n",
" [[82, 25]],\n",
" \n",
" [[83, 26]],\n",
" \n",
" [[84, 26]],\n",
" \n",
" [[85, 27]],\n",
" \n",
" [[84, 28]],\n",
" \n",
" [[82, 28]],\n",
" \n",
" [[81, 29]],\n",
" \n",
" [[80, 28]],\n",
" \n",
" [[80, 24]],\n",
" \n",
" [[79, 25]],\n",
" \n",
" [[78, 24]],\n",
" \n",
" [[77, 24]],\n",
" \n",
" [[76, 23]]], dtype=int32),\n",
" array([[[75, 22]],\n",
" \n",
" [[76, 21]],\n",
" \n",
" [[77, 22]],\n",
" \n",
" [[76, 23]]], dtype=int32),\n",
" array([[[73, 22]],\n",
" \n",
" [[74, 21]],\n",
" \n",
" [[75, 22]],\n",
" \n",
" [[74, 23]]], dtype=int32),\n",
" array([[[71, 22]],\n",
" \n",
" [[72, 21]],\n",
" \n",
" [[73, 22]],\n",
" \n",
" [[73, 23]],\n",
" \n",
" [[72, 24]],\n",
" \n",
" [[71, 23]]], dtype=int32),\n",
" array([[[130, 21]],\n",
" \n",
" [[131, 20]],\n",
" \n",
" [[132, 20]],\n",
" \n",
" [[133, 21]],\n",
" \n",
" [[133, 22]],\n",
" \n",
" [[132, 23]]], dtype=int32),\n",
" array([[[86, 21]],\n",
" \n",
" [[87, 20]],\n",
" \n",
" [[88, 21]],\n",
" \n",
" [[87, 22]]], dtype=int32),\n",
" array([[[83, 21]],\n",
" \n",
" [[84, 20]],\n",
" \n",
" [[85, 21]],\n",
" \n",
" [[84, 22]]], dtype=int32),\n",
" array([[[80, 21]],\n",
" \n",
" [[81, 20]],\n",
" \n",
" [[82, 21]],\n",
" \n",
" [[81, 22]]], dtype=int32),\n",
" array([[[74, 21]],\n",
" \n",
" [[75, 20]],\n",
" \n",
" [[76, 21]],\n",
" \n",
" [[75, 22]]], dtype=int32),\n",
" array([[[72, 21]],\n",
" \n",
" [[73, 20]],\n",
" \n",
" [[74, 21]],\n",
" \n",
" [[73, 22]]], dtype=int32),\n",
" array([[[164, 20]],\n",
" \n",
" [[165, 19]],\n",
" \n",
" [[166, 20]],\n",
" \n",
" [[165, 21]]], dtype=int32),\n",
" array([[[132, 20]],\n",
" \n",
" [[133, 19]],\n",
" \n",
" [[134, 20]],\n",
" \n",
" [[133, 21]]], dtype=int32),\n",
" array([[[129, 20]],\n",
" \n",
" [[130, 19]],\n",
" \n",
" [[131, 20]],\n",
" \n",
" [[130, 21]]], dtype=int32),\n",
" array([[[127, 20]],\n",
" \n",
" [[128, 19]],\n",
" \n",
" [[129, 20]],\n",
" \n",
" [[128, 21]]], dtype=int32),\n",
" array([[[69, 20]],\n",
" \n",
" [[70, 19]],\n",
" \n",
" [[71, 20]],\n",
" \n",
" [[71, 22]],\n",
" \n",
" [[70, 23]],\n",
" \n",
" [[69, 22]]], dtype=int32),\n",
" array([[[130, 19]],\n",
" \n",
" [[131, 18]],\n",
" \n",
" [[132, 18]],\n",
" \n",
" [[133, 19]],\n",
" \n",
" [[132, 20]],\n",
" \n",
" [[131, 20]]], dtype=int32),\n",
" array([[[113, 17]],\n",
" \n",
" [[114, 18]],\n",
" \n",
" [[114, 19]],\n",
" \n",
" [[113, 20]],\n",
" \n",
" [[113, 21]],\n",
" \n",
" [[112, 22]],\n",
" \n",
" [[110, 22]],\n",
" \n",
" [[108, 20]],\n",
" \n",
" [[109, 19]],\n",
" \n",
" [[111, 19]]], dtype=int32),\n",
" array([[[92, 18]],\n",
" \n",
" [[93, 17]],\n",
" \n",
" [[95, 17]],\n",
" \n",
" [[96, 18]],\n",
" \n",
" [[97, 18]],\n",
" \n",
" [[98, 19]],\n",
" \n",
" [[97, 20]],\n",
" \n",
" [[96, 20]],\n",
" \n",
" [[95, 21]],\n",
" \n",
" [[94, 20]],\n",
" \n",
" [[94, 19]],\n",
" \n",
" [[93, 19]]], dtype=int32),\n",
" array([[[88, 18]],\n",
" \n",
" [[89, 17]],\n",
" \n",
" [[91, 17]],\n",
" \n",
" [[92, 18]],\n",
" \n",
" [[92, 19]],\n",
" \n",
" [[90, 21]],\n",
" \n",
" [[89, 20]],\n",
" \n",
" [[89, 19]]], dtype=int32),\n",
" array([[[87, 17]],\n",
" \n",
" [[88, 18]],\n",
" \n",
" [[88, 19]],\n",
" \n",
" [[87, 20]],\n",
" \n",
" [[86, 20]],\n",
" \n",
" [[85, 19]]], dtype=int32),\n",
" array([[[67, 17]],\n",
" \n",
" [[69, 19]],\n",
" \n",
" [[69, 21]],\n",
" \n",
" [[68, 22]],\n",
" \n",
" [[65, 19]]], dtype=int32),\n",
" array([[[181, 17]],\n",
" \n",
" [[182, 16]],\n",
" \n",
" [[184, 16]],\n",
" \n",
" [[185, 17]],\n",
" \n",
" [[184, 18]],\n",
" \n",
" [[182, 18]]], dtype=int32),\n",
" array([[[108, 17]],\n",
" \n",
" [[109, 16]],\n",
" \n",
" [[110, 16]],\n",
" \n",
" [[111, 17]],\n",
" \n",
" [[110, 18]],\n",
" \n",
" [[109, 18]]], dtype=int32),\n",
" array([[[85, 16]],\n",
" \n",
" [[86, 17]],\n",
" \n",
" [[86, 18]],\n",
" \n",
" [[84, 20]],\n",
" \n",
" [[83, 19]],\n",
" \n",
" [[83, 18]]], dtype=int32),\n",
" array([[[147, 16]],\n",
" \n",
" [[148, 15]],\n",
" \n",
" [[149, 16]],\n",
" \n",
" [[148, 17]]], dtype=int32),\n",
" array([[[132, 16]],\n",
" \n",
" [[133, 15]],\n",
" \n",
" [[136, 18]],\n",
" \n",
" [[134, 20]],\n",
" \n",
" [[132, 18]]], dtype=int32),\n",
" array([[[128, 16]],\n",
" \n",
" [[129, 15]],\n",
" \n",
" [[130, 15]],\n",
" \n",
" [[131, 16]],\n",
" \n",
" [[131, 17]],\n",
" \n",
" [[130, 18]]], dtype=int32),\n",
" array([[[116, 16]],\n",
" \n",
" [[117, 15]],\n",
" \n",
" [[118, 16]],\n",
" \n",
" [[117, 17]]], dtype=int32),\n",
" array([[[113, 16]],\n",
" \n",
" [[114, 15]],\n",
" \n",
" [[115, 16]],\n",
" \n",
" [[115, 17]],\n",
" \n",
" [[114, 18]],\n",
" \n",
" [[113, 17]]], dtype=int32),\n",
" array([[[110, 16]],\n",
" \n",
" [[111, 15]],\n",
" \n",
" [[112, 16]],\n",
" \n",
" [[111, 17]]], dtype=int32),\n",
" array([[[83, 16]],\n",
" \n",
" [[84, 15]],\n",
" \n",
" [[85, 16]],\n",
" \n",
" [[84, 17]]], dtype=int32),\n",
" array([[[79, 16]],\n",
" \n",
" [[80, 15]],\n",
" \n",
" [[82, 15]],\n",
" \n",
" [[84, 17]],\n",
" \n",
" [[83, 18]],\n",
" \n",
" [[83, 19]],\n",
" \n",
" [[82, 20]],\n",
" \n",
" [[81, 20]],\n",
" \n",
" [[80, 21]],\n",
" \n",
" [[79, 20]],\n",
" \n",
" [[78, 21]],\n",
" \n",
" [[77, 20]],\n",
" \n",
" [[77, 19]],\n",
" \n",
" [[78, 18]],\n",
" \n",
" [[80, 18]],\n",
" \n",
" [[81, 17]],\n",
" \n",
" [[80, 17]]], dtype=int32),\n",
" array([[[76, 16]],\n",
" \n",
" [[77, 15]],\n",
" \n",
" [[78, 15]],\n",
" \n",
" [[79, 16]],\n",
" \n",
" [[79, 17]],\n",
" \n",
" [[78, 18]]], dtype=int32),\n",
" array([[[182, 15]],\n",
" \n",
" [[183, 14]],\n",
" \n",
" [[184, 15]],\n",
" \n",
" [[183, 16]]], dtype=int32),\n",
" array([[[112, 15]],\n",
" \n",
" [[113, 14]],\n",
" \n",
" [[114, 15]],\n",
" \n",
" [[113, 16]]], dtype=int32),\n",
" array([[[108, 15]],\n",
" \n",
" [[109, 14]],\n",
" \n",
" [[110, 15]],\n",
" \n",
" [[109, 16]]], dtype=int32),\n",
" array([[[82, 15]],\n",
" \n",
" [[83, 14]],\n",
" \n",
" [[84, 15]],\n",
" \n",
" [[83, 16]]], dtype=int32),\n",
" array([[[125, 14]],\n",
" \n",
" [[126, 13]],\n",
" \n",
" [[127, 14]],\n",
" \n",
" [[126, 15]]], dtype=int32),\n",
" array([[[123, 13]],\n",
" \n",
" [[124, 14]],\n",
" \n",
" [[124, 15]],\n",
" \n",
" [[123, 16]],\n",
" \n",
" [[122, 16]],\n",
" \n",
" [[121, 15]]], dtype=int32),\n",
" array([[[85, 14]],\n",
" \n",
" [[86, 13]],\n",
" \n",
" [[87, 14]],\n",
" \n",
" [[86, 15]]], dtype=int32),\n",
" array([[[53, 14]],\n",
" \n",
" [[54, 13]],\n",
" \n",
" [[55, 14]],\n",
" \n",
" [[54, 15]]], dtype=int32),\n",
" array([[[120, 13]],\n",
" \n",
" [[121, 12]],\n",
" \n",
" [[122, 12]],\n",
" \n",
" [[123, 13]],\n",
" \n",
" [[121, 15]],\n",
" \n",
" [[120, 14]]], dtype=int32),\n",
" array([[[111, 13]],\n",
" \n",
" [[112, 12]],\n",
" \n",
" [[113, 12]],\n",
" \n",
" [[114, 13]],\n",
" \n",
" [[112, 15]],\n",
" \n",
" [[110, 15]],\n",
" \n",
" [[109, 14]],\n",
" \n",
" [[110, 13]]], dtype=int32),\n",
" array([[[107, 13]],\n",
" \n",
" [[108, 12]],\n",
" \n",
" [[109, 13]],\n",
" \n",
" [[108, 14]]], dtype=int32),\n",
" array([[[95, 13]],\n",
" \n",
" [[96, 12]],\n",
" \n",
" [[98, 14]],\n",
" \n",
" [[97, 15]],\n",
" \n",
" [[96, 15]],\n",
" \n",
" [[95, 14]]], dtype=int32),\n",
" array([[[79, 13]],\n",
" \n",
" [[80, 12]],\n",
" \n",
" [[81, 12]],\n",
" \n",
" [[82, 13]],\n",
" \n",
" [[81, 14]],\n",
" \n",
" [[80, 14]]], dtype=int32),\n",
" array([[[78, 12]],\n",
" \n",
" [[80, 14]],\n",
" \n",
" [[80, 15]],\n",
" \n",
" [[79, 16]],\n",
" \n",
" [[78, 15]],\n",
" \n",
" [[77, 15]],\n",
" \n",
" [[76, 14]]], dtype=int32),\n",
" array([[[173, 12]],\n",
" \n",
" [[174, 11]],\n",
" \n",
" [[175, 12]],\n",
" \n",
" [[174, 13]]], dtype=int32),\n",
" array([[[131, 11]],\n",
" \n",
" [[132, 11]],\n",
" \n",
" [[133, 12]],\n",
" \n",
" [[133, 13]],\n",
" \n",
" [[134, 13]],\n",
" \n",
" [[135, 14]],\n",
" \n",
" [[134, 15]],\n",
" \n",
" [[129, 15]],\n",
" \n",
" [[128, 14]]], dtype=int32),\n",
" array([[[82, 12]],\n",
" \n",
" [[83, 11]],\n",
" \n",
" [[84, 11]],\n",
" \n",
" [[85, 12]],\n",
" \n",
" [[85, 13]],\n",
" \n",
" [[84, 14]]], dtype=int32),\n",
" array([[[71, 12]],\n",
" \n",
" [[72, 11]],\n",
" \n",
" [[73, 11]],\n",
" \n",
" [[74, 12]],\n",
" \n",
" [[72, 14]],\n",
" \n",
" [[71, 13]]], dtype=int32),\n",
" array([[[61, 12]],\n",
" \n",
" [[62, 11]],\n",
" \n",
" [[63, 12]],\n",
" \n",
" [[63, 13]],\n",
" \n",
" [[62, 14]],\n",
" \n",
" [[61, 13]]], dtype=int32),\n",
" array([[[60, 11]],\n",
" \n",
" [[61, 12]],\n",
" \n",
" [[61, 20]],\n",
" \n",
" [[60, 21]],\n",
" \n",
" [[59, 20]],\n",
" \n",
" [[57, 20]],\n",
" \n",
" [[55, 18]],\n",
" \n",
" [[56, 17]],\n",
" \n",
" [[56, 16]],\n",
" \n",
" [[58, 14]],\n",
" \n",
" [[58, 13]]], dtype=int32),\n",
" array([[[59, 17]],\n",
" \n",
" [[59, 18]]], dtype=int32),\n",
" array([[[123, 11]],\n",
" \n",
" [[124, 10]],\n",
" \n",
" [[125, 11]],\n",
" \n",
" [[124, 12]]], dtype=int32),\n",
" array([[[117, 11]],\n",
" \n",
" [[118, 10]],\n",
" \n",
" [[119, 11]],\n",
" \n",
" [[118, 12]]], dtype=int32),\n",
" array([[[110, 10]],\n",
" \n",
" [[112, 12]],\n",
" \n",
" [[111, 13]],\n",
" \n",
" [[109, 13]],\n",
" \n",
" [[108, 12]]], dtype=int32),\n",
" array([[[ 98, 11]],\n",
" \n",
" [[ 99, 10]],\n",
" \n",
" [[101, 12]],\n",
" \n",
" [[101, 13]],\n",
" \n",
" [[100, 14]],\n",
" \n",
" [[ 98, 14]],\n",
" \n",
" [[ 97, 13]],\n",
" \n",
" [[ 98, 12]]], dtype=int32),\n",
" array([[[77, 11]],\n",
" \n",
" [[78, 10]],\n",
" \n",
" [[79, 11]],\n",
" \n",
" [[78, 12]]], dtype=int32),\n",
" array([[[76, 10]],\n",
" \n",
" [[77, 11]],\n",
" \n",
" [[77, 13]],\n",
" \n",
" [[76, 14]],\n",
" \n",
" [[74, 12]]], dtype=int32),\n",
" array([[[116, 10]],\n",
" \n",
" [[117, 9]],\n",
" \n",
" [[118, 10]],\n",
" \n",
" [[117, 11]]], dtype=int32),\n",
" array([[[106, 10]],\n",
" \n",
" [[107, 9]],\n",
" \n",
" [[109, 9]],\n",
" \n",
" [[110, 10]],\n",
" \n",
" [[109, 11]],\n",
" \n",
" [[107, 11]]], dtype=int32),\n",
" array([[[85, 10]],\n",
" \n",
" [[86, 9]],\n",
" \n",
" [[87, 9]],\n",
" \n",
" [[88, 10]],\n",
" \n",
" [[87, 11]],\n",
" \n",
" [[88, 12]],\n",
" \n",
" [[87, 13]],\n",
" \n",
" [[86, 13]],\n",
" \n",
" [[85, 12]]], dtype=int32),\n",
" array([[[76, 10]],\n",
" \n",
" [[77, 9]],\n",
" \n",
" [[78, 10]],\n",
" \n",
" [[77, 11]]], dtype=int32),\n",
" array([[[74, 10]],\n",
" \n",
" [[75, 9]],\n",
" \n",
" [[76, 10]],\n",
" \n",
" [[75, 11]]], dtype=int32),\n",
" array([[[72, 10]],\n",
" \n",
" [[73, 9]],\n",
" \n",
" [[74, 10]],\n",
" \n",
" [[73, 11]]], dtype=int32),\n",
" array([[[179, 9]],\n",
" \n",
" [[180, 8]],\n",
" \n",
" [[181, 9]],\n",
" \n",
" [[180, 10]]], dtype=int32),\n",
" array([[[130, 9]],\n",
" \n",
" [[131, 8]],\n",
" \n",
" [[132, 8]],\n",
" \n",
" [[133, 9]],\n",
" \n",
" [[132, 10]],\n",
" \n",
" [[131, 10]]], dtype=int32),\n",
" array([[[120, 8]],\n",
" \n",
" [[121, 9]],\n",
" \n",
" [[121, 10]],\n",
" \n",
" [[122, 11]],\n",
" \n",
" [[119, 14]],\n",
" \n",
" [[119, 15]],\n",
" \n",
" [[118, 16]],\n",
" \n",
" [[117, 15]],\n",
" \n",
" [[116, 16]],\n",
" \n",
" [[115, 15]],\n",
" \n",
" [[114, 15]],\n",
" \n",
" [[113, 14]],\n",
" \n",
" [[114, 13]],\n",
" \n",
" [[117, 13]],\n",
" \n",
" [[119, 11]],\n",
" \n",
" [[118, 10]]], dtype=int32),\n",
" array([[[112, 9]],\n",
" \n",
" [[113, 8]],\n",
" \n",
" [[114, 9]],\n",
" \n",
" [[113, 10]]], dtype=int32),\n",
" array([[[110, 9]],\n",
" \n",
" [[111, 8]],\n",
" \n",
" [[113, 10]],\n",
" \n",
" [[112, 11]],\n",
" \n",
" [[111, 11]],\n",
" \n",
" [[110, 10]]], dtype=int32),\n",
" array([[[97, 9]],\n",
" \n",
" [[98, 8]],\n",
" \n",
" [[99, 9]],\n",
" \n",
" [[98, 10]]], dtype=int32),\n",
" array([[[82, 9]],\n",
" \n",
" [[83, 8]],\n",
" \n",
" [[84, 8]],\n",
" \n",
" [[85, 9]],\n",
" \n",
" [[83, 11]],\n",
" \n",
" [[82, 10]]], dtype=int32),\n",
" array([[[75, 9]],\n",
" \n",
" [[76, 8]],\n",
" \n",
" [[77, 9]],\n",
" \n",
" [[76, 10]]], dtype=int32),\n",
" array([[[71, 9]],\n",
" \n",
" [[72, 8]],\n",
" \n",
" [[73, 9]],\n",
" \n",
" [[72, 10]]], dtype=int32),\n",
" array([[[114, 8]],\n",
" \n",
" [[115, 7]],\n",
" \n",
" [[117, 9]],\n",
" \n",
" [[116, 10]],\n",
" \n",
" [[118, 12]],\n",
" \n",
" [[117, 13]],\n",
" \n",
" [[116, 13]],\n",
" \n",
" [[115, 12]],\n",
" \n",
" [[114, 13]],\n",
" \n",
" [[113, 12]],\n",
" \n",
" [[113, 10]],\n",
" \n",
" [[114, 9]]], dtype=int32),\n",
" array([[[108, 8]],\n",
" \n",
" [[109, 7]],\n",
" \n",
" [[110, 7]],\n",
" \n",
" [[111, 8]],\n",
" \n",
" [[110, 9]],\n",
" \n",
" [[109, 9]]], dtype=int32),\n",
" array([[[104, 8]],\n",
" \n",
" [[105, 7]],\n",
" \n",
" [[106, 7]],\n",
" \n",
" [[107, 8]],\n",
" \n",
" [[106, 9]],\n",
" \n",
" [[106, 11]],\n",
" \n",
" [[107, 12]],\n",
" \n",
" [[106, 13]],\n",
" \n",
" [[106, 14]],\n",
" \n",
" [[107, 14]],\n",
" \n",
" [[108, 15]],\n",
" \n",
" [[107, 16]],\n",
" \n",
" [[106, 16]],\n",
" \n",
" [[106, 17]],\n",
" \n",
" [[105, 18]],\n",
" \n",
" [[104, 17]],\n",
" \n",
" [[104, 16]],\n",
" \n",
" [[103, 15]],\n",
" \n",
" [[103, 14]],\n",
" \n",
" [[104, 13]],\n",
" \n",
" [[104, 11]],\n",
" \n",
" [[100, 11]],\n",
" \n",
" [[ 99, 10]],\n",
" \n",
" [[ 99, 9]],\n",
" \n",
" [[100, 8]],\n",
" \n",
" [[101, 9]],\n",
" \n",
" [[102, 8]]], dtype=int32),\n",
" array([[[100, 8]],\n",
" \n",
" [[101, 7]],\n",
" \n",
" [[102, 8]],\n",
" \n",
" [[101, 9]]], dtype=int32),\n",
" array([[[ 98, 8]],\n",
" \n",
" [[ 99, 7]],\n",
" \n",
" [[100, 8]],\n",
" \n",
" [[ 99, 9]]], dtype=int32),\n",
" ...),\n",
" array([[[ 1, -1, -1, -1],\n",
" [ 2, 0, -1, -1],\n",
" [ 3, 1, -1, -1],\n",
" ...,\n",
" [1073, 1071, -1, 1042],\n",
" [1074, 1072, -1, 1042],\n",
" [ -1, 1073, -1, 1042]]], dtype=int32))"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"import cv2 as cv\n",
"im = cv.imread('img/noisy2.png')\n",
"assert im is not None, \"Файл не может быть прочитан, проверьте путь к файлу\"\n",
"\n",
"imgray = cv.cvtColor(im, cv.COLOR_BGR2GRAY)\n",
"\n",
"ret, thresh = cv.threshold(imgray, 127, 255, 0)\n",
"\n",
"contours, hierarchy = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)\n",
"contours, hierarchy"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAFHCAYAAABwCf9lAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAAC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8PDNJtNFi1axGmnncZ3v/vd9a7/wx/+8Abv3Ze+9KUNnvuwww5DCME+++wzY/vChQtn3KPh4WGOOOIIvvrVr8447uijj17vs+sy9Qxt7O+RRx7ZovvxVKGf6gbU/Onxla98hTPOOIPZs2fzute9jp133pn777+fK664gmuvvZarr76aU089dbPO9a53vYt//Md/3Kp2nHXWWbziFa8gy7Kt+nxNTc1fFt/+9rd5+ctfTpZlvPrVr2afffahqipuvPFGzj//fG677TY+85nPPCHfffvtt3PRRRdx9NFHb7aF+M+Bz372s3jvp//f6XS46KKLgDjYejwJIfDa176WL3zhCxx44IG87W1vY/78+SxdupSvfvWrPO95z+N///d/OfTQQx/T9/zxj3/kF7/4BQsXLuTKK6/kjW984xZ9fvny5Vx++eW8/e1vf0ztWJvx8XG++c1vsnDhQr785S9PD843xFve8hae9axnYYzh17/+NZ/5zGf49re/ze9+9zsWLFgwfdwZZ5zBC17wApxz3HHHHVx++eV85zvf4aabbuKAAw6YPu64447j1a9+NSEEHnjgAS6//HJe9KIX8Z3vfIcTTjhhxndvyfjhIx/5CP/93//N3/7t386YON53331cfPHFvPSlL92qydrvfvc7vvKVr/DSl750k8feeeedPO95z2PFihW85jWv4eCDD2Z0dJQrr7ySF73oRZx33nl86EMf2uBnL774Yl7ykpdsljd4lmV87nOfW2+7UmrTF1TzmKh14cmn1oX1qXXhqdGFD3/4w5x//vkcddRRvOMd76DZbHL33Xfzgx/8gKuvvpoTTzxxk+fI85yrrrqKV73qVTO233///fz0pz/dqHHhgAMOmP69lyxZwqc//Wle8pKXcPnll/O3f/u3m30NU1x++eUbXDQdGhra4nM9JYSami3g7rvvDs1mM+y5555h+fLlM/atWLEi7LnnnqHVaoV77rnnUc8zOTn5RDbzceO+++4LQPj85z//qMddf/31AQjXXHPNk9OwmpqaLeLee+8NfX19Yc899wxLlixZb/8f//jH8NGPfvQJ+/5rrrkmAOH6669/wr7j0eh2u8E595R899qsWLEiAOE973nPevvOPvvs0Gq1tvrcH/rQhwIQ3vrWtwbv/Xr7/+M//iP8/Oc/DyFsus9+tLZccMEFYXh4OFx33XVBCBHuu+++9Y75/Oc/H4Dwi1/8Ynrbe97zngCEAw44IGyzzTah0+nM+MxOO+0UXvjCF27u5c7g3//930OSJOGHP/xhAMKPfvSj9Y7Z2DV//OMfD0C45JJLQghrdO9DH/rQjOO+8Y1vBCD89V//9fQ2IJx77rkzjrv99tsDEJ7//OfP2L4144fPfOYzAQhf+MIXpredeOKJYWBgIDz00EObc2umOfvss0Oj0Qi777572G+//dZ7Rta9lqqqwj777BOazWa46aabZhxrrQ2nn356AMLVV189vX3q3h1wwAEBCNddd92Mz009AytWrJjRrsfy3NdsPbUu1LpQ68Jfri4YY8LAwEA47rjjNrh/2bJl0//e0PVP3buXvOQlQWs9o18PIYT3v//9YZtttgmHH354eMYznjFj34Z+16VLl4ZWqxV233336W1HHXXUep9dlw3pyp8idfhezRbxoQ99iE6nw2c+8xnmzZs3Y9/cuXP59Kc/Tbvd5oMf/OD09im3wttvv50zzzyTWbNmcfjhh8/Ytzbdbpe3vOUtzJ07l/7+fl784hfz8MMPI4TgwgsvnD5uQzmlptxcb7zxRg455BDyPGfRokX8x3/8x4zvWL16Needdx777rsvfX19DAwM8PznP59bb731cbpTa67trrvu4lWvehWDg4PMmzePd7/73YQQWLx4MSeffDIDAwPMnz+fyy67bMbnq6riggsu4KCDDmJwcJBWq8URRxzB9ddfv953rVq1irPOOouBgQGGhoY4++yzufXWWzeYD+sPf/gDL3vZy5g9ezZ5nnPwwQfzjW9843G77pqapyMf/OAHmZyc5IorrmDbbbddb/+uu+7K//2//3f6/9Za3vve97LLLruQZRkLFy7kn/7pnyjLcsbnNqfP+cIXvsDLX/5yAI455phpl+q1QxU++clP8oxnPGPabf3cc89ldHR0ve8655xz1mv70UcfPcO6POVSfvXVV/Oud72L7bbbjmazyfj4OMYYLrroInbbbTfyPGfOnDkcfvjhfP/739/ovRsdHUUpxcc//vHpbStXrkRKyZw5c2aEQr3xjW9k/vz50/9fO3fI/fffP60bF1100fR9WLtfB3j44Yc55ZRT6OvrY968eZx33nk45zbaPoi68c///M/sueeefPjDH96gNfiss87ikEMOedTzbA5XXXUVL3vZyzjppJMYHBzkqquu2qLPX3DBBSxbtmyjIR5bw5VXXslxxx3HMcccw1577cWVV1652Z997nOfC0RL8+Nx3F577cXcuXO55557ZmzfmvHD61//eg477DDOO+88Vq1axdVXX813v/td3ve+97Hddttt9jVOIaXkXe96F7/97W/XC5NYl+uuu47f//73/OM//iPPfvazZ+xTSvHpT3+aoaGh9Z5fgFe84hXsvvvuXHzxxRsMFax5elDrQq0LtS5smL8EXVi5ciXj4+McdthhG9w/PDy8Wec5+eSTybKMa665Zsb2q666itNOO22zPV7nz5/PXnvttcl7+edKvShVs0VMuYEeccQRG9x/5JFHsnDhwg3GDb/85S+n0+lwySWX8IY3vGGj33HOOefwiU98ghe84AVceumlNBoNXvjCF252G++++25e9rK
"text/plain": [
"<Figure size 1200x600 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"\n",
"img = cv.imread('img/1.jpg')\n",
"assert img is not None, \"Файл не может быть прочитан, проверьте путь к файлу\"\n",
"\n",
"imgray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n",
"\n",
"ret, thresh = cv.threshold(imgray, 127, 255, 0)\n",
"\n",
"contours_none, hierarchy_none = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_NONE)\n",
"contours_simple, hierarchy_simple = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)\n",
"\n",
"img_contours_none = img.copy()\n",
"img_contours_simple = img.copy()\n",
"\n",
"# Рисование всех контуров с использованием CHAIN_APPROX_NONE\n",
"cv.drawContours(img_contours_none, contours_none, -1, (0, 255, 0), 2)\n",
"\n",
"# Рисование всех контуров с использованием CHAIN_APPROX_SIMPLE\n",
"cv.drawContours(img_contours_simple, contours_simple, -1, (255, 0, 0), 2)\n",
"\n",
"plt.figure(figsize=(12, 6))\n",
"\n",
"plt.subplot(1, 3, 1)\n",
"plt.imshow(cv.cvtColor(img, cv.COLOR_BGR2RGB))\n",
"plt.title('Original Image')\n",
"plt.xticks([]), plt.yticks([])\n",
"\n",
"plt.subplot(1, 3, 2)\n",
"plt.imshow(cv.cvtColor(img_contours_none, cv.COLOR_BGR2RGB))\n",
"plt.title('Contours with CHAIN_APPROX_NONE')\n",
"plt.xticks([]), plt.yticks([])\n",
"\n",
"plt.subplot(1, 3, 3)\n",
"plt.imshow(cv.cvtColor(img_contours_simple, cv.COLOR_BGR2RGB))\n",
"plt.title('Contours with CHAIN_APPROX_SIMPLE')\n",
"plt.xticks([]), plt.yticks([])\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Moments: {'m00': 11797.5, 'm10': 1766968.5, 'm01': 1763745.3333333333, 'm20': 279121361.25, 'm11': 264210289.2083333, 'm02': 278416334.75, 'm30': 46143593146.75, 'm21': 41742651757.23333, 'm12': 41712935229.5, 'm03': 46029175623.700005, 'mu20': 14473963.073076874, 'mu11': 45640.255419522524, 'mu02': 14733554.427464604, 'mu30': 2569485.2580947876, 'mu21': -114771.74751901627, 'mu12': -469217.5203065872, 'mu03': 102780.40350341797, 'nu20': 0.10399380966594265, 'nu11': 0.000327920142620197, 'nu02': 0.10585894458184811, 'nu30': 0.00016996956593210872, 'nu21': -7.592066950226938e-06, 'nu12': -3.103839494817175e-05, 'nu03': 6.7988483353884626e-06}\n",
"Centroid: (149, 149)\n",
"Contour Area: 11797.5\n",
"Contour Perimeter: 753.1097289323807\n",
"Is Convex: False\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\leonk\\AppData\\Local\\Temp\\ipykernel_22924\\1496569930.py:72: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)\n",
" lefty = int((-x * vy / vx) + y)\n",
"C:\\Users\\leonk\\AppData\\Local\\Temp\\ipykernel_22924\\1496569930.py:73: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)\n",
" righty = int(((cols - x) * vy / vx) + y)\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGbCAYAAAAr/4yjAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACK10lEQVR4nO2dd3xU1fLAv7ubQiih916kiQKiKKAiForos6BgwV6eWJ+KPstPxa6PZ1dUsDx7QVQsYAUbIEpHEFCkSK8hQEjd+f0xW+7dkuwm25Kc737mk9x6zq1zz5kzMw4REQwGg8FgAJzJroDBYDAYUgejFAwGg8HgwygFg8FgMPgwSsFgMBgMPoxSMBgMBoMPoxQMBoPB4MMoBYPBYDD4MErBYDAYDD6MUjAYDAaDD6MUDAaDweDDKIVqyurVq/nnP/9Jhw4dqFGjBtnZ2QwYMICnnnqKAwcOxK3c5cuXM27cONauXRu3MiqCw+EIKc2aNYtLeXl5eYwbN47vvvsuLvs3GKIlLdkVMCSezz//nLPPPpvMzEwuvPBCevToQWFhIT/99BO33HILy5YtY+LEiXEpe/ny5dx7770cd9xxtGvXLi5lVJSTTjqJCy+80DYvKysrLmXl5eVx7733AnDcccfFpQyDIRqMUqhmrFmzhnPOOYe2bdsyY8YMmjdv7lt2zTXX8Oeff/L5558nsYbxJT8/n4yMDJzO8I3kzp07M3r06ATWKvYUFxfjdrvJyMhIdlUMlQ0xVCuuuuoqAWTWrFkRrV9UVCT33XefdOjQQTIyMqRt27Zy++23S35+vm29tm3byvDhw+XHH3+U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Ctt/Fixcza9asiOrbpEkTjjvuOF588UU2b95can137txpW1a7dm06depEQUFBRGUZqg6mpVDN6NixI2+//TajRo2iW7duNo/m2bNnM3nyZC6++GIAevbsyUUXXcTEiRPJyclh4MCB/PLLL7z22mucfvrpDBo0KOrye/Xqhcvl4tFHH2XPnj1kZmZy/PHH06RJE26//Xbuvfdehg4dyj/+8Q9WrlzJhAkTOOKII2zOZJdffjkffPABQ4cOZeTIkaxevZo333yTjh07xuo0heWRRx5h5syZHHnkkVxxxRV0796dXbt2sWDBAr755ht27doFaIvsww8/5IwzzmD48OGsWbOGF154ge7du7Nv3z7f/rKysujevTvvvfcenTt3pkGDBvTo0YMePXpw6aWX8vjjjzNkyBAuu+wytm3bxgsvvMDBBx/sGzRQFs899xxHH300hxxyCFdccQUdOnRg69atzJkzhw0bNrB48WJABwkcd9xx9OnThwYNGjBv3jw++OADrr322tifRENqk8SRT4YksmrVKrniiiukXbt2kpGRIXXq1JEBAwbIM888Yxu+WFRUJPfee6+0b99e0tPTpXXr1qU6rwUSaljlpEmTpEOHDuJyuYKGpz777LPStWtXSU9Pl6ZNm8qYMWNCOps99thj0rJlS8nMzJQBAwbIvHnzwg5JnTx5csTnhQic17Zu3SrXXHONtG7dWtLT06VZs2ZywgknyMSJE33ruN1ueeihh6Rt27aSmZkpvXv3ls8++yxoOKmIyOzZs6VPnz6SkZERNDz1zTff9DkO9urVS7788stSnddCsXr1arnwwgulWbNmkp6eLi1btpRTTjlFPvjgA986DzzwgPTt21fq1asnWVlZ0rVrV3nwwQelsLAw4nNnqBo4RGJsBTQYDAZDpcXYFAwGg8HgwygFg8FgMPgwSsFgMBgMPoxSMBgMBoMPoxQMBoPB4MMoBYPBYDD4iNh5LdL4NwaDwWBITSL
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"\n",
"img = cv.imread('img/star3.png')\n",
"assert img is not None, \"Файл не может быть прочитан, проверьте путь к файлу\"\n",
"\n",
"gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n",
"\n",
"ret, thresh = cv.threshold(gray, 127, 255, 0)\n",
"\n",
"contours, hierarchy = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)\n",
"cnt = contours[0] \n",
"\n",
"# 1. Моменты\n",
"M = cv.moments(cnt)\n",
"print(\"Moments:\", M)\n",
"# Центроид\n",
"cx = int(M['m10'] / M['m00'])\n",
"cy = int(M['m01'] / M['m00'])\n",
"print(\"Centroid:\", (cx, cy))\n",
"\n",
"# 2. Площадь контура\n",
"area = cv.contourArea(cnt)\n",
"print(\"Contour Area:\", area)\n",
"\n",
"# 3. Периметр контура\n",
"perimeter = cv.arcLength(cnt, True)\n",
"print(\"Contour Perimeter:\", perimeter)\n",
"\n",
"# 4. Аппроксимация контура\n",
"epsilon = 0.02 * cv.arcLength(cnt, True)\n",
"approx = cv.approxPolyDP(cnt, epsilon, True)\n",
"cv.drawContours(img, [approx], -1, (0, 255, 0), 3)\n",
"\n",
"# 5. Выпуклая оболочка\n",
"hull = cv.convexHull(cnt)\n",
"cv.drawContours(img, [hull], -1, (255, 0, 0), 2)\n",
"\n",
"# 6. Проверка выпуклости\n",
"is_convex = cv.isContourConvex(cnt)\n",
"print(\"Is Convex:\", is_convex)\n",
"\n",
"# 7a. Прямоугольник, не учитывающий вращение\n",
"x, y, w, h = cv.boundingRect(cnt)\n",
"cv.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)\n",
"\n",
"# 7b. Вращающийся прямоугольник\n",
"rect = cv.minAreaRect(cnt)\n",
"box = cv.boxPoints(rect)\n",
"box = np.intp(box)\n",
"cv.drawContours(img, [box], 0, (0, 0, 255), 2)\n",
"\n",
"# 8. Минимальная окружность, охватывающая объект\n",
"(x, y), radius = cv.minEnclosingCircle(cnt)\n",
"center = (int(x), int(y))\n",
"radius = int(radius)\n",
"cv.circle(img, center, radius, (0, 255, 255), 2)\n",
"\n",
"# 9. Аппроксимация эллипса\n",
"if len(cnt) >= 5: \n",
" ellipse = cv.fitEllipse(cnt)\n",
" cv.ellipse(img, ellipse, (255, 0, 255), 2)\n",
"\n",
"# 10. Аппроксимация линии\n",
"rows, cols = img.shape[:2]\n",
"[vx, vy, x, y] = cv.fitLine(cnt, cv.DIST_L2, 0, 0.01, 0.01)\n",
"lefty = int((-x * vy / vx) + y)\n",
"righty = int(((cols - x) * vy / vx) + y)\n",
"cv.line(img, (cols - 1, righty), (0, lefty), (0, 255, 0), 2)\n",
"\n",
"plt.imshow(cv.cvtColor(img, cv.COLOR_BGR2RGB))\n",
"plt.title('Contour Features')\n",
"plt.axis('off')\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Aspect Ratio: 0.9479166666666666\n",
"Extent: 0.33761160714285715\n",
"Solidity: 0.49613103999327135\n",
"Equivalent Diameter: 122.56036687695205\n",
"Orientation: Angle = 92.29457092285156\n",
"Major Axis Length: 153.76748657226562\n",
"Minor Axis Length: 160.86753845214844\n",
"Pixel Points: [[ 54 180]\n",
" [ 55 179]\n",
" [ 55 180]\n",
" ...\n",
" [244 179]\n",
" [244 180]\n",
" [245 180]]\n",
"Min Value: 255.0 at (180, 54)\n",
"Max Value: 255.0 at (180, 54)\n",
"Mean Intensity: 254.99999999999997\n",
"Leftmost Point: (np.int32(69), np.int32(91))\n",
"Rightmost Point: (np.int32(250), np.int32(150))\n",
"Topmost Point: (np.int32(180), np.int32(54))\n",
"Bottommost Point: (np.int32(180), np.int32(245))\n"
]
},
{
"ename": "NameError",
"evalue": "name 'plt' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[6], line 78\u001b[0m\n\u001b[0;32m 75\u001b[0m cv\u001b[38;5;241m.\u001b[39mdrawContours(img, [cnt], \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m, (\u001b[38;5;241m255\u001b[39m, \u001b[38;5;241m255\u001b[39m, \u001b[38;5;241m255\u001b[39m), \u001b[38;5;241m2\u001b[39m) \u001b[38;5;66;03m# Отрисовка контура звезды\u001b[39;00m\n\u001b[0;32m 77\u001b[0m \u001b[38;5;66;03m# Отображение результата\u001b[39;00m\n\u001b[1;32m---> 78\u001b[0m \u001b[43mplt\u001b[49m\u001b[38;5;241m.\u001b[39mimshow(cv\u001b[38;5;241m.\u001b[39mcvtColor(img, cv\u001b[38;5;241m.\u001b[39mCOLOR_BGR2RGB))\n\u001b[0;32m 79\u001b[0m plt\u001b[38;5;241m.\u001b[39mtitle(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mContour props\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 80\u001b[0m plt\u001b[38;5;241m.\u001b[39maxis(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124moff\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
"\u001b[1;31mNameError\u001b[0m: name 'plt' is not defined"
]
}
],
"source": [
"import numpy as np\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"\n",
"\n",
"img = cv.imread('img/star3.png')\n",
"assert img is not None, \"Файл не может быть прочитан, проверьте путь к файлу\"\n",
"\n",
"imgray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n",
"\n",
"ret, thresh = cv.threshold(imgray, 127, 255, 0)\n",
"contours, hierarchy = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)\n",
"cnt = contours[0] \n",
"\n",
"# 1. Aspect Ratio (Соотношение сторон)\n",
"x, y, w, h = cv.boundingRect(cnt)\n",
"aspect_ratio = float(w) / h\n",
"print(\"Aspect Ratio:\", aspect_ratio)\n",
"\n",
"# 2. Extent (Протяжённость)\n",
"area = cv.contourArea(cnt)\n",
"rect_area = w * h\n",
"extent = float(area) / rect_area\n",
"print(\"Extent:\", extent)\n",
"\n",
"# 3. Solidity (Солидность)\n",
"hull = cv.convexHull(cnt)\n",
"hull_area = cv.contourArea(hull)\n",
"solidity = float(area) / hull_area\n",
"print(\"Solidity:\", solidity)\n",
"\n",
"# 4. Equivalent Diameter (Эквивалентный диаметр)\n",
"equi_diameter = np.sqrt(4 * area / np.pi)\n",
"print(\"Equivalent Diameter:\", equi_diameter)\n",
"\n",
"# 5. Orientation (Ориентация)\n",
"if len(cnt) >= 5: \n",
" (x, y), (MA, ma), angle = cv.fitEllipse(cnt)\n",
" print(\"Orientation: Angle =\", angle)\n",
" print(\"Major Axis Length:\", MA)\n",
" print(\"Minor Axis Length:\", ma)\n",
"\n",
"# 6. Mask and Pixel Points (Маска и пиксельные точки)\n",
"mask = np.zeros(imgray.shape, np.uint8)\n",
"cv.drawContours(mask, [cnt], 0, 255, -1)\n",
"pixelpoints = np.transpose(np.nonzero(mask))\n",
"print(\"Pixel Points:\", pixelpoints)\n",
"\n",
"# 7. Min/Max Value and Locations (Минимум/максимум значений и их местоположения)\n",
"min_val, max_val, min_loc, max_loc = cv.minMaxLoc(imgray, mask=mask)\n",
"print(\"Min Value:\", min_val, \"at\", min_loc)\n",
"print(\"Max Value:\", max_val, \"at\", max_loc)\n",
"\n",
"# 8. Mean Intensity (Средняя интенсивность)\n",
"mean_val = cv.mean(imgray, mask=mask)\n",
"print(\"Mean Intensity:\", mean_val[0]) \n",
"\n",
"# 9. Extreme Points (Экстремальные точки)\n",
"leftmost = tuple(cnt[cnt[:, :, 0].argmin()][0])\n",
"rightmost = tuple(cnt[cnt[:, :, 0].argmax()][0])\n",
"topmost = tuple(cnt[cnt[:, :, 1].argmin()][0])\n",
"bottommost = tuple(cnt[cnt[:, :, 1].argmax()][0])\n",
"\n",
"print(\"Leftmost Point:\", leftmost)\n",
"print(\"Rightmost Point:\", rightmost)\n",
"print(\"Topmost Point:\", topmost)\n",
"print(\"Bottommost Point:\", bottommost)\n",
"\n",
"cv.circle(img, leftmost, 5, (255, 0, 0), -1)\n",
"cv.circle(img, rightmost, 5, (0, 255, 0), -1)\n",
"cv.circle(img, topmost, 5, (0, 0, 255), -1)\n",
"cv.circle(img, bottommost, 5, (255, 255, 0), -1)\n",
"cv.drawContours(img, [cnt], -1, (255, 255, 255), 2) \n",
"\n",
"plt.imshow(cv.cvtColor(img, cv.COLOR_BGR2RGB))\n",
"plt.title('Contour props')\n",
"plt.axis('off')\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGbCAYAAAAr/4yjAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA9wElEQVR4nO3deXxU5b3H8c8kJCGBAGHf0rCoKJuA4AJXg2gpIIrVsnjZ3HBt0Yq1yvVq0S5iLSgiIhZXWheg9bbiUhFQEMQFUSgqCISdIIWEBIGE5Nw/nsyZM1knYWbOLN+3r+flPE/OzPwmTOY35zybx7IsCxERESDB7QBERCRyKCmIiIhNSUFERGxKCiIiYlNSEBERm5KCiIjYlBRERMSmpCAiIjYlBRERsSkpiIiITUlBam3r1q3cfPPNdOrUifr169OoUSMGDBjAE088wbFjx0L2vJs2beI3v/kNOTk5IXsOkXhXz+0AJLosWbKEkSNHkpKSwoQJE+jevTtFRUWsWrWKX/3qV/z73/9m3rx5IXnuTZs2MW3aNAYOHEiHDh1C8hwi8U5JQQK2fft2xowZQ1ZWFsuWLaNNmzb2z26//Xa+++47lixZ4mKEoXX8+HGSk5NJSIi8E+wffviBtLQ0t8OQGBB5726JWI8++iiFhYXMnz/fLyF4nXbaadxxxx12/eTJkzz88MN07tyZlJQUOnTowNSpUzlx4oTf/Tp06MDw4cNZtWoV5557Lv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eNAugwYNAmD58uUBvw6JX+poloA0atQIgIKCgoCO37FjBwkJCZx22ml+7a1bt6ZJkybs2LHDr/1HP/pRhcfIyMjg8OHDAT0XQJcuXfzak5OT6dSpU4Xnqo2OHTvW6vjyr8ObIDIzMytt976+2r6Gdu3akZyc7Ne2ZcsWvv76a1q0aFFpbAcOHKjNS5E4paQgAWnUqBFt27Zl48aNtbqfx+MJ6LjExMRK260g7xZbVTwlJSWVxlCbswSo+nUE+/VVFldpaSk9evRgxowZld6nfGISqYySggRs+PDhzJs3jzVr1nDBBRdUe2xWVhalpaVs2bKFs846y27Pzc0lLy+PrKysWj9/VR/o3sf69ttv6dSpk91eVFTE9u3bufTSS+22jIyMCqN5wHxTd9433GrzGqrSuXNnvvzySy655JKAk7FIeepTkIDdc889NGjQgBtvvJHc3NwKP9+6dStPPPEEAMOGDQPg8ccf9zvG+y32sssuq/XzN2jQAKDCh/qll15KcnIys2bN8vvmPX/+fPLz8/2eq3Pnznz88ccUFRXZbW+++Sa7du2qdTzBVJvXUJVRo0axZ88enn322Qo/O3bsGEePHg1qzBKbdKYgAevcuTN//etfGT16NGeddZbfjObVq1ezcOFCew7A2WefzcSJE5k3bx55eXlkZ2fzySef8OKLL3LllVdy8cUX1/r5e/XqRWJiItOnTyc/P5+UlBQGDRpEy5Ytue+++5g2bRpDhgzhiiuu4Ntvv2XOnDn069ePcePG2Y9x4403smjRIoYMGcKoUaPYunUrCxYsoHPnzsH6NdVJixYtAn4NVRk/fjyvv/46t9xyC8uXL2fAgAGUlJTwzTff8Prrr/Puu+/St2/fMLwaiWruDn6SaLR582Zr0qRJVocOHazk5GQrPT3dGjBggPXkk0/aQywty7KKi4utadOmWR07drSSkpKszMxM67777vM7xrLMMNHLLruswvOUHyZqWZb17LPPWp06dbISExMrDE+dPXu2deaZZ1pJSUlWq1atrFtvvdU6fPhwhcf905/+ZLVr185KSUmxBgwYYH322WdVDklduHBhQL8T75DUP/7xj37tVT3O888/bwHWp59+6tceyGvIzs62unXrVmkcRUVF1vTp061u3bpZKSkpVkZGhnXOOedY06ZNs/Lz8wN6LRLfPJYV5J48ERGJWupTEBERm5KCiIjYlBRERMSmpCAiIjYlBRERsSkpiIiILeDJa5o2LyIS3QKZgaAzBRERsSkpiIiITUlBRERsSgoiImJTUhAREZuSgoiI2JQURETEpqQgIiI2JQUREbEpKYiIiE1JQUREbEoKIiJiU1IQERGbkoKIiNiUFERExKakICIiNiUFERGxKSmIiIhNSUFERGxKCiIiYlNSEBERm5KCiIjYlBRERMSmpCAiIjYlBRERsSkpiIiITUlBRERsSgoiImJTUhAREZuSgoiI2JQURETEpqQgIiI2JQUREbEpKYiIiE1JQUREbEoKIiJiU1IQERGbkoKIiNiUFERExKakICIiNiUFERGxKSmIiIhNSUFERGxKCiIiYlNSEBERm5KCiIjYlBRERMSmpCAiIjYlBRERsSkpiIiITUlBRERsSgoiImJTUhAREZuSgoiI2JQURETEpqQgIiI2JQUREbEpKYiIiE1JQUREbEoKIiJiU1IQERGbkoKIiNiUFERExKakICIitnpuByAilegIPOqovwT806VYJK4oKYhEirFAUtntLOBnjp+dBIqAd8MdlMQbj2VZVkAHejyhjkUkvrQEGpTd9gBfAg2rOX4p8ONQByWxLJCPe50piIST87vVHODq6g71YGGVb6R8k0gwqaNZJFyGAvmOckXVh/akJ9/zPfWc39sGArtCGaCIkoJI6KQA7wPLy8p0IN1RkhzHlgLDgIEw5pkxzGc+GWSwlKV0opM5ph7QquyxWoXpNUjc0eUjkWAaD7Qpu52E+XZf1VevN4BvHfX3YcxVYxifOZ6+9AUgm2wa2B0PmL/YgZiEIxICSgoip6I5kOmo3wN0r+LYfGCroz4bcyZRpmfPnkyZMoW+ffv63+9roCn+ZwfdgQLgcN3CFqmSFSBM95aKikqSo0zGqvK/UixOOMriqh8zJSXFOnLkSKV/ez169LB4BIuico9/HRaJEfD7UImaEgidKYjURhsgx1FPrObYY5hv+KVl9dL
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"img = cv.imread('img/star3.png')\n",
"assert img is not None, \"file could not be read, check with os.path.exists()\"\n",
"img_gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)\n",
"ret,thresh = cv.threshold(img_gray, 127, 255,0)\n",
"contours,hierarchy = cv.findContours(thresh,2,1)\n",
"cnt = contours[0]\n",
"hull = cv.convexHull(cnt,returnPoints = False)\n",
"defects = cv.convexityDefects(cnt,hull)\n",
"for i in range(defects.shape[0]):\n",
" s,e,f,d = defects[i,0]\n",
" start = tuple(cnt[s][0])\n",
" end = tuple(cnt[e][0])\n",
" far = tuple(cnt[f][0])\n",
" cv.line(img,start,end,[0,255,0],2)\n",
" cv.circle(img,far,5,[0,0,255],-1)\n",
"\n",
"plt.imshow(cv.cvtColor(img, cv.COLOR_BGR2RGB))\n",
"plt.title('Contour more')\n",
"plt.axis('off')\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.3433042460955864\n"
]
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"img1 = cv.imread('img/star.jpg',0)\n",
"img2 = cv.imread('img/star3.png',0)\n",
"ret, thresh = cv.threshold(img1, 127, 255,0)\n",
"ret, thresh2 = cv.threshold(img2, 127, 255,0)\n",
"contours,hierarchy = cv.findContours(thresh,2,1)\n",
"cnt1 = contours[0]\n",
"contours,hierarchy = cv.findContours(thresh2,2,1)\n",
"cnt2 = contours[0]\n",
"ret = cv.matchShapes(cnt1,cnt2,1,0.0)\n",
"print( ret )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Mode: RETR_LIST\n",
"Hierarchy:\n",
" [[ 1 -1 -1 -1]\n",
" [ 2 0 -1 -1]\n",
" [ 3 1 -1 -1]\n",
" [ 4 2 -1 -1]\n",
" [ 5 3 -1 -1]\n",
" [ 6 4 -1 -1]\n",
" [ 7 5 -1 -1]\n",
" [ 8 6 -1 -1]\n",
" [-1 7 -1 -1]]\n",
"Contour 0: Next=1, Previous=-1, First_Child=-1, Parent=-1\n",
"Contour 1: Next=2, Previous=0, First_Child=-1, Parent=-1\n",
"Contour 2: Next=3, Previous=1, First_Child=-1, Parent=-1\n",
"Contour 3: Next=4, Previous=2, First_Child=-1, Parent=-1\n",
"Contour 4: Next=5, Previous=3, First_Child=-1, Parent=-1\n",
"Contour 5: Next=6, Previous=4, First_Child=-1, Parent=-1\n",
"Contour 6: Next=7, Previous=5, First_Child=-1, Parent=-1\n",
"Contour 7: Next=8, Previous=6, First_Child=-1, Parent=-1\n",
"Contour 8: Next=-1, Previous=7, First_Child=-1, Parent=-1\n",
"\n",
"Mode: RETR_EXTERNAL\n",
"Hierarchy:\n",
" [[ 1 -1 -1 -1]\n",
" [ 2 0 -1 -1]\n",
" [ 3 1 -1 -1]\n",
" [ 4 2 -1 -1]\n",
" [ 5 3 -1 -1]\n",
" [-1 4 -1 -1]]\n",
"Contour 0: Next=1, Previous=-1, First_Child=-1, Parent=-1\n",
"Contour 1: Next=2, Previous=0, First_Child=-1, Parent=-1\n",
"Contour 2: Next=3, Previous=1, First_Child=-1, Parent=-1\n",
"Contour 3: Next=4, Previous=2, First_Child=-1, Parent=-1\n",
"Contour 4: Next=5, Previous=3, First_Child=-1, Parent=-1\n",
"Contour 5: Next=-1, Previous=4, First_Child=-1, Parent=-1\n",
"\n",
"Mode: RETR_CCOMP\n",
"Hierarchy:\n",
" [[ 1 -1 -1 -1]\n",
" [ 4 0 2 -1]\n",
" [ 3 -1 -1 1]\n",
" [-1 2 -1 1]\n",
" [ 6 1 5 -1]\n",
" [-1 -1 -1 4]\n",
" [ 7 4 -1 -1]\n",
" [ 8 6 -1 -1]\n",
" [-1 7 -1 -1]]\n",
"Contour 0: Next=1, Previous=-1, First_Child=-1, Parent=-1\n",
"Contour 1: Next=4, Previous=0, First_Child=2, Parent=-1\n",
"Contour 2: Next=3, Previous=-1, First_Child=-1, Parent=1\n",
"Contour 3: Next=-1, Previous=2, First_Child=-1, Parent=1\n",
"Contour 4: Next=6, Previous=1, First_Child=5, Parent=-1\n",
"Contour 5: Next=-1, Previous=-1, First_Child=-1, Parent=4\n",
"Contour 6: Next=7, Previous=4, First_Child=-1, Parent=-1\n",
"Contour 7: Next=8, Previous=6, First_Child=-1, Parent=-1\n",
"Contour 8: Next=-1, Previous=7, First_Child=-1, Parent=-1\n",
"\n",
"Mode: RETR_TREE\n",
"Hierarchy:\n",
" [[ 1 -1 -1 -1]\n",
" [ 4 0 2 -1]\n",
" [ 3 -1 -1 1]\n",
" [-1 2 -1 1]\n",
" [ 6 1 5 -1]\n",
" [-1 -1 -1 4]\n",
" [ 7 4 -1 -1]\n",
" [ 8 6 -1 -1]\n",
" [-1 7 -1 -1]]\n",
"Contour 0: Next=1, Previous=-1, First_Child=-1, Parent=-1\n",
"Contour 1: Next=4, Previous=0, First_Child=2, Parent=-1\n",
"Contour 2: Next=3, Previous=-1, First_Child=-1, Parent=1\n",
"Contour 3: Next=-1, Previous=2, First_Child=-1, Parent=1\n",
"Contour 4: Next=6, Previous=1, First_Child=5, Parent=-1\n",
"Contour 5: Next=-1, Previous=-1, First_Child=-1, Parent=4\n",
"Contour 6: Next=7, Previous=4, First_Child=-1, Parent=-1\n",
"Contour 7: Next=8, Previous=6, First_Child=-1, Parent=-1\n",
"Contour 8: Next=-1, Previous=7, First_Child=-1, Parent=-1\n"
]
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"\n",
"img = cv.imread('img/star.jpg')\n",
"assert img is not None, \"Файл не может быть прочитан, проверьте путь к файлу\"\n",
"\n",
"gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n",
"ret, thresh = cv.threshold(gray, 127, 255, 0)\n",
"\n",
"\n",
"contour_modes = [cv.RETR_LIST, cv.RETR_EXTERNAL, cv.RETR_CCOMP, cv.RETR_TREE]\n",
"mode_names = [\"RETR_LIST\", \"RETR_EXTERNAL\", \"RETR_CCOMP\", \"RETR_TREE\"]\n",
"\n",
"for mode, name in zip(contour_modes, mode_names):\n",
" contours, hierarchy = cv.findContours(thresh, mode, cv.CHAIN_APPROX_SIMPLE)\n",
" hierarchy = hierarchy[0] if hierarchy is not None else [] \n",
" \n",
" print(f\"\\nMode: {name}\")\n",
" print(\"Hierarchy:\\n\", hierarchy)\n",
"\n",
" img_copy = img.copy()\n",
" \n",
" for i, cnt in enumerate(contours):\n",
" color = (0, 255, 0) \n",
" cv.drawContours(img_copy, contours, i, color, 2)\n",
"\n",
" next_contour, prev_contour, first_child, parent = hierarchy[i]\n",
" print(f\"Contour {i}: Next={next_contour}, Previous={prev_contour}, First_Child={first_child}, Parent={parent}\")\n",
" \n",
" x, y, w, h = cv.boundingRect(cnt)\n",
" cv.putText(img_copy, str(i), (x + w // 2, y + h // 2), cv.FONT_HERSHEY_SIMPLEX, 0.5, (255, 0, 0), 1)\n",
"\n",
" cv.imshow(f'Contours - {name}', img_copy)\n",
"\n",
"cv.waitKey(0)\n",
"cv.destroyAllWindows()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 3"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcsAAAGbCAYAAACrjLuwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9eYxs21Ue/tU8V1d39XT7zve96zcag80UhCE4CIIgTiLCH9hxMDgJUwZIICIEBQQSEEBgQgIBYgzIgRAcYwXMICsiASJkCAE/289+9w137ttTdXfNc53fH/37dn9n9T7V3dd+vH64ltTqqlPn7OnsvYZvrb12LAiCADOa0YxmN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853vRK1Wc1tHbty4AeB4x/tJ6au+6qvw/d///fj6r/96fMEXfAE+8pGP4L/8l/8SmURhRjOa0cnpF37hF7x7Cf/6X//reN/73oe/+3f/Lr7yK78SN2/exH/6T/8JTz75JFqt1pH7H330UXzhF34hvvmbvxn9fh/vfOc7Ua1W8a/+1b+KrPvLvuzLkE6n8bf+1t/CN37jN6LVauHnf/7nsby8jAcPHrj7yuUyfuInfgL/8B/+Q3zO53yO2wP+4Q9/GJ1OB7/0S7/kLf8rv/Ir8eM//uP4m3/zb+Itb3kLtra28B//43/Eo48+eqx76tONPu2FJXCwZ/Lxxx/HD/3QDzkBWa1W8SVf8iX47u/+7odympN++Zd/Gaurq/jVX/1V/MZv/Aa+9Eu/FL/2a7+Gxx577EjU2sPSd3/3d6PdbuN
"text/plain": [
"<Figure size 640x480 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"img = cv.imread('sudoku.jpg', cv.IMREAD_GRAYSCALE)\n",
"assert img is not None, \"file could not be read, check with os.path.exists()\"\n",
"laplacian = cv.Laplacian(img,cv.CV_64F)\n",
"sobelx = cv.Sobel(img,cv.CV_64F,1,0,ksize=5)\n",
"sobely = cv.Sobel(img,cv.CV_64F,0,1,ksize=5)\n",
"plt.subplot(2,2,1),plt.imshow(img,cmap = 'gray')\n",
"plt.title('Original'), plt.xticks([]), plt.yticks([])\n",
"plt.subplot(2,2,2),plt.imshow(laplacian,cmap = 'gray')\n",
"plt.title('Laplacian'), plt.xticks([]), plt.yticks([])\n",
"plt.subplot(2,2,3),plt.imshow(sobelx,cmap = 'gray')\n",
"plt.title('Sobel X'), plt.xticks([]), plt.yticks([])\n",
"plt.subplot(2,2,4),plt.imshow(sobely,cmap = 'gray')\n",
"plt.title('Sobel Y'), plt.xticks([]), plt.yticks([])\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{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ljjY2NJJfLJV944QX6mFqtJg0Gg8k9ysrKSC6XS77xxhsmx2B1MYwJx48fJ5lMJslkMslp06aRL7/8Mnns2DFSq9WanJednU0CIB966CGT4y+++CIJgDx16hR9jJKPPXv20Mc6OjpIV1dXMiYmhj7297//nRQKhWRRUZHJNf/85z+TTCaTrKyspI/dLpe9ERMTQ9rY2Az0rZPXr18nAZCvvPKKyfG1a9eSPB6P7OjoGPC1SPKWaTc2NpYEQP/4+vqSBQUFJuf9HlwME0mu9Ho9qdFoTI61tbWRzs7O5B//+Ef6GDWP8fl8srq6mj5+6dIlEgD53HPP0a/FAEzqHh4e5D333GNyrKOjY0BrQ3c+/fRTEgB57Ngx+pjBYCDd3d3JadOmDfg6JEmSTz/9NAmAtLe3JxctWkTu3LmTfP/990mRSET6+fmRSqXS5PxVq1aR06dPp39HHy6G3n5SU1N7jCEwMJBMTk4e1LgnlAWhs7MTACAWi/s8j/q7XC6njz366KP9Xv/o0aMAgMcff9zk+GACh0JDQ02sG46OjggKCkJpaSl9jMvlgsG49dUYDAa0tLRAJBIhKCgImZmZA76XldFj/vz5SE9Px/Lly5GTk4P33nsPCxcuhLu7O70jB4DDhw8DQI8d2AsvvAAAPSxZbm5uJgG0EokEDzzwALKyslBfXw8A2LVrF2bOnAlbW1uTXcO8efNgMBhw9uzZQb0XuVze7zPTndDQUMTExGDHjh30MaVSif3792Pp0qWQSCSDur9YLEZYWBieeOIJ7N27F5999hn
"text/plain": [
"<Figure size 640x480 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"img = cv.imread('images/mishka.jpg', cv.IMREAD_GRAYSCALE)\n",
"assert img is not None, \"file could not be read, check with os.path.exists()\"\n",
"# Output dtype = cv.CV_8U\n",
"sobelx8u = cv.Sobel(img,cv.CV_8U,1,0,ksize=5)\n",
"# Output dtype = cv.CV_64F. Then take its absolute and convert to cv.CV_8U\n",
"sobelx64f = cv.Sobel(img,cv.CV_64F,1,0,ksize=5)\n",
"abs_sobel64f = np.absolute(sobelx64f)\n",
"sobel_8u = np.uint8(abs_sobel64f)\n",
"plt.subplot(1,3,1),plt.imshow(img,cmap = 'gray')\n",
"plt.title('Original'), plt.xticks([]), plt.yticks([])\n",
"plt.subplot(1,3,2),plt.imshow(sobelx8u,cmap = 'gray')\n",
"plt.title('Sobel CV_8U'), plt.xticks([]), plt.yticks([])\n",
"plt.subplot(1,3,3),plt.imshow(sobel_8u,cmap = 'gray')\n",
"plt.title('Sobel abs(CV_64F)'), plt.xticks([]), plt.yticks([])\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAACwCAYAAACSGm2lAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB5jElEQVR4nO29d3xb9b3//zpHe1h72Jb33onjJCY7AQIkBAgUSAIE0lAKhUuhD8r9QidtKVAovXChpdwyQ1g3aeBSdgJkmySOY8cjXvHelmVZkrWl8/sjP51G8ZJt2ZLs83w88njAsXTOR9I5n8/r854ERVEUGBgYGBgYGOYtZKgHwMDAwMDAwBBaGDHAwMDAwMAwz2HEAAMDAwMDwzyHEQMMDAwMDAzzHEYMMDAwMDAwzHMYMcDAwMDAwDDPYcQAAwMDAwPDPIcRAwwMDAwMDPMcRgwwMDAwMDDMcxgxEESeeOIJEAQxpfe+9dZbIAgCLS0twR3URbS0tIAgCLz11lszdg0GBobgwjy3DLMBIwYAVFdX44477oBOpwOPx0NsbCxuv/12VFdXh3poIeHgwYMgCAJ79+4N9VAYGCIen9Af69/3338f6iGOiW+Do9frQz0UhhmGHeoBhJp9+/Zh27ZtUCgUuPvuu5GcnIyWlha8/vrr2Lt3Lz744APceOONAZ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B582Z89NFHQf3cDAzTZWhoCHq93u/fwMAA/XeKonDDDTfgnXfewR133IEnn3wSHR0do977n332GbZs2QIOh4Onn34aN910E+6++26cPn16xGvvvfdePProo1ixYgVefPFF/PCHP8S7776Lq6++Gi6Xa0qfZXBwEJs2bUJxcTGeffZZ8Hg8bN26FR9++CG2bt2KjRs34plnnsHw8DBuvvlmmM1m+r2nTp3C8ePHsXXrVvz3f/837rvvPnzzzTdYu3YtrFYr/brOzk6sW7cO1dXVePzxx/Gzn/0M7777Ll588cUR43nnnXdw7bXXQiwW409/+hN+/etfo6amBitXrpzRoOw5BTVPMRqNFADqhhtuGPd1119/PQWAMplMFEVR1G9/+1sKALVt27YRr/X9zcfp06cpANTDDz/s97odO3ZQAKjf/va39LE333yTAkA1NzfTxxITEykA1OHDh+ljfX19FI/Hox555BH6mN1upzwej981mpubKR6PR/3+97/3OwaAevPNN8f9zN999x0FgNqzZ8+Iz/bjH/+YPuZ2u6m4uDiKIAjqmWeeoY8PDg5SAoGAuuuuu/xe63A4/K4zODhIabVaaufOnfSxf/7znxQA6oUXXqCPeTwe6vLLLx8x9iuuuILKz8+n7HY7fczr9VLLly+n0tPTx/2MDAyzhe/ZHu0fj8ejX/fxxx9TAKhnn32WPuZ2u6lVq1aNuPfz8/OpuLg4ymw208cOHjxIAaASExPpY0eOHKEAUO+++67fmL788stRj1+K77nv7++nj61Zs4YCQL333nv0sdraWgoARZIk9f3339PHv/rqqxFjt1qtI65TUlJCAaB27dpFH3vwwQcpgiCoM2fO0McGBgYohULhN1eazWZKJpNR99xzj985e3p6KKlUOuI4w+jMW8uAT6lGRUWN+zrf300mk9/x++67b8JrfPnllwCA+++/3+/4gw8+GPA4c3Jy/CwXarUamZmZaGpqoo/xeDyQ5IWf0uPxYGBgAGKxGJmZmSgrKwv4WoHwox/9iP5vFouFxYsXg6Io3H333fRxmUw2YowsFgtcLhfAhd2/wWCA2+3G4sWL/cb45ZdfgsPh+FlbSJLEAw884DcOg8GAb7/9Frfee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jyG63j8iaSExMDPgzAoBGo2Hmgmkwb2MGAOD
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"img = cv.imread('images/mishka.jpg', cv.IMREAD_GRAYSCALE)\n",
"assert img is not None, \"file could not be read, check with os.path.exists()\"\n",
"edges = cv.Canny(img,100,200)\n",
"plt.subplot(121),plt.imshow(img,cmap = 'gray')\n",
"plt.title('Original Image'), plt.xticks([]), plt.yticks([])\n",
"plt.subplot(122),plt.imshow(edges,cmap = 'gray')\n",
"plt.title('Edge Image'), plt.xticks([]), plt.yticks([])\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 4"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAFCCAYAAABsN94DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9eZykVXk2jl9V1Ut119L7LD37DDMwsokgEHYJigQ0YAQCKmoMkrzGvMZo/EblDSiSKEGCRkV5eYEgiKLGhXxIMBEVNBgQFVmFYYZZerZeqmvrqu6uen5/9O86fT13PzUzjai0da7Ppz7dXf0s5znnPvd93cs5TywIggAeHh4eHh4eTYv4b7sBHh4eHh4eHr9deDLg4eHh4eHR5PBkwMPDw8PDo8nhyYCHh4eHh0eTw5MBDw8PDw+PJocnAx4eHh4eHk0OTwY8PDw8PDyaHJ4MeHh4eHh4NDk8GfDw8PDw8GhyeDLg4eHh4eHR5PBkwMPjRUQsFjugz/e+9z1s2bLF/X3VVVdFXu9Nb3oTYrEY0un0C2rPpk2bcNlll2Ht2rVIJpPIZrM48cQTcf3112NiYiJ0bK1Ww80334zTTjsNvb29aG9vx+rVq/H2t78dDz/88JxrP/7443jzm9+MZcuWob29HYODg3jTm96Exx9/fM6xt9xyyz7748EHH9xvHy5ZssQdc8UVVzQ87oYbbnhBfeXh0cxo+W03wMPjdwm33XZb6O9/+Zd/wXe+850532/cuNEZ42QyiS996Uv48Ic/HDqmVCrhm9/8JpLJ5Atqy7/927/h/PPPR3t7Oy655BIcdthhmJycxAMPPID3v//9ePzxx/GFL3wBADAxMYE3vOEN+Pd//3eccsop+OAHP4je3l5s2bIFX/nKV3Drrbdi69atWL58OQDg61//Oi666CL09vbiHe94B9asWYMtW7bgpptuwle/+lXceeedOO+88+a06SMf+QjWrFkz5/uDDjoo9PerX/1qXHLJJaHvOjo65pz3uc99bg5ROu644+bXUR4eHkDg4eHxa8O73vWuoNE027x5cwAgeMMb3hAACH72s5+F/n/77bcHra2twete97oglUrN677PPfdckE6ng0MOOSQYGhqa8/9nnnkm+Kd/+qc57bzuuuvmHDs9PR1cc801wbZt24IgCIJnn3026OzsDA455JBgz549oWP37t0bHHLIIUEqlQo2bdrkvr/55psDAMFDDz2037YDCN71rnft85i/+7u/CwAEe/fu3e/1PDw89g+fJvBoauzYsQPveMc7MDg4iPb2dqxZswZ//ud/jv/5n/9BLBbDrbfeOuec//iP/0AsFsPdd9/9orTh937v97BmzRrccccdoe9vv/12vPa1r0Vvb++8r/mJT3wCxWIRN910E5YuXTrn/wcddBD+9//+3wCA7du34/Of/zxe/epX4z3vec+cYxOJBN73vve5qMA111yDcrmML3zhCxgYGAgd29/fj89//vMolUr4xCc+Me92e3h4/HbgyYBH02JoaAjHHnss7rzzTlx44YX41Kc+hbe85S34/ve/jw0bNmDt2rX4yle+Mue8L3/5y+jp6cGZZ575orXloosuwp133ong//9G8eHhYdx77724+OKLX9D1vv3tb2Pt2rU44YQT9nvsPffcg+npabzlLW854GuvXr0aJ598cuT/TznlFKxevRr/9m//Nud/4+PjGB4eDn1GRkbmHFepVOYcV61W5xw3Ojo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TwY8PDw8PDyaHJ4MeHh4eHh4NDk8GfDw8PDw8GhyeDLg4eHh4eHR5PBkwMPDw8PDo8nhyYCHh4eHh0eTw5MBDw8PDw+PJocnAx4eHh4eHk0OTwY8PDw8PDyaHJ4
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAFCCAYAAABsN94DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9eXxkZZU+/lRVlkpVJZW1O53eu+mGZhVBYNhFFBlQAVkEZBsHGcfRUUd0RmUERVwYQHBDGX6gCIIIojIfRpwBEXSYARGRpYFuuqH37mxVlUoqSVXd3x/5Pm+ee3LT3UG2mPd8Pvmku3Lr3nc57znPec553xsLgiCAFy9evHjx4mXGSvz1boAXL168ePHi5fUVDwa8ePHixYuXGS4eDHjx4sWLFy8zXDwY8OLFixcvXma4eDDgxYsXL168zHDxYMCLFy9evHiZ4eLBgBcvXrx48TLDxYMBL168ePHiZYaLBwNevHjx4sXLDBcPBrx48eLFi5cZLh4MeJk2EovFdurn17/+NdauXev+f+mll0be78wzz0QsFkMmk3lZ7Vm9ejUuuOACLFmyBMlkEk1NTTjkkENw9dVXY2hoKHRtpVLBDTfcgCOPPBKtra2or6/HokWLcN555+HRRx+dcO+nnnoK73//+zF37lzU19ejq6sLZ555Jp566qkJ1954443bHY+HH354h2PY2dnprrn44osnve7aa6/d6fE599xzEYvFsPfeeyPq1PNYLIZ/+Id/mPB5T08PLrzwQuy6665IJpNobW3FMcccg7vvvnvCtTrPsVgM8Xgcra2tOPbYY/E///M/E65n3+LxONatWzfh7/l8Hg0NDRPaZp9jf77yla+4a4888shQe5qamrDrrrvirLPOwq9+9audHj8vXl5LqXm9G+DFy87KTTfdFPr/D37wA/zqV7+a8PmKFSucM04mk/jRj36Ez33uc6FrisUifvaznyGZTL6stvzHf/wHTjnlFNTX1+Pss8/GnnvuiZGRETz00EO48MIL8dRTT+F73/seAGBoaAgnnXQS/vM//xOHH344PvOZz6C1tRVr167Fj3/8Y3z/+9/HSy+9hHnz5gEA7rzzTpx++ulobW3FBz7wASxevBhr167F9ddfj5/85Ce49dZbceKJJ05o0xe+8AUsXrx4wue77LJL6P9vf/vbcfbZZ4c+a2homPC973znOxOA0oEHHji1gQLwpz/9CXfeeSfe+9737vDaZ599Fm9729uwbds2nHfeedh///3R39+Pm2++Ge9617vwyU9+EpdffvmE751++un467/+a1QqFTz33HP49re/jbe+9a145JFHsNdee024vr6+Hj/60Y/wqU99KvT5nXfeud328TlW9t1339D/582bhy9/+csAxnRt1apVuPPOO/HDH/4Qp556Kn74wx+itrZ2h+PhxctrJoEXL9NUPvzhDweTqfCaNWsCAMFJJ50UAAgef/zx0N9vvvnmoLa2NnjXu94VpNPpKT33hRdeCDKZTLDbbrsFGzdunPD3559/Pvj6178+oZ1XXXXVhGvL5XJw+eWXB+vWrQuCIAhWrVoVpFKpYLfddgu2bt0aunbbtm3BbrvtFqTT6WD16tXu8xtuuCEAEDzyyCM7bDuA4MMf/vB2r/n85z8fAAi2bdu2w/ttT84555ygoaEhWL58ebD33nsH1Wp1u20ZGRkJ9txzzyCVSgUPP/xw6NpyuRycdtppAYDg1ltvdZ9zni+//PLQ9ffcc08AIPjQhz4U2beTTjopeNOb3jShzW9/+9uD9773vRPaNtlzouSII44I9thjjwmfl8vl4O///u8DAMGnPvWpHd7Hi5fXUnyawMurJhs2bMAHPvABdHV1ob6+HosXL8aHPvQh/N///R9isRi+//3vT/jOL3/5S8RisUhK+OXIX/3VX2Hx4sW45ZZbQp/ffPPNeOc734nW1tYp3/NrX/saBgYGcP3112POnDkT/r7LLrvgH//xHwEA69evx3e/+128/e1vx8c+9rEJ1yYSCXzyk590rMDll1+OwcFBfO9730NHR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77rgDTU1N7v9RRYY7K2eeeSYuvfRSfOELX8AJJ5yAWCw24ZpCoTClvqt8/vOfx+c//3n3/0wmgyuuuGJSMACMgcR/+7d/wyOPPIKWlhY88sgjuOyyy7b7/A9+8IM45ZRTJny+++67b/d7KizKtGDOi5fXUzwY8PKKy7Zt25DP510EFCX77LMPdtttN9x2220ODNx2221ob2/HUUcd9Yq36YwzzsAVV1yBj3/84/jd736Hz3zmMy/rPnSOO2vIp3I9Hd2Orp0MNBxwwAGR4MvKvHnzcPTRR+/wusMPPxzt7e07vG5nhOzAOeecg7vuuityN0RjYyO6u7u3e5/J+k4nXSqVcN999+Gaa65BpVLZ7r323Xdf7LbbbrjlllvQ3NyMzs7OHeresmXLdmrsticDAwORffDi5fUUnybw8rrJaaedhvvvv9/lrH/+85/jve99L2pqXnmMevrpp6O7uxvnn38+2tra8I53vONl3aepqQldXV148sknd+r63XbbDcDY9rodSTabxZw5c/DEE09s97onnngCc+fODUXt00HOPPNM7LLLLpPWDqxYsQK5XA4vvfTSpPfg2NhInE76+OOPx5VXXomPf/zj+Od//ucd0vdnnHEGbrvtNtxyyy047bTTEI+/+iaRumO3fHrx8nqKBwNeXnHp6OhAU1PTDh3maaedhnK5jDvuuAP33HMP8vk83ve+970qbVqwYAEOOeQQ/PrXv8Ypp5zyZwGO448/HqtXr4481MbKsccei0QigR/+8Ic7fe81a9ZMWlz24IMPYu3atTj++OOn1OY3gpAdePzxx/Gzn/1swt/Zpx/84AeR38/n8/jZz36G3XbbbYeO9LOf/SwaGxsnnC9h5YwzzsCmTZvw3HPPvWq7CFQqlQpuueU
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAFCCAYAAABsN94DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXB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btm1z1z/3uc9FAKJ77703dv/b3/72CED0xS9+MXb93HPPjY477rjYtfHx8WjdunVRa2trNDMzs7iKCAgISESYJggI+H/Ys2cPXvva16Kvrw/Nzc3YsGED/vRP/xT//d//jVQqhc9//vPznvnWt76FVCqFO+6440nJw+/93u9hw4YNuPXWW2PXb7nlFjzvec9DV1fXIaf5/ve/H6VSCZ/97GexcuXKeb8fddRR+J//838CAHbv3o1PfepT+IM/+AO86U1vmndvJpPBW97yFucVuOGGG1CpVPDpT38avb29sXt7enrwqU99CuVyGe9///sXzOfZZ58NYHY6YyFks1mceuqpKBaLOHDgwIL3BwQE1EcgAwEBAPr7+3Haaafhtttuw2WXXYaPfvSjeOUrX4nvf//72Lx5MzZu3IgvfelL85774he/iM7OTlxwwQVPWl4uv/xy3HbbbYj+3+niAwMDuPPOO3HFFVccVnrf+MY3sHHjRpx55pkL3vvNb34TMzMzeOUrX7notNevX+8UucU555yD9evX41//9V8XTGvHjh0AgM7OzkW9m3EWHR0di7o/ICAgGYEMBAQA+Mu//Evs27cP3//+9/GhD30IV199Nd797nfjoYceQnt7Oy677DJ8+9vfxvDwsHtmamoK//zP/4yLL74YjY2NT1perrjiCuzcuRM//OEPAQBf+tKXkM1m8eIXv/iQ0xobG8OePXtwwgknLOr+hx9+GAAWdf/o6Cj6+/tx0kkn1b3vxBNPxO7du1EsFuc9PzAwgN27d+MrX/kKrrvuOjQ3N+OFL3zhvDSq1SoGBgYwMDCARx99FG9729tw33334QUveAFyudyiyhYQEJCMQAYCljxqtRq+9rWv4UUvehFOOeWUeb+nUilcdtllmJ6exle/+lV3/c4778TIyAguu+yyJzU/xx13HE488UT80z/9EwDg1ltvxR/+4R+ipaXlkNMaGxsDALS2tj7p91O5L3Qvf2faxPnnn4/e3l6sWbMGL3vZy5DP5/H1r3/dTUEoHnnkEfT29qK3txfHHnssbrjhBrz4xS/GTTfdtJhiBQQELIBABgKWPA4ePIixsTEcf/zxifecdNJJOPbYY/HFL37RXfviF7+Inp4ePOc5z3nS83TFFVfg9ttvx2OPPYYf/ehHhz1F0NbWBgDzrPIn434q+YXuTSINn/jEJ/Dtb38bX/7yl/GCF7wAAwMDaG5u9qaxfv16fPvb38a3vvUtfPKTn8SqVatw8ODBw15dERAQEEcgAwEBi8Rll12G7373uxgYGMDk5CS+/vWv46UvfSkaGp78FbqXX345BgYGcNVVV6G7uxvPfe5zDyudtrY29PX14YEHHljU/cceeywA4Be/+MWC97a3t2PlypW4//776953//33Y9WqVY5oEKeddhrOP/98vPSlL8XXv/51HH/88bjiiitQKpXmpZHP53H++efjuc99Lv70T/8U//f//l/893//N97xjncsqlwBAQH1EchAwJJHb28v2traFlSYl112GWZmZvCVr3wF3/zmNzE2NoY/+qM/+rXkae3atTjrrLPwve99D5dccsmvRDhe+MIXYtu2bfjP//zPBe99/vOfj0wmgy984QuLTnv79u24++67vb/fdddd2LFjhzcOQJHJZPA3f/M36O/vx8c//vEF33viiSfiFa94BT71qU9h586di8prQEBAMgIZCFjySKfTuOiii/CNb3zDu7seo/q3bNmCE044AV/84hfxxS9+EStXrsQ555zj7hsYGMAjjzyCSqXypOTr+uuvx7ve9S688Y1v/JXSedvb3oZ8Po8/+ZM/wf79++f9vm3bNnzkIx8BAKxZswZXXXUV7rzzTnzsYx+bd2+tVsMHPvAB7N69GwDw1re+FblcDldffTUGBwdj9w4NDeH1r389Wlpa8Na3vnXBfJ533nk47bTT8OEPfxgTExOLKtf09DQ++MEPLnhvQEBAfYQdCAMCALz3ve/FnXfeiXPPPReve93rsGXLFuzduxe333477r77brd87bLLLsP/9//9f8hms3jta1+LdHqOT3/84x/Hddddh+9+97s477zzfuU8nXvuuTj33HN/5XQ2bdqEW2+9FZdddhm2bNkS24HwRz/6EW6//Xa8+tWvdvd/4AMfwLZt2/Dnf/7n+OpXv4oXvvCF6OzsxM6dO3H77bfjkUcecR6Ro48+Gp///Ofx8pe/HCeccMK8HQgHBgbwT//0T9i0adOi8vrWt74Vl1xyCW666Sa8/vWvr3vv0572NLzgBS/AP/zDP+Caa65Bd3f3YddRQMCSx29716OAgKcKnnjiiejKK6+Ment7o+bm5mjjxo3RG97whmhyctLds3Xr1ghABCC6++67Y8+/613vigBE3/3ud73pL2YHwhtuuKFuHl/1qlcd8g6ExC9/+cvoqquuitavXx81NTVFra2t0VlnnRV97GMfiyYmJmL3zszMRP/wD/8QnX322VF7e3vU2NgYrVu3LnrNa14T/fSnP52X9v333x9dfvnl0cqVK6PGxsZoxYoV0eWXXx794he/mHdv0g6EURRF1Wo12rRpU7Rp0ya3s6BvB0Lie9/7XgQgete73nXoFRIQEOCQiqL/5wMNCAgICAgIWJIIMQMBAQEBAQFLHCFmICDgCEWpVPIuw1P09vYik8n8hnIUEBBwpCKQgYCAIxR/93d/h+uuu67uPdu3b8f69et/MxkKCAg4YhFiBgICjlA8/vjjePzxx+ve86xnPSvs0hcQELAgAhkICAgICAhY4ggBhAEBAQEBAUscgQwEBAQEBAQscQQ
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAFCCAYAAABsN94DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9eZicVZk2fldVL9Vd1dV70unsCQlENpV12GUYEVmGRWBARVAR53NU3L/RQUEBF0YRV5RhhIkgiOIC8zmiIyjg4ICgyGoICVk6W++1dHVXV72/P/p3n77fp99KupEt9rmvq65Oqt7lvOc853nuZznnjQVBEMDDw8PDw8Nj1iL+cjfAw8PDw8PD4+WFJwMeHh4eHh6zHJ4MeHh4eHh4zHJ4MuDh4eHh4THL4cmAh4eHh4fHLIcnAx4eHh4eHrMcngx4eHh4eHjMcngy4OHh4eHhMcvhyYCHh4eHh8cshycDHh4eHh4esxyeDHjslojFYtP63HPPPVi/fr37/+WXXx55vTe/+c2IxWJIp9PPqz1r167FRRddhGXLliGZTCKTyeDwww/HNddcg5GRkdCx5XIZ3/nOd3DMMcegra0N9fX1WLJkCS644AI89NBDU679+OOP4y1veQvmz5+P+vp6dHd3481vfjMef/zxKcfecMMNoeevqanB/Pnzcf7552Pz5s1Tjj/mmGNCxzc0NGC//fbDl7/8ZVQqlRn3A6938sknT/mN4/Cv//qvU37bsGED3v3ud2PJkiWor6/HnDlzcOqpp+L++++fcuw999wTanMikcCcOXPwpje9CU8++eSU488//3zEYjFkMpkpYwEAa9ascdfSttn72M8tt9zijl2yZIn7Ph6Po6WlBfvuuy/e9a534Xe/+920+8/D4+VCzcvdAA+P54PVq1eH/v8f//Ef+MUvfjHl+1WrVjkDkEwm8b3vfQ//8i//Ejomn8/jJz/5CZLJ5PNqy3/+53/izDPPRH19Pc477zzss88+GBsbw3333YePfOQjePzxx/Htb38bADAyMoLTTz8d//Vf/4WjjjoKH//4x9HW1ob169fj+9//Pm688UZs2LABCxYsAADcfvvtOOecc9DW1oZ3vOMdWLp0KdavX4/rr78eP/jBD3DLLbfgtNNOm9KmT3/601i6dCmKxSIeeOAB3HDDDbjvvvvw2GOPTXnOBQsW4LOf/SwAoLe3FzfffDM+8IEPYMeOHbjiiiueV5/ceeed+P3vf48DDjhgl8fef//9eOMb3wgAeOc734lXvepV2Lp1K2644QYceeSRuOaaa/De9753ynnve9/7cNBBB6FUKuHRRx/Ftddei3vuuQePPfYYurq6QsfW1NSgUCjgjjvuwFlnnRX67aabbkIymUSxWIxsH+9j8Td/8zeh/7/61a/Ghz70IQBANpvFk08+idtuuw3XXXcdPvCBD+BLX/rSLvvCw+NlQ+Dh8VeA97znPUE1cV63bl0AIDj99NMDAMEf/vCH0O833XRTUFtbG5x88slBKpWa0X2fffbZIJ1OB3vttVfQ09Mz5fc1a9YEX/7yl6e08+qrr55y7Pj4eHDVVVcFGzduDIIgCJ555pmgsbEx2GuvvYLt27eHjt2xY0ew1157BalUKli7dq37/jvf+U4AIHjwwQdDx3/sYx8LAAS33npr6Pujjz462HvvvUPfjYyMBIsXLw6ampqC8fHx6XWEXG/RokVBa2trcPLJJ4d+4zhcddVV7rv+/v6gq6srmDt3bvDMM8+Eji8UCsGRRx4ZxOPx4P7773ff33333QGA4Lbbbgsd/81vfjMAEHz+858Pff+2t70tSKVSwetf//rg1FNPndLmFStWBGecccaUtlW7TxQWL14cnHjiiVO+LxQKwamnnhoACL7xjW/s8joeHi8XfJrA4yXB5s2b8Y53vAPd3d2or6/H0qVL8Y//+I/43//9X8RiMdx4441Tzvn5z3+OWCyGO++88wVpw9/8zd9g6dKluPnmm0Pf33TTTXjDG96Atra2GV/zC1/4AnK5HK6//nrMmzdvyu977LEH3v/+9wMANm3ahG9961v4u7/7O1x88cVTjk0kEvjwhz/sogJXXXUVCoUCvv3tb6OzszN0bEdHB771rW8hn8/jC1/4wi7beeSRRwKYSGfsCslkEgcddBCy2Sy2b9++y+Mtmpqa8IEPfAB33HEHHn744Z0e+61vfQtbt27FVVddheXLl4d+a2howI033ohYLIZPf/rTu7zvrp7x3HPPxc9+9jMMDg667x588EGsWbMG55577i6v/3zQ0NCA1atXo62tDVdccQUC/5JYj1coPBnweNHR09ODgw8+GLfccgvOPvtsfOUrX8Fb3/pW/PrXv8bKlSuxbNkyfP/7359y3q233orW1lYcf/zxL1hbzjnnHNxyyy1OKff29uKuu+563sbgjjvuwLJly3DYYYft8tif/exnGB8fx1vf+tZpX3vJkiXOyFkcddRRWLJkCf7zP/9zl9dav349AKC1tXVa92Z+v6WlZVrHW7z//e9Ha2srLr300p0ed8cddyCZTE4J3RNLly7FEUccgV/96leR+X7bZqD6M55++umIxWK4/fbb3Xc333wz9tprL7z2ta+tet1sNove3t4pn+ka9nQ6jdNOOw2bN2/GE088Ma1zPDxeangy4PGi45//+Z+xdetW/PrXv8bVV1+Niy66CJ/+9KfxxBNPoLm5GWeffTZ+8YtfYGBgwJ0zNjaGH/3oRzjttNNQW1v7grXl3H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//iP/3//4f/vd///d5kyTF+9//frS0tOCyyy6L/H3VqlV4+umnMTo6WvUajz76KGpra7FixYrQ9zTSp556Km688UaccsopuPDCC7Fx48aq16qvr8fpp5+OG2+8ET/60Y9etMJBC8rIHnvs8ZLcz8NjpvBkwONFRWdnJzKZzC4N5tlnn43x8XH88Ic/xM9
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAFCCAYAAABsN94DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOx9aZhlVXn1uvfWcG/dW7fm7urquZtuaAZBGcMMURFRA4YhYBiMARKNeZwSv6gkYJBEifApBonEiLYQCA6oPEHRiAwiBkRARqHppofqqcY71XCH8/2ob+1a561T3VUISll7PU89VXWHc/b4vutd+937xIIgCODh4eHh4eExbxH/XRfAw8PDw8PD43cLTwY8PDw8PDzmOTwZ8PDw8PDwmOfwZMDDw8PDw2Oew5MBDw8PDw+PeQ5PBjw8PDw8POY5PBnw8PDw8PCY5/BkwMPDw8PDY57DkwEPDw8PD495Dk8GPDw8PDw85jk8GfDweJUQi8Vm9POTn/wEmzZtcv9feeWVkdd717vehVgshkwmM+uy/OpXv8KZZ56J5cuXI5lMYvHixXjTm96E6667bspny+UyPv/5z+Pwww9Hc3MzMpkMDj/8cFx33XWoVCpTPr9ixQpX9ng8jtbWVhx00EG45JJL8POf/3zatvmrv/or97/W3/4cddRR7nMXXXTRtJ/7/ve/P+t28fDwmEDd77oAHh6/r1i/fn3o/6997Wv44Q9/OOX1devWYWRkBACQTCbxn//5n/jEJz4R+kyxWMR3vvMdJJPJWZfjwQcfxEknnYRly5bh4osvRnd3N7Zs2YKHHnoIn/vc5/D+978/dJ/TTjsN9957L972trfhoosuQjwex/e//3389V//Ne644w5873vfQ1NTU+gehxxyCD784Q8DAPL5PJ555hncfvvtuPHGG/HBD34Q11xzzYzKeu655+Ktb31r6LWurq7Q/42Njfj3f//3Kd89+OCDZ3QPDw+PCAQeHh6/Fbzvfe8LpptyGzduDAAE73znOwMAwWOPPRZ6/+abbw7q6+uDt7/97UE6nZ7Vfd/61rcGXV1dweDg4JT3du7cGfr/kksuCQAE11133ZTPfuELXwgABO9973tDry9fvjw47bTTpny+VCoFp59+egAguP7660PvAQje9773uf9Z/6uvvnqPdbnwwgtnXX8PD4+9wy8TeHj8f2zbtg3vec970NPTg8bGRqxcuRJ/+Zd/if/93/9FLBbDV7/61Snf+cEPfoBYLIY777zzFSnDH/zBH2DlypW45ZZbQq/ffPPNeMtb3oL29vZZX3PDhg044IAD0NraOuW9BQsWuL+3bt2KL3/5yzj55JNDEj7xvve9DyeddBK+9KUvYdu2bXu9byqVwvr169He3o5PfepTCPwDUj08XrPwZMDDA0Bvby+OOOII3HrrrTjnnHPw+c9/Hueffz7uvfderF27FqtWrcJ//dd/Tfnebbfdhra2NpxyyimvWFnOPfdc3Hrrrc559vX14e6778Z55533sq63fPly/OIXv8CTTz65x8/dddddqFaruOCCC6b9zAUXXIBKpTLj9flMJoMzzjgD27Ztw9NPP73Xz5dKJfT19YV+yuXylM/ZzwwPD8+oPB4eHtHwZMDDA8Df/d3fYceOHbj33ntx7bXX4tJLL8UnP/lJPP3002hpacE555yDH/7whxgcHHTfGR8fx7e//W2cccYZqK+vf8XKct5552Hz5s346U9/CgD4r//6LySTSbzjHe94Wdf7yEc+glKphEMOOQRHH300PvrRj+Luu++e4mTprPe09s73ZuLYiQMPPBDAhEKxN/zDP/wDurq6Qj9sB6JYLE75zB/90R/NuDweHh5T4RMIPeY9arUa7rjjDrz97W/HYYcdNuX9WCyGc845B//0T/+Eb33rW3jPe94DALj77rsxNDSEc8455xUtzwEHHIDXve51+M///E8ce+yxuOWWW/BHf/RHU5L2Zoo3velN+NnPfoZ/+qd/wg9+8AP87Gc/w2c+8xl0dXXh3//93x3JyOfzAIDm5uZpr8X3+NmZgLsfZvKdSy65BGeddVboNUtOkskkvve974Vea2trm3F5PDw8psKTAY95j927dyOXy7kINgoHH3ww9ttvP9x2222ODNx2223o7OzEySef/IqX6bzzzsNnP/tZfPCDH8SDDz6Ij33sY7/R9Q4//HB861vfwvj4OB5//HF8+9vfxrXXXoszzzwTjz32GPbff/8ZOXq+p7kGe0OhUACwZ5JBrFmzBm984xv3+JlEIrHXz3h4eMwOfpnAw2OGOOecc3DPPfegr68PY2Nj+O53v4s//uM/Rl3dK8+pzz33XPT19eHiiy9GR0cH3vzmN78i121oaMDhhx+Oq666Cl/84hdRLpdx++23AwD2339/AMATTzwx7ff53qpVq2Z8T+Yq7LPPPi+32B4eHq8yPBnwmPfo6upCNpvda4LdOeecg0qlgm9+85u46667kMvl8Cd/8ievSpmWLVuGY445Bj/5yU9w1llnvSqEg0si27dvBwCceuqpSCQSU85BUHzta19DQ0PDjNfoC4UCvv3tb2Pp0qVYt27db15oDw+PVwWeDHjMe8TjcZx++un43ve+h0ceeWTK+8zqX7duHQ466CDcdtttuO2227Bo0SIcf/zx7nN9fX149tlnUSqVXpFyXXnllfiHf/iH0KFALwf33HNP5La+//7v/wYA7LvvvgCAJUuW4D3veQ9+9KMf4Ytf/OKUz99www348Y9/jEsvvRQdHR17ve/IyAjOP/98DAwM4OMf/zhisdhvVA8PD49XDz5nwMMDwFVXXYW7774bJ5xwAi655BKsW7cO27dvx+23344HHnjA7dE/55xz8Pd///dIJpN4z3veg3h8kk9/4QtfwBVXXIF77rkHJ5544m9cphNOOAEnnHDCb3yd97///SiVSjjjjDOw3377YXx8HA8++CBuu+02rFixAu9+97vdZ6+55ho8++yzeO9734vvf//7eMtb3gJg4jyF73znOzj55JNx9dVXT7nHtm3b8PWvfx3AhBrw9NNP4/bbb8eOHTvw4Q9/GJdeeulvXA8PD49XD54MeHgAWLx4MX7+85/jsssuw80334xcLofFixfj1FNPDWXxn3POOfjEJz6BUqn0iu8ieLXwL//yL7j99tvx3//93/jSl76E8fFxLFu2DO9973vxiU98InQYUTqdxo9+9CNcf/31WL9+vduWCAAXXngh/uM//iNEgIjHHnsM559/PmKxGJqbm7F06VK8/e1vx5//+Z/jiCOO+G1V1cPD42UiFvhjwTw8PPaAXC6HE044ARs2bMB9992HQw455HddJA8Pj1cYngx4eHjsFTt27MDRRx+N0dFR/OxnP8Py5ct/10Xy8PB4BeHJgIfHHEWhUHB7+KdDV1cXEonEb6lEHh4ecxU+Z8DDY47iX/7lX3DFFVfs8TMbN27EihUrfjsF8vDwmLPwyoCHxxzFiy++iBdffHGPnzn22GORTCZ/SyXy8PCYq/BkwMPDw8PDY57DHzrk4eHh4eExz+HJgIeHh4eHxzyHJwMeHh4eHh7zHJ4MeHh4eHh4zHN4MuDh4eHh4THP4cmAh4eHh4fHPIcnAx4eHh4eHvMcngx4eHh4eHjMc3gy4OHh4eHhMc/hyYCHh4eHh8c8hycDHh4eHh4e8xyeDHh4eHh4eMxzeDLg4eHh4eExz+HJgIeHh4eHxzyHJwMeHh4eHh7zHJ4MeHh4eHh4zHN4MuDh4eHh4THP4cmAh4eHh4fHPIcnAx4eHh4eHvMcngx4eHh4eHjMc3gy4OHh4eHhMc/hyYCHh4eHh8c8hycDHh4eHh4e8xyeDHh4eHh4eMxzeDLg4eHh4eExz+HJgIeHh4eHxzyHJwMeHh4eHh7zHJ4MeHh4eHh4zHN4MuDh4eHh4THP4cmAh4eHh4fHPIcnAx4eHh4eHvMcngx4eHh4eHjMc3gy4OHh4eHhMc/hyYCHh4eHh8c8hycDHh4eHh4e8xyeDHh4eHh4eMxzeDLg4eHh4eExz+HJgIeHh4eHxzyHJwMeHh4eHh7
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAFCCAYAAABsN94DAAAAOXRFWHRTb2Z0d2F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qdctyGhgYccsghuOKKK/DNb34T5XIZN910EwBg7733BgA89NBDU36f/9ttt91mfE7WKuy+++7P9bJfcLz//e9Ha2srLr300sj/r1q1Ck888QRGR0enPMZDDz2E+vp6rFy5MvQ+nfSpp56K7373u3jDG96A888/H+vXr5/yWI2NjXjjG9+I7373u/jJT37yghUOWuwKfeUxt+HJgMcLhq6uLmSz2R0W2J111lmoVCr40Y9+hNtuuw25XA7/+I//+IJc05IlS3DkkUfirrvuwhlnnPGCEA6mRDZv3gwAOOmkk5BIJCbtg6D43ve+h4aGhhnn6BkNL168GKtWrXr+F/0CgerAzTffjD/96U+T/v/6178epVLJESeLdevW4Z577sEJJ5yApqamac/1uc99DqVSCZdffvm0nzvnnHPwpz/9Cfl8/gUbZ4pdpa885jY8GfB4wRCPx3Hqqafilltuwf333z/p/6zGXrVqFfbbbz/ceOONuPHGG7FgwQIcc8wx7nO9vb14/PHHUSwWd8p1XXbZZfj0pz8duZHNbHDnnXdGVpT/z//8DwBgzz33BAAsWrQI73jHO/CrX/0K3/zmNyd9/uqrr8Ydd9yBCy+8EB0dHTs878jICM4991z09/fjE5/4BGKx2PO6jxcaF110EVp
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"img = cv.imread(r'images/roi.jpg', cv.IMREAD_GRAYSCALE)\n",
"assert img is not None, \"file could not be read, check with os.path.exists()\"\n",
"img2 = img.copy()\n",
"template = cv.imread('images/messi_face.jpg', cv.IMREAD_GRAYSCALE)\n",
"assert template is not None, \"file could not be read, check with os.path.exists()\"\n",
"w, h = template.shape[::-1]\n",
"# All the 6 methods for comparison in a list\n",
"methods = ['cv.TM_CCOEFF', 'cv.TM_CCOEFF_NORMED', 'cv.TM_CCORR',\n",
" 'cv.TM_CCORR_NORMED', 'cv.TM_SQDIFF', 'cv.TM_SQDIFF_NORMED']\n",
"for meth in methods:\n",
" img = img2.copy()\n",
" method = eval(meth)\n",
" # Apply template Matching\n",
" res = cv.matchTemplate(img,template,method)\n",
" min_val, max_val, min_loc, max_loc = cv.minMaxLoc(res)\n",
" # If the method is TM_SQDIFF or TM_SQDIFF_NORMED, take minimum\n",
" if method in [cv.TM_SQDIFF, cv.TM_SQDIFF_NORMED]:\n",
" top_left = min_loc\n",
" else:\n",
" top_left = max_loc\n",
" bottom_right = (top_left[0] + w, top_left[1] + h)\n",
" cv.rectangle(img,top_left, bottom_right, 255, 2)\n",
" plt.subplot(121),plt.imshow(res,cmap = 'gray')\n",
" plt.title('Matching Result'), plt.xticks([]), plt.yticks([])\n",
" plt.subplot(122),plt.imshow(img,cmap = 'gray')\n",
" plt.title('Detected Point'), plt.xticks([]), plt.yticks([])\n",
" plt.suptitle(meth)\n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGQCAYAAACEfJsAAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9Sayl63rXCf7e7mtWs9tozz3NbWxsDKQBG5wFWaksJUpKJSFRg1JKKZVSDIABRkKegJEAwcTKWQ4SiWGWRJZEDcwElRgUpSQFlaos2SJpjM299m3OiTgnut2s9mvepgbP+31r7R074kTce0+cc537kSLWXmt962ve9mn+z/9RKaXErdzKrdzKrdzKrdzKV0j0l30Dt3Irt3Irt3Irt3Ir1+VWQbmVW7mVW7mVW7mVr5zcKii3ciu3ciu3ciu38pWTWwXlVm7lVm7lVm7lVr5ycqug3Mqt3Mqt3Mqt3MpXTm4VlFu5lVu5lVu5lVv5ysmtgnIrt3Irt3Irt3IrXzm5VVBu5VZu5VZu5VZu5SsntwrKrdzKrdzKrdzKrXzl5FZBuZVbu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iSFDGmHDI1DIv0YE0OoUmlZdHXAYxJGJPQOoAKJHpS0qPFGKLg4mIKKB1xhcYYhdYp650Kqx2gxtBNiqKOau1kY9WydgyL9jCu98ewtRatdf5O7jeESNt2YqHHNCowKSsHRqkrc3Pc3AadnhzyMko8KFrWhJQU1hmUTsTYAykrPLIuxZRQKWVFiOy9Hc4I4+L1LsaF2g3cxH6YNKAIKJ0wTuU1g7xxBlLyoqA
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"img_rgb = cv.imread('images/mario.jpg')\n",
"assert img_rgb is not None, \"file could not be read, check with os.path.exists()\"\n",
"img_gray = cv.cvtColor(img_rgb, cv.COLOR_BGR2GRAY)\n",
"template = cv.imread('images/mario_template.jpg', cv.IMREAD_GRAYSCALE)\n",
"assert template is not None, \"file could not be read, check with os.path.exists()\"\n",
"w, h = template.shape[::-1]\n",
"res = cv.matchTemplate(img_gray,template,cv.TM_CCOEFF_NORMED)\n",
"threshold = 0.8\n",
"loc = np.where( res >= threshold)\n",
"for pt in zip(*loc[::-1]):\n",
" cv.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (0,0,255), 2)\n",
"cv.imwrite('res.png',img_rgb)\n",
"plt.imshow(cv.cvtColor(img_rgb, cv.COLOR_BGR2RGB))\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 5"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABJsAAAMaCAYAAAAhvEfuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdeXhTZd4+8PskaZM0Tbqk6ZbupaVA2QqURVZHQAF3RUFRREcdlxnXGZ0RF1Rcxm10dEbnnXFcxuWn4i4qDIKiyL6VUqDQfd/XpEmT8/vDt3mNLZC2SU6W+3Ndc13jyck5d6t5er7fnPM8giiKIoiIiIiIiIiIiNxAJnUAIiIiIiIiIiIKHGw2ERERERERERGR27DZREREREREREREbsNmExERERERERERuQ2bTURERERERERE5DZsNhERERERERERkduw2URERERERERERG7DZhMREREREREREbkNm01EREREREREROQ2bDb5gQcffBCCIAzpvf/+978hCAJKS0vdG+pnSktLIQgC/v3vf3vsHERE7rZy5UqkpaVJHYOI/MxA12VpaWlYuXKlW8/DMYqI/AFrQToZNps86NChQ7jyyithNBqhVCqRmJiIK664AocOHZI6miQ2b94MQRDw/vvvSx2FiCTS1wA/2f9+/PFHqSMSUZD55bikUqmQmJiIhQsX4vnnn0dHR4fHzl1dXY0HH3wQ+/bt89g5iMh/sZ4kf6aQOkCgWrduHZYtW4bo6Ghce+21SE9PR2lpKf75z3/i/fffxzvvvIMLL7zQpWPdd999uOeee4aUY8WKFbj88suhVCqH9H4iIk9Ys2YN0tPT+20fMWKE1zL84x//gN1u99r5iMi39Y1LVqsVtbW12Lx5M2677TY888wz+OSTTzBu3DgAw7su+6Xq6mo89NBDSEtLw4QJE5xe4xhFFNzcWU96UmpqKkwmE0JCQqSOQj6GzSYPOH78OFasWIGMjAx8++23MBgMjtd+97vfYdasWVixYgUOHDiAjIyMkx6nq6sLGo0GCoUCCsXQ/lXJ5XLI5fIhvZeIyFPOOeccTJ482eX9e3t7YbfbERoa6rYMvCgiop/75bh07733YtOmTViyZAnOO+88HD58GGq1eljXZYPBMYooeLmrnvSGvjtCiX6Jj9F5wJ///Gd0d3fjlVdecRoYACAmJgYvv/wyurq68OSTTzq29z3/X1hYiOXLlyMqKgozZ850eu3nTCYTfvvb3yImJgZarRbnnXceqqqqIAgCHnzwQcd+A83ZlJaWhiVLlmDr1q3Iz8+HSqVCRkYGXn/9dadzNDc346677sLYsWMRHh4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8eTTz4Js9mMiy++uN/PQUT+bcWKFQCAr7/+2uX3uHINNWrUKKxZswYAcP311+ONN97AG2+8gdmzZw94TI5RRMFjqPXk0qVLYTab8dhjj2HRokV4/vnncf311zvt8+ijj+Kqq65CVlYWnnnmGdx2223473//i9mzZ6O1tdVp35aWFpx99tkYP348nn76aeTk5OAPf/gD1q9ff9qfwWazYeHChdDr9XjqqacwZ84cPP3003jllVcc+wymRiM/JJJbtba2igDE888//5T7nXfeeSIAsb29XRRFUXzggQdEAOKyZcv67dv3Wp/du3eLAMTbbrvNab+VK1eKAMQHHnjAse3VV18VAYglJSWObampqSIA8dtvv3Vsq6+vF5VKpXjnnXc6tpnNZtFmszmdo6SkRFQqleKaNWuctgEQX3311VP+zN98840IQHzvvff6/WzXX3+9Y1tvb6+YlJQkCoIgPv74447tLS0tolqtFq+++mqnfXt6epzO09LSIsbFxYmrVq1ybPvggw9EAOJzzz3n2Gaz2cQzzzyzX/Zf/epX4tixY0Wz2ezYZrfbxRkzZohZWVmn/BmJ6NT6xqSB/qdUKkVR/L8xRafTifX19U7vnzBhghgbGys2NTU5tu3fv1+UyWTiVVdd5dgWEREh3nzzzafMcvXVV4upqamOf/7oo49EAOIjjzzitN8ll1wiCoIgFhcXO7YBEENDQ5227d+/XwQgvvDCC67/QohIcn3j0s6dO0+6T0REhDhx4kRRFPtfl4niT9dWP78+cfUaaufOnSe9huIYRRSchlJP9o1L5513ntM+N910kwhA3L9/vyiKolhaWirK5XLx0Ucfddrv4MGDokKhcNo+Z84cEYD4+uuvO7b19PSI8fHx4sUXX+zYNlAtePXVV4sAnMY7URTFiRMnipMmTXL882BqNPI/vLPJzfpWLNFqtafcr+/19vZ2p+033njjac/Rdwv0TTfd5LT91ltvdTnn6NGjnTrlBoMBI0eOxIkTJxzblEolZLKf/hOx2WxoampCeHg4Ro4c6fQoijtcd911jv8vl8sxefJkiKKIa6+91rE9MjKyX0a5XO6Yw8Vut6O5uRm9vb2YPHmyU8Yvv/wSISEhTneLyWQy3HzzzU45mpubsWnTJixduhQdHR1Od1wsXLgQx44dQ1VVlVt/dqJg9OKLL2LDhg1O//vlt2QXX3yx063jNTU12LdvH1auXIno6GjH9nHjxmH+/Pn44osvHNsiIyOxffv2Qd2F+cUXX0Aul+O3v/2t0/Y777wToij2y3fWWWchMzPTKYdOp3Mao4goMISHhw9qVTpPXENxjCIKDsOpJ39Z2/TVh33XSOvWrYPdbsfSpUud7i6Pj49HVlZWv6lIwsPDceWVVzr+OTQ0FPn5+S6PI7+sbWfNmuX0XldrNPJPnCDczfo+9Ke7IDnZIDLQ6ky/VFZWBplM1m/fwazilJKS0m9bVFQUWlpaHP9st9vxl7/8BS+99BJKSkqcnq/V6/Uun2soeSIiIqBSqRATE9Nv+y9v/37ttdfw9NNPo6ioCFar1bH957+fsrIyJCQkICwszOm9v/ydFRcXQxRFrF69GqtXrx4wa319PYx
"text/plain": [
"<Figure size 1200x800 with 8 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# https://docs.opencv.org/3.4/d9/d61/tutorial_py_morphological_ops.html\n",
"import cv2 as cv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = cv.imread('img/j.png', cv.IMREAD_GRAYSCALE)\n",
"assert img is not None, \"file could not be read, check with os.path.exists()\"\n",
"\n",
"kernel = np.ones((5, 5), np.uint8)\n",
"\n",
"erosion = cv.erode(img, kernel, iterations=1)\n",
"dilation = cv.dilate(img, kernel, iterations=1)\n",
"opening = cv.morphologyEx(img, cv.MORPH_OPEN, kernel)\n",
"closing = cv.morphologyEx(img, cv.MORPH_CLOSE, kernel)\n",
"gradient = cv.morphologyEx(img, cv.MORPH_GRADIENT, kernel)\n",
"tophat = cv.morphologyEx(img, cv.MORPH_TOPHAT, kernel)\n",
"blackhat = cv.morphologyEx(img, cv.MORPH_BLACKHAT, kernel)\n",
"\n",
"titles = ['Original Image', 'Erosion', 'Dilation', 'Opening', 'Closing', 'Gradient', 'Top Hat', 'Black Hat']\n",
"images = [img, erosion, dilation, opening, closing, gradient, tophat, blackhat]\n",
"\n",
"plt.figure(figsize=(12, 8))\n",
"for i in range(len(images)):\n",
" plt.subplot(2, 4, i+1)\n",
" plt.imshow(images[i], cmap='gray')\n",
" plt.title(titles[i])\n",
" plt.axis('off')\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAF1CAYAAAA5u1nDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAADAhklEQVR4nOzdd3gUVdsG8Hv7ZtN7r5ACCRA6SBMpEUURERURRUXBxgsiivVFLIANbCiIiKJYsCEoSFXpvYZACEko6b0n2+b7g3fmy2ZTNoUl6P27rlzK7Ozsmdmdcp5zznNkgiAIICIiIiIiIiIisiP51S4AERERERERERH9+zAoRUREREREREREdsegFBERERERERER2R2DUkREREREREREZHcMShERERERERERkd0xKEVERERERERERHbHoBQREREREREREdkdg1JERERERERERGR3DEoREREREREREZHdMShF/ypz586FTCZr0XtXrlwJmUyG9PT0ti1ULenp6ZDJZFi5cuUV+wwiIrq2TZ48GWFhYVe7GERE/0oymQxz58692sUg+sdgUIquGYmJibj33nsRGBgIjUaDgIAATJw4EYmJiVe7aEREZCdpaWl44oknEBUVBZ1OB51Oh86dO+Pxxx/H8ePHr3bxiIjoGiQ2Ptf+8/HxwdChQ7Fhw4arXTyifzTl1S4AkS1++uknTJgwAR4eHnjooYcQHh6O9PR0fPbZZ/jhhx/w7bffYuzYsU1u58UXX8ScOXNaVIZJkybh7rvvhkajadH7iYioddavX4+77roLSqUSEydORLdu3SCXy3H69Gn89NNP+Pjjj5GWlobQ0NCrXVQiIroGzZs3D+Hh4RAEATk5OVi5ciVuuukmrFu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7VHlJeu1xlZWXIz8/HoEGDUFlZidOnT9e7beByzy9XV1eMGDEC+fn50l/Pnj3h5ORkUX4iImrYRx99hM2bN2Pz5s346quvMHToUEyZMgU//fRTk++tW/cYNGgQCgoKLOonta/zYq+sIUOGIDU11WrId3h4uNVwPFdXV4wZMwbffPONNBLEZDLhu+++w2233ca8iXRNYlCK2jUx2CQGpxpSX/AqPDy8ye2fP38ecrncat2OHTvaXMaQkBCrZe7u7hZ5PMxmMxYtWoTIyEhoNBp4eXnB29sbx48ft7oBERGRJfHaXl5ebvXa0qVLpcpDXUqlEkFBQVbLL1y4gMmTJ8PDwwNOTk7w9vbGkCFDAMDimjxixAj4+/vj66+/BnD5Wv7NN99gzJgxUpnCw8Px1FNPYfny5fDy8kJCQgI++ugji+2cO3cOcrkcnTt3bnQ/ExMTMXbsWLi6usLFxQXe3t7SkJHG7hVnz55FSUkJfHx8LAJ03t7eKC8vR25ubqOfS0REl/Xp0wfDhw/H8OHDMXHiRPz222/o3LkznnjiCej1+kbfW7dO4O7uDgAWdYJdu3Zh+PDhcHR0hJubG7y9vfH8888DsL7ON1SXue+++3DhwgXs2LEDALBlyxbk5ORg0qRJzdtZonaCOaWoXXN1dYW/vz+OHz/e6HrHjx9HYGAgXFxcpGX2mp2ioRn5hFp5rN544w289NJLePDBB/Hqq6/Cw8MDcrkcM2bMgNlstks5iYiuVeK94OTJk1aviTmmak9CIardS1VkMpkwYsQIFBYW4tlnn0VMTAwcHR2RkZGByZMnW1yTFQoF7rnnHnz66adYsmQJdu3ahczMTKvcIu+88w4mT56MtWvXYtOmTZg+fTrmz5+PvXv31hsUq09xcTGGDBkCFxcXzJs3Dx06dIBWq8Xhw4fx7LPPNnqvMJvN8PHxkYJnddWdJIS
"text/plain": [
"<Figure size 1200x800 with 6 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"src = cv.imread('img/notes.png', cv.IMREAD_COLOR)\n",
"assert src is not None, \"Error opening image!\"\n",
"\n",
"if len(src.shape) != 2:\n",
" gray = cv.cvtColor(src, cv.COLOR_BGR2GRAY)\n",
"else:\n",
" gray = src\n",
"\n",
"gray = cv.bitwise_not(gray)\n",
"bw = cv.adaptiveThreshold(gray, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY, 15, -2)\n",
"\n",
"horizontal = np.copy(bw)\n",
"vertical = np.copy(bw)\n",
"\n",
"horizontal_size = horizontal.shape[1] // 30\n",
"horizontalStructure = cv.getStructuringElement(cv.MORPH_RECT, (horizontal_size, 1))\n",
"horizontal = cv.erode(horizontal, horizontalStructure)\n",
"horizontal = cv.dilate(horizontal, horizontalStructure)\n",
"\n",
"vertical_size = vertical.shape[0] // 30\n",
"verticalStructure = cv.getStructuringElement(cv.MORPH_RECT, (1, vertical_size))\n",
"vertical = cv.erode(vertical, verticalStructure)\n",
"vertical = cv.dilate(vertical, verticalStructure)\n",
"\n",
"vertical = cv.bitwise_not(vertical)\n",
"edges = cv.adaptiveThreshold(vertical, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY, 3, -2)\n",
"kernel = np.ones((2, 2), np.uint8)\n",
"edges = cv.dilate(edges, kernel)\n",
"smooth = np.copy(vertical)\n",
"smooth = cv.blur(smooth, (2, 2))\n",
"rows, cols = np.where(edges != 0)\n",
"vertical[rows, cols] = smooth[rows, cols]\n",
"\n",
"titles = ['Original', 'Grayscale', 'Binary', 'Horizontal Lines', 'Vertical Lines', 'Smoothed Vertical']\n",
"images = [src, gray, bw, horizontal, vertical, smooth]\n",
"\n",
"plt.figure(figsize=(12, 8))\n",
"for i in range(len(images)):\n",
" plt.subplot(2, 3, i + 1)\n",
" plt.imshow(images[i], cmap='gray' if len(images[i].shape) == 2 else None)\n",
" plt.title(titles[i])\n",
" plt.axis('off')\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAILCAYAAAA5ey/vAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd3gcxf348ff1O52uSqfee3W3sbHBpjqEYkgg9BJKgGBaIIEkGAjNIQmEHggQTGJaICS0QGJw792SLMtW7+0k3Z2ut/39IXRYLiCbmt93Xs/j57H2dmdnZ8vsfnZmViZJkoQgCIIgCIIgCIIgCIIgfIPk33YGBEEQBEEQBEEQBEEQhP97RFBKEARBEARBEARBEARB+MaJoJQgCIIgCIIgCIIgCILwjRNBKUEQBEEQBEEQBEEQBOEbJ4JSgiAIgiAIgiAIgiAIwjdOBKUEQRAEQRAEQRAEQRCEb5wISgmCIAiCIAiCIAiCIAjfOBGUEgRBEARBEARBEARBEL5xIiglCIIgCIIgCIIgCIIgfONEUEr4Vt17773IZLKjWnbJkiXIZDJaWlq+2kztp6WlBZlMxpIlS762dQiCIAjCkbjiiivIycn5trMhCILwnSCTybj33nu/7WwIgnCURFBKOCq7d+/mkksuIT09HY1GQ1paGhdffDG7d+/+trP2rVi5ciUymYy33nrr286KIAjC/9eam5tZuHAhRUVFxMXFERcXR1lZGTfccANVVVXfdvYEQRCEL2n0xfP+/5KSkjjhhBP48MMPv+3sfaXmzZtHRUXFt50NQfhWKb/tDAj/e95++20uvPBCrFYrV111Fbm5ubS0tPDiiy/y1ltv8frrr3POOeeMK6277rqLO++886jycemll3LBBReg0WiOanlBEAThf8v777/P+eefj1Kp5OKLL2bixInI5XLq6up4++23+dOf/kRzczPZ2dnfdlYFQRCEL+m+++4jNzcXSZLo7e1lyZIlfP/73+e9997jjDPOiM3n8/lQKsVjrSD8rxJnr3BEGhsbufTSS8nLy2P16tXYbLbYbzfffDPHHXccl156KVVVVeTl5R02HY/Hg16vR6lUHnUlolAoUCgUR7WsIAiC8L+lsbGRCy64gOzsbD755BNSU1PH/P7www/zzDPPIJcfvhH4aN0jCIIgfPeddtppTJs2Lfb3VVddRXJyMq+99tqYoJRWq/3G8yZJEn6/H51O942vWxD+fyO67wlH5Pe//z1er5c///nPYwJSAImJiTz33HN4PB5+97vfxaaPjhtVW1vLRRddhMViYc6cOWN+25/P5+Omm24iMTERg8HAWWedRWdn50H9xQ81plROTg5nnHEGa9euZcaMGWi1WvLy8vjrX/86Zh2Dg4PcfvvtVFZWEh8fj9Fo5LTTTmPXrl1fUUl9tm379u3jkksuwWQyYbPZWLRoEZIk0d7ezoIFCzAajaSkpPDII4+MWT4YDHL33XczdepUTCYTer2e4447jhUrVhy0roGBAS699FKMRiNms5nLL7+cXbt2HXI8rLq6Os4991ysVitarZZp06bx7rvvfmXbLQiC8HX43e9+h8fj4aWXXjooIAWgVCq56aabyMzMBEbGXYqPj6exsZHvf//7GAwGLr74YgDWrFnDeeedR1ZWFhqNhszMTG699VZ8Pl8svZdeegmZTMaOHTsOWtdDDz2EQqGgs7MTgPr6en74wx+SkpKCVqslIyODCy64AKfTOWa5pUuXMmPGDOLi4rBYLBx//PH897//jf3+zjvvcPrpp5OWloZGoyE/P5/777+fSCTyheUTjUZ57LHHKC8vR6vVkpyczLXXXsvQ0NA4SlcQBOG7z2w2o9PpDnqhfeAzwug9eENDA1dccQVmsxmTycSPf/xjvF7vmGVfeuklTjzxRJKSktBoNJSVlfGnP/3poHWPPmP85z//Ydq0aeh0Op577jnmzp3LxIkTD5nf4uJi5s+ff8TbKZPJWLhwIW+++SZlZWXodDpmzZpFdXU1AM899xwFBQVotVrmzZt30Pi646njRo2uQ6vVUlFRwT//+c9Djlso6hjh6yRaSglH5L333iMnJ4fjjjvukL8ff/zx5OTk8MEHHxz023nnnUdhYSEPPfQQkiQddh1XXHEFf//737n00kuZOXMmq1at4vTTTx93HhsaGjj33HO56qqruPzyy/nLX/7CFVdcwdSpUykvLwegqamJf/3rX5x33nnk5ubS29sbq1hqa2tJS0sb9/q+yPnnn09paSm//e1v+eCDD3jggQewWq0899xznHjiiTz88MO88sor3H777UyfPp3jjz8eAJfLxQsvvMCFF17INddcw/DwMC+++CLz589n8+bNTJo0CRipJM4880w2b97M9ddfT0lJCe+88w6XX375QXnZvXs3s2fPJj09nTvvvBO9Xs/f//53zj77bP7xj3+Mu9ulIAjCN+3999+noKCAY445ZtzLhMNh5s+fz5w5c/jDH/5AXFwcMHIT7vV6uf7660lISGDz5s08+eSTdHR08OabbwJw7rnncsMNN/DKK68wefLkMem+8sorzJs3j/T0dILBIPPnzycQCHDjjTeSkpJCZ2cn77//Pg6HA5PJBMBvfvMb7r33Xo499ljuu+8+1Go1mzZtYvny5Zx66qnAyMuW+Ph4fvaznxEfH8/y5cu5++67cblc/P73v//cbb322mtZsmQJP/7xj7nppptobm7mqaeeYseOHaxbtw6VSjXuchMEQfgucDqd2O12JEmir6+PJ598ErfbzSWXXDKu5X/0ox+Rm5vL4sWL2b59Oy+88AJJSUk8/PDDsXn+9Kc/UV5ezllnnYVSqeS9997jpz/9KdFolBtuuGFMenv37uXCCy/k2muv5ZprrqG4uJj4+HiuueYaampqxowNtWXLFvbt28ddd911VNu+Zs0a3n333VgeFi9ezBlnnMEvfvELnnnmGX76058yNDTE7373O6688kqWL18eW3Y8dRzABx98wPnnn09lZSWLFy9maGiIq666ivT09IPyI+oY4WslCcI4ORwOCZAWLFjwufOdddZZEiC5XC5JkiTpnnvukQDpwgsvPGje0d9Gbdu2TQKkW265Zcx8V1xxhQRI99xzT2zaSy+9JAFSc3NzbFp2drYESKtXr45N6+vrkzQajXTbbbfFpvn9fikSiYxZR3Nzs6TRaKT77rtvzDRAeumllz53m1esWCEB0ptvvnnQtv3kJz+JTQuHw1JGRoYkk8mk3/72t7HpQ0NDkk6nky6//PIx8wYCgTHrGRoakpKTk6Urr7wyNu0f//iHBEiPPfZYbFokEpFOPPHEg/J+0kknSZWVlZLf749Ni0aj0rHHHisVFhZ+7jYKgiB8W5xOpwRIZ5999kG/DQ0NSf39/bF/Xq9XkiRJuvzyyyVAuvPOOw9aZnSe/S1evFiSyWRSa2trbNqFF14opaWljakvtm/fPubaumPHjoOu/weqr6+X5HK5dM455xxU90Sj0c/N17XXXivFxcWNuW5ffvnlUnZ2duzvNWvWSID0yiuvjFn2o48+OuR0QRCE77LRe/wD/2k0GmnJkiUHzX/gM8LoPfj+98uSJEnnnHOOlJCQMGbaoa678+fPl/Ly8sZMG33G+Oijj8ZMdzgcklarle64444x02+66SZJr9dLbrf7c7d17ty5Unl5+UHbo9FoxjzjPPfccxIgpaSkxJ6xJEmSfvnLXx70PDTeOq6yslLKyMiQhoeHY9NWrlwpAaKOEb5RovueMG7Dw8MAGAyGz51v9HeXyzVm+nXXXfeF6/joo48A+OlPfzpm+o033jjufJaVlY1pyWWz2SguLqapqSk2TaPRxMYdiUQiDAwMEB8fT3FxMdu3bx/3usbj6quvjv1foVAwbdo0JEniqquuik03m80H5VGhUKBWq4GR1lCDg4OEw2GmTZs2Jo8fffQRKpWKa665JjZNLpcf9HZncHCQ5cuX86Mf/Yjh4WHsdjt2u52BgQHmz59PfX19rCuKIAjCd8lofRIfH3/Qb/PmzcNms8X+Pf3002N+v/766w9aZv8xQDweD3a7nWO
"text/plain": [
"<Figure size 1200x1000 with 5 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"\n",
"image_path = 'img/text.png'\n",
"image = cv2.imread(image_path)\n",
"\n",
"assert image is not None, \"Invalid image file or path.\"\n",
"\n",
"gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n",
"blur = cv2.GaussianBlur(gray, (3, 3), 0)\n",
"bw = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]\n",
"\n",
"kernel_size = (15, 1)\n",
"kernel = cv2.getStructuringElement(cv2.MORPH_RECT, kernel_size)\n",
"\n",
"bw_closed = cv2.morphologyEx(bw, cv2.MORPH_CLOSE, kernel)\n",
"\n",
"contours, _ = cv2.findContours(bw_closed, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n",
"\n",
"filtered_contours = [cnt for cnt in contours if (cv2.boundingRect(cnt)[2] / cv2.boundingRect(cnt)[3]) >= 3.0]\n",
"\n",
"sorted_contours = sorted(filtered_contours, key=lambda contour: cv2.boundingRect(contour)[1])\n",
"\n",
"image_with_boxes = image.copy()\n",
"padding = 3\n",
"for contour in sorted_contours:\n",
" x, y, w, h = cv2.boundingRect(contour)\n",
" x, y, w, h = (x - padding, y - padding, w + padding, h + padding)\n",
" cv2.rectangle(image_with_boxes, (x, y), (x + w, y + h), (0, 255, 0), 2)\n",
"\n",
"images = [image, gray, bw, bw_closed, image_with_boxes]\n",
"titles = ['Original Image', 'Grayscale', 'Binary Image', 'Closed Image', 'Detected Text Lines']\n",
"\n",
"plt.figure(figsize=(12, 10))\n",
"for i in range(len(images)):\n",
" plt.subplot(2, 3, i + 1)\n",
" cmap = 'gray' if len(images[i].shape) == 2 else None\n",
" plt.imshow(cv2.cvtColor(images[i], cv2.COLOR_BGR2RGB) if cmap is None else images[i], cmap=cmap)\n",
" plt.title(titles[i])\n",
" plt.axis('off')\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 6"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAz8AAAMWCAYAAADf9ji9AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9fcy2a3YWhB9rndfz7D1CqU0Zph8KbbVKRI3iT2ZioKaKFFOsH3woltpp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PGwK//9b8ef+yP/bEX2mcDFda/xjWucY1rXOPncnzTN30T3vWud+G3/tbf+kJL6p/8yZ/Eb/ttvw1/zV/z1+CbvumbfsbPURTn+ajNBz/4wZ/1vX3FV3wFAOA7v/M7737/7/w7/84L177s5zVexnFFfq7xUo0//sf/OD72sY/hq77qq9707+973/v6wNP3vve9ACrP+Ff+yl+J3/7bfzuePXuGD37wg/jcz/1c/Mv/8r98995XX30V3/d934ev/dqvxXvf+1586EMfwp/4E38Cv+t3/a4XzlHYx7/xb/wb+FN/6k/hve99L/7pf/qfxt/yt/wt+Mmf/En80A/9EP7kn/yT+Mmf/Mmfuwm4xjWucY1rfMaPL/3SL8V/+B/+h/jqr/5q/G1/29+GD3zgA/jiL/5ifPSjH8Uf+SN/BD/+4z+O7/qu78Lf8Df8DT/j5/yCX/AL8GVf9mX49m//dtxuN3zhF34h/qv/6r/CRz7ykZ/1vf1df9ffhV//6389PvjBD+InfuInutW1Min21tmX/bzGyzgu8nONl2q89tprePXVV/EP/AP/wJv+3d3xlV/
"text/plain": [
"<Figure size 1000x800 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"A = cv.imread('img/apple.png')\n",
"B = cv.imread('img/orange.png')\n",
"assert A is not None, \"Apple image could not be read, check with os.path.exists()\"\n",
"assert B is not None, \"Orange image could not be read, check with os.path.exists()\"\n",
"\n",
"A = cv.resize(A, (512, 512))\n",
"B = cv.resize(B, (512, 512))\n",
"\n",
"G = A.copy()\n",
"gpA = [G]\n",
"for i in range(6):\n",
" G = cv.pyrDown(G)\n",
" gpA.append(G)\n",
"\n",
"G = B.copy()\n",
"gpB = [G]\n",
"for i in range(6):\n",
" G = cv.pyrDown(G)\n",
" gpB.append(G)\n",
"\n",
"lpA = [gpA[5]]\n",
"for i in range(5, 0, -1):\n",
" GE = cv.pyrUp(gpA[i], dstsize=(gpA[i-1].shape[1], gpA[i-1].shape[0]))\n",
" L = cv.subtract(gpA[i-1], GE)\n",
" lpA.append(L)\n",
"\n",
"lpB = [gpB[5]]\n",
"for i in range(5, 0, -1):\n",
" GE = cv.pyrUp(gpB[i], dstsize=(gpB[i-1].shape[1], gpB[i-1].shape[0]))\n",
" L = cv.subtract(gpB[i-1], GE)\n",
" lpB.append(L)\n",
"\n",
"LS = []\n",
"for la, lb in zip(lpA, lpB):\n",
" rows, cols, dpt = la.shape\n",
" ls = np.hstack((la[:, :cols // 2], lb[:, cols // 2:]))\n",
" LS.append(ls)\n",
"\n",
"ls_ = LS[0]\n",
"for i in range(1, 6):\n",
" ls_ = cv.pyrUp(ls_, dstsize=(LS[i].shape[1], LS[i].shape[0]))\n",
" ls_ = cv.add(ls_, LS[i])\n",
"\n",
"cols = A.shape[1]\n",
"real = np.hstack((A[:, :cols // 2], B[:, cols // 2:]))\n",
"\n",
"images = [A, B, real, ls_]\n",
"titles = ['Apple', 'Orange', 'Direct Blending', 'Pyramid Blending']\n",
"\n",
"plt.figure(figsize=(10, 8))\n",
"for i in range(len(images)):\n",
" plt.subplot(2, 2, i + 1)\n",
" plt.imshow(cv.cvtColor(images[i], cv.COLOR_BGR2RGB))\n",
" plt.title(titles[i])\n",
" plt.axis('off')\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n",
"\n",
"cv.imwrite('Pyramid_blending.png', ls_)\n",
"cv.imwrite('Direct_blending.png', real)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAMHCAYAAADozuQgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOydd5wkVbm/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LNc6PB6PZziM1L3aykAIQbFYHNUYPJ41la985SuMGTOGv/71r4wdO7bhs3nz5o3YdvLnupFg3333ZYcddqi9P+mkk5g0aRI//elPV2tRaiSPkWfVxJfvrUS+9rWv0d3dzXXXXddwkwMwYcIErr32Wrq6urjssstq03PfkmeeeYajjjqKcePGscsuuzR8Vk+5XOass85iwoQJtLe3c9BBB/H666/3qXdt5imV1wQ/9NBD7LTTThSLRTbaaCN+/OMfN2zj7bff5uyzz2brrbemra2Njo4O9t13Xx5//PEROlI9+/bCCy9wzDHHMGbMGCZOnMh5552HtZZXX32Vgw8+mI6ODiZPnswVV1zRsHwcx3zxi19k++23Z8yYMbS2trLrrrvy4IMP9tnWggULOPbYY+no6GDs2LEcd9xxPP744019Gp577jkOP/xwxo8fT7FYZIcdduD2228fsf32eNYkjDF85StfYfr06RSLRfbee29mz57dMM8ee+zBVlttxd///nd22203Wlpa+NznPgdAtVrl/PPPZ+bMmRQKBdZbbz3OOeccqtVqwzruvfdedtllF8aOHUtbWxubbbZZbR1DjQfgF7/4Bdtvvz2lUokJEyZwzDHH8Prrry9zf6vVKp/61KeYOHFibfx97bXXms77+uuvc+KJJzJp0iQKhQJbbrklP/jBD/rM99prr3HIIYfQ2trKuuuuy6c+9ak+++/xeEaOod6r5fcrzz33HEcccQQdHR2ss846fOITn6BSqfRZ/4033lgbX8aPH8+HP/xhXn311YZ58nHxmWeeYc8996SlpYVp06Y13B9Cc0+p448/nra2Nl5//XUOOeQQ2tramDhxImeffTZa64blh3L/4/Gsbbz00ktsueWWfQQpgHXXXbf2+0Debr2fvwZ6roPBjQ9DYezYsZRKpT5JDJdffjk777wz66yzDqVSie23375fG5Ubb7yRnXbaiZaWFsaNG8duu+3GPffcM+B2r7/+eoIg4DOf+Uxt2mDHm3wMe+mll9hvv/1ob2/n6KOPBpw49elPf5r11luPQqHAZpttxuWXX461trb8cM7H7NmzOf744xk7dixjxozhhBNOoLu7u2HZodzjeYaOz5Raifz6179mgw02YNddd236+W677cYGG2zAHXfc0eezD37wg2yyySZ89atfbfji9eb444/npptu4thjj+Vd73oXv//979l///0HHePs2bM5/PDDOemkkzjuuOP4wQ9+wPHHH8/222/PlltuCcC//vUvbrvtNj74wQ+y4YYbMnfuXK699lp23313nnnmGaZOnTro7S2LD33oQ2y++eZccskl3HHHHXz5y19m/PjxXHvttey1115ceuml/N///R9nn302O+64I7vtthsAS5Ys4Xvf+x5HHnkkp5xyCkuXLuX73/8+++yzD3/5y1/YdtttAfeQeuCBB/KXv/yFj33sY8yaNYtf/epXHHfccX1iefrpp3n3u9/NtGnT+OxnP0trays33XQThxxyCLfccssqkcrv8axKXHLJJUgpOfvss1m8eDGXXXYZRx99NH/+858b5luwYAH77rsvH/7whznmmGOYNGkSxhgOOuggHnroIU499VQ233xznnzySa688kpeeOEFbrvtNsB9Lw844AC22WYbLrzwQgqFArNnz+bhhx8eVjw/+tGPOOGEE9hxxx25+OKLmTt3LldffTUPP/ww//znP5venOacfPLJ3HjjjRx11FHsvPPOPPDAA03H37lz5/Kud70LIQQf//jHmThxInfddRcnnXQSS5Ys4ZOf/CTg/siw99578+9//5uzzjqLqVOncsMNN/DAAw8M/WR4PJ5BMdx7tSOOOIINNtiAiy++mEcffZSvf/3rLFy4sOEPe1/5ylc477zzOOKIIzj55JN56623uOaaa9htt936jC8LFy7k/e9/P4cddhhHHHEEN998M+eeey5bb701++6774D7oLVmn3324Z3vfCeXX3459913H1dccQUbb7wxH/vYx4Ch3f94PGsjM2bM4JFHHuGpp55iq622GtF1N3uuG8r40B+LFy9m/vz5WGuZN28e11xzDZ2dnX2y2q+++moOOuggjj76aOI45mc/+xkf/OAH+c1vftNw3/KlL32JCy64gJ133pkLL7yQKIr485//zAMPPMD73ve+pjFcd911nHbaaXzuc5/jy1/+MjD08SZNU/bZZx922WUXLr/8clpaWrDWctBBB/Hggw9y0kknse222/Lb3/6Wz3zmM7z++utceeWVgzn0TTniiCPYcMMNufjii/nHP/7B9773PdZdd10uvfTS2jyDvcfzDBPrWSksWrTIAvbggw8ecL6DDjrIAnbJkiXWWmvPP/98C9gjjzyyz7z5Zzl///vfLWA/+clPNsx3/PHHW8Cef/75tWk//OEPLWBffvnl2rQZM2ZYwP7hD3+oTZs3b54tFAr205/+dG1apVKxWuuGbbz88su2UCjYCy+8sGEaYH/4wx8OuM8PPvigBewvfvGLPvt26qmn1qalaWqnT59uhRD2kksuqU1fuHChLZVK9rjjjmuYt1qtNmxn4cKFdtKkSfbEE0+sTbvlllssYK+66qraNK213WuvvfrEvvfee9utt97aViqV2jRjjN15553tJptsMuA+ejxrGmeccYbt75+Q/Du9+eabN3wPr776agvYJ598sjZt9913t4D9zne+07COG264wUop7R//+MeG6d/5zncsYB9++GFrrbVXXnmlBexbb73Vb6yDjSeOY7vuuuvarbbaypbL5dp8v/nNbyx
"text/plain": [
"<Figure size 1200x800 with 8 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# https://docs.opencv.org/3.4/d3/db4/tutorial_py_watershed.html\n",
"import cv2 as cv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"\n",
"img = cv.imread('img/coins.jpg')\n",
"assert img is not None, \"Image could not be read, check with os.path.exists()\"\n",
"\n",
"gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n",
"\n",
"_, thresh = cv.threshold(gray, 0, 255, cv.THRESH_BINARY_INV + cv.THRESH_OTSU)\n",
"\n",
"kernel = np.ones((3, 3), np.uint8)\n",
"opening = cv.morphologyEx(thresh, cv.MORPH_OPEN, kernel, iterations=2)\n",
"\n",
"sure_bg = cv.dilate(opening, kernel, iterations=3)\n",
"\n",
"dist_transform = cv.distanceTransform(opening, cv.DIST_L2, 5)\n",
"_, sure_fg = cv.threshold(dist_transform, 0.7 * dist_transform.max(), 255, 0)\n",
"\n",
"sure_fg = np.uint8(sure_fg)\n",
"\n",
"unknown = cv.subtract(sure_bg, sure_fg)\n",
"\n",
"_, markers = cv.connectedComponents(sure_fg)\n",
"\n",
"markers = markers + 1\n",
"\n",
"markers[unknown == 255] = 0\n",
"\n",
"markers = cv.watershed(img, markers)\n",
"\n",
"img[markers == -1] = [255, 0, 0]\n",
"\n",
"titles = ['Original Image', 'Thresholded', 'Opening', 'Sure Background', \n",
" 'Distance Transform', 'Sure Foreground', 'Markers', 'Final Segmentation']\n",
"images = [cv.cvtColor(img, cv.COLOR_BGR2RGB), thresh, opening, sure_bg, \n",
" dist_transform, sure_fg, cv.applyColorMap(cv.convertScaleAbs(markers, alpha=255/markers.max()), cv.COLORMAP_JET), \n",
" cv.cvtColor(img, cv.COLOR_BGR2RGB)]\n",
"\n",
"plt.figure(figsize=(12, 8))\n",
"for i in range(len(images)):\n",
" plt.subplot(2, 4, i + 1)\n",
" cmap = 'gray' if len(images[i].shape) == 2 else None\n",
" plt.imshow(images[i], cmap=cmap)\n",
" plt.title(titles[i])\n",
" plt.axis('off')\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA9AAAAH6CAYAAADvBqSRAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9eZit2VXfh3/PUPOpOqfmqnv79u1RLVrDI5AEwYIIhOWGIIMmy6BgNIAiE1kMQSHkSTCSSRCxkQ2PZMcQwEDUjkGDZYLBDLGIEyQQPMQKQmC6b3ffvkPdqjpVZ6r5DO/vj/p9Vn3Pvud2X8lSN47f9Tz1VNU577D32muvvb5rrb12IcuyTDnllFNOOeWUU0455ZRTTjnllNNTUvHZbkBOOeWUU0455ZRTTjnllFNOOf2HQDmAzimnnHLKKaeccsopp5xyyimn26AcQOeUU0455ZRTTjnllFNOOeWU021QDqBzyimnnHLKKaeccsopp5xyyuk2KAfQ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S8M3fc6tnvOhFL8rW19ezZrMZn/3mb/5mJmmIl//X//V/ZZKyhx9+eOiZ/+pf/auRn+eU0xeT8hTunHJ6Cvqbf/NvDv3/1V/91Xrsscduuu7Vr361zp8/H/9/+Zd/ub7iK75Cv/Zrv/ZFb+NT0Xd+53fG36VSSS95yUuUZZm+4zu+Iz6v1Wp64IEHhvpVKpU0Pj4u6TTKvLu7q16vp5e85CX6oz/6o7juX/2rf6WxsTG97W1vi8+KxaLe8Y53DLVjd3d
"text/plain": [
"<Figure size 1000x500 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# https://docs.opencv.org/4.x/d8/d01/tutorial_discrete_fourier_transform.html\n",
"import cv2 as cv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"image_path = 'img/lena.png'\n",
"I = cv.imread(image_path, cv.IMREAD_GRAYSCALE)\n",
"assert I is not None, \"Image could not be loaded, check the path.\"\n",
"\n",
"rows, cols = I.shape\n",
"m = cv.getOptimalDFTSize(rows)\n",
"n = cv.getOptimalDFTSize(cols)\n",
"padded = cv.copyMakeBorder(I, 0, m - rows, 0, n - cols, cv.BORDER_CONSTANT, value=0)\n",
"\n",
"planes = [np.float32(padded), np.zeros(padded.shape, np.float32)]\n",
"complexI = cv.merge(planes)\n",
"\n",
"cv.dft(complexI, complexI)\n",
"\n",
"planes = cv.split(complexI)\n",
"cv.magnitude(planes[0], planes[1], planes[0])\n",
"magI = planes[0]\n",
"\n",
"matOfOnes = np.ones(magI.shape, dtype=magI.dtype)\n",
"cv.add(matOfOnes, magI, magI)\n",
"cv.log(magI, magI)\n",
"\n",
"magI_rows, magI_cols = magI.shape\n",
"magI = magI[0:(magI_rows & -2), 0:(magI_cols & -2)]\n",
"cx, cy = magI.shape[0] // 2, magI.shape[1] // 2\n",
"\n",
"q0 = magI[0:cx, 0:cy]\n",
"q1 = magI[cx:cx+cx, 0:cy]\n",
"q2 = magI[0:cx, cy:cy+cy]\n",
"q3 = magI[cx:cx+cx, cy:cy+cy]\n",
"\n",
"tmp = np.copy(q0)\n",
"magI[0:cx, 0:cy] = q3\n",
"magI[cx:cx+cx, cy:cy+cy] = tmp\n",
"\n",
"tmp = np.copy(q1)\n",
"magI[cx:cx+cx, 0:cy] = q2\n",
"magI[0:cx, cy:cy+cy] = tmp\n",
"\n",
"cv.normalize(magI, magI, 0, 1, cv.NORM_MINMAX)\n",
"\n",
"images = [I, magI]\n",
"titles = ['Input Image', 'Spectrum Magnitude']\n",
"\n",
"plt.figure(figsize=(10, 5))\n",
"for i in range(len(images)):\n",
" plt.subplot(1, 2, i + 1)\n",
" plt.imshow(images[i], cmap='gray')\n",
" plt.title(titles[i])\n",
" plt.axis('off')\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 7"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAx8AAAHDCAYAAABFx6fYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOydd5Qc1ZX/v51zmOnJOWpGWUikAYNkg9CCHLDBthyQMLYXWAELrA3LGrM22GiNlzWsbcBevOAflnaX5IRIAgE2IBAICWVpRpNz6Omcu+v3h857rq6pTjM9oxHczzk6mq569eq9Ct33vpsUgiAIIAiCIAiCIAiCmGWUp3oABEEQBEEQBEF8PCDlgyAIgiAIgiCIOYGUD4IgCIIgCIIg5gRSPgiCIAiCIAiCmBNI+SAIgiAIgiAIYk4g5YMgCIIgCIIgiDmBlA+CIAiCIAiCIOYEUj4IgiAIgiAIgpgTSPkgCIIgCIIgCGJOIOWDIAiCIAgiB66++mrU1dWd0jEoFAr84Ac/OKVjIIjpQMoHQRAEQRBZ0dXV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Ox1112Hp59+GjfccAMWLVqEiYkJvPnmmzhy5AhWrlyJ733ve3C73ejv78fPfvYzAIDZbAZw0oVrzZo16OjowA033ID6+no89dRTuPrqq+FyufCP//iPfByf+cxnsHv3blx//fVobW3FH//4R2zatEl2TDO5/4x4PI5LL70UF154Ie677z5s3boVN9xwA0wmE773ve/ha1/7Gr7whS/gkUcewcaNG9HW1ob6+vqM14s4hQgEQRAEQRApcLvdAgDh8ssvn7JvcnJSGBsb4/8CgQDft2nTJgGA8M///M9TjhO3Y2zZskVQKBRCT08P3/aVr3xFqKioEOLxON/2wQcfCACExx57TBAEQdi7d68AQHjqqadSzqG9vV1QKpXC5z//+aS+BEEQEolE2nFde+21gtFoFEKhUNLcamtr+ee//vWvAgBh69atSce++OKLstul/Ou//qsAIO2/9evXJx0DQPjXf/1X/tlmswmbN29Oe57169cnjZvxwAMPCACE3/3ud3xbJBIR2traBLPZLHg8HkEQBOGZZ54RAAgPPPAAbxePx4VPfepTSfdEEPJz/1kf9957L982OTkpGAwGQaFQCP/7v//Ltx89enTKNSHmJ+R2RRAEQRBESjweD4C/rZKLWbNmDYqLi/k/5g4j5vrrr5+yzWAw8L/9fj/Gx8dx3nnnQRCEJDerjRs3YnBwEK+99hrftnXrVhgMBlxxxRUAwC0bL730EgKBgOwc/vCHPyCRSOCuu+6aEpeiUChkx+X1ejE+Po4LLrgAgUAAR48ele0bOLmSb7PZsHbtWoyPj/N/q1atgtlsThp/Op555hns2LFjyr/S0tKMx9rtdrz77rsYHBzM6lxinn/+eZSVleErX/kK36bRaHDTTTfB5/PhjTfeAAC8+OKL0Gg0+Pa3v83bKZVKbN68OWXfM7n/jG9961v8b7vdjpaWFphMJnzpS1/i21taWmC329HZ2ZnlrIlTBbldEQRBEASREovFAgDw+XxT9v3qV7+C1+vFyMgIvv71r0/Zr1arUVVVNWV7b28v7rrrLvzpT3+aEhMhjtNYu3YtysvLsXXrVlx00UVIJBL4n//5H3zuc5/j46qvr8ett96K//iP/8DWrVtxwQ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3NyMbdu24Stf+QpaWlp4hXNBENDV1YVt27ZBqVRm5eLU2tqKxsZGfOc738HAwACsViueeeaZtL76GzduxHe+8x0AmOJytXPnTtxwww344he/iAULFiAWi+GJJ56ASqXiQelNTU343ve+h3vuuQcXXHABvvCFL0Cn0+G9995DRUUFtmz
"text/plain": [
"<Figure size 1000x500 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0cAAAHDCAYAAADvBGFkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAADfHUlEQVR4nOydd3hTZf/G76R7lzJa9p6yBAUqypYhorg3DnAC7vn+HLhenCgKThBQUMT5KqCIAi723nuPFgrdK23z/P54+uQkbdomaZKTcX+uq9c5PTk5eZI2ybnP/f3ej0EIIUAIIYQQQgghQY5R7wEQQgghhBBCiC9AcUQIIYQQQgghoDgihBBCCCGEEAAUR4QQQgghhBACgOKIEEIIIYQQQgBQHBFCCCGEEEIIAIojQgghhBBCCAFAcUQIIYQQQgghACiOCCGEEEIIIQQAxREhhBAnGTBgAAYMGKD3MOwye/ZsGAwGHD58WO+hEEII8UMojgghJMA5cOAA7r33XrRq1QqRkZGIj49H3759MXXqVBQWFuo9vGpp0aIFLr/8cru3rVixAgaDAd9++22tHqOgoACTJk3CihUranUcQggh/k+o3gMghBDiORYtWoTrrrsOERERGDNmDDp37gyTyYR//vkHTzzxBHbs2IFPPvlE72G6jdtuuw033ngjIiIiHL5PQUEBXnzxRQDwWUeMEEKId6A4IoSQAOXQoUO48cYb0bx5cyxbtgwNGza03DZ+/Hjs378fixYt0nGEQGlpKcxmM8LDw91yvJCQEISEhLjlWN7CbDbDZDIhMjJS76EQQkjQw7I6QggJUN544w3k5eVh5syZNsJI0aZNGzz00EOW30tLS/Hyyy+jdevWiI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IiUlBTLay6EEM8884zNa0IIIaRqWFZHCCEBSE5ODgAgLi7Oof0XL14MAHj00Udttj/22GMAUG1v0uLFi5GSkoKbbrrJsi0sLAwPPvgg8vLy8Oeff9rsf80111TpqNijd+/eWLp0aaWft956q8b7JiYmAgAWLlyIkpIShx8TAE6dOoXNmzfjjjvusHG3unbtiksvvdTympWVleH333/H6NGj0ahRI8t+bdq0wYgRI+weu3///ujUqVOl7VFRUZb1zMxMZGdn45JLLsHGjRsr7Tt48GCL4wTI1wmQr6/1311tP3jwoCNPmxBCghqW1RFCSAASHx8PAMjNzXVo/yNHjsBoNKJNmzY221NSUpCYmIgjR45Ue9+2bdvCaLS93taxY0fL7da0bNnSoTEp6tWrhyFDhlTaHhpa81dY//79cc011+DFF1/EO++8gwEDBmD06NG4+eaba0y0U+Nu3759pds6duyIJUuWID8/Hzk5OSgsLKz02gGwuw2o+jVYuHAhXnnlFWzevNmm16ti3xIANGvWzOb3hIQEAEDTpk3tbs/MzLT7mIQQQjToHBFCSAASHx+PRo0aYfv27U7dz95JuLuxdkc8jZoHadWqVZgwYQJOnDiBu+66Cz179kReXp7XxlERe6/B33//jSuuuAKRkZH44IMPsHjxYixduhQ333wzhBCV9q8qla+q7faOQQghxBaKI0IICVAuv/xyHDhwAKtWrapx3+bNm8NsNmPfvn0229PT05GVlYXmzZtXe999+/bBbDbbbN+9e7fldr3p06cPXn31Vaxfvx7z5s3Djh07MH/+fABVC0I17j179lS6bffu3ahXrx5iYmLQoEEDREZGYv/+/ZX2s7etKr777jtERkZiyZIluOuuuzBixAi7jhkhhBDPQXFECCEBypNPPomYmBiMGzcO6enplW4/cOAApk6dCgC47LLLAADvvvuuzT5TpkwBgEpJadZcdtllSEtLw9dff23ZVlpaivfffx+xsbHo379/bZ+Ky2RmZlZyTLp37w4AlrK16OhoAEBWVpbNfg0bNkT37t0xZ84cm9u2b9+O3377zfKahYSEYMiQIfjxxx9x8uRJy3779+/HL7/84vBYQ0JCYDAYUFZWZtl2+PBh/Pjjjw4fgxBCSO1gzxEhhAQorVu3xpdffokbbrgBHTt2xJgxY9C5c2eYTCasXLnSErcNAN26dcPtt9+OTz75BFlZWejfvz/Wrl2LOXPmYPTo0Rg4cGCVj3PPPffg448/xh133IENGzagRYsW+Pbbb/Hvv//i3XffdTgUwhPMmTMHH3zwAa666iq0bt0aubm5+PTTTxEfH28RN1FRUejUqRO+/vprtGvXDklJSejcuTM6d+6MN998EyNGjEBqairGjh1rifJOSEiwmQtp0qRJ+O2339C3b1/cf//9KCsrw7Rp09C5c2ds3rzZobGOHDkSU6ZMwfDhw3HzzTfj9OnTmD59Otq0aYOtW7d64NUhhBBSEYojQggJYK644gps3boVb775Jv73v//hww8/REREBLp27Yq3334bd999t2XfGTNmoFWrVpg9ezZ++OEHpKSk4JlnnsELL7xQ7WNERUVhxYoVePrppzFnzhzk5OSgffv2mDVrlkV86YUSefPnz0d6ejoSEhLQq1cvzJs3zyYUYcaMGZg4cSIeeeQRmEwmvPDCC+jcuTOGDBmCX3/9FS+88AKef/55hIWFoX///nj99ddt7t+zZ0/88ssvePzxx/Hcc8+hadOmeOmll7Br1y5LeWFNDBo0CDNnzsRrr72Ghx9+GC1btsTrr7+Ow4cPUxwRQoiXMAh2aBJCCCEeYfTo0dixY0elXi5CCCG+CXuOCCGEEDdQWFho8/u+ffuwePFiDBgwQJ8BEUIIcRo6R4QQQogbaNiwIe644w60atUKR44cwYcffoji4mJs2rQJbdu21Xt4hBBCHIA9R4QQQogbGD58OL766iukpaUhIiICqamp+O9//0thRAghfgSdI0IIIYQQQggBe44IIYQQQgghBADFESGEEEIIIYQACOCeI7PZjJMnTyIuLg4Gg0Hv4RBCCCGEEEJ0QgiB3NxcNGr
"text/plain": [
"<Figure size 1000x500 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAuQAAAHDCAYAAABs5Q92AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZ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N4vf7r1r+4Q9/mHg8Lr/+w3/4D1etY3Zd9F7zcrlMMpnkrrvuAtg0vo985CNUKpVNrwT/8i//knq9zo/92I/JfTmdTp544glSqZTp+B999FFyuRz/8T/+R9xu96bP9JYi/bgKhQLJZJJ77rkHTdN46aWXTPcNVxKBm80m73vf+0gmk/Krt7eXyclJ02hzp/zkT/6k/DkcDrNr1y58Ph/ve9/75PJdu3YRDoev6Rn4xje+wcDAAO9617vkMrfbzU/91E9tGsfRo0e5cOECH/zgB1lfX5fnWCgUeOMb38iTTz5Js9m85vNUKBSKV4P3ve99lEolvv71r5PL5fj6179ualeBzf9HpFIpMpkM995776Z/U8Xb0L/927/d8t/ETCbDW97yFs6ePcsTTzzBgQMHXvb5KBTfL14xQS6EthDmrWgl3IVVoB2zs7NYrdar1p2YmOh4nMPDw1cti0Qim8Ros9nk937v95icnMTlchGLxYjH4xw/fpxMJtPxsQSBQIB8Pn/V8k996lM8+uijm/x3Rsyuy8bGBp/4xCfo6enB4/EQj8flevrxTU1Ncfvtt/Pggw/KZQ8++CB33XWXvGYul4v/+l//Kw8//DA9PT3S3rGysiK3uXTpEgD79u1re55zc3N87GMfIxqN4vf7icfj3H///VeNy8iFCxf
"text/plain": [
"<Figure size 1000x500 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img_gray = cv.imread('img/home.jpg', cv.IMREAD_GRAYSCALE)\n",
"assert img_gray is not None, \"Image could not be loaded, check the path.\"\n",
"\n",
"img_color = cv.imread('img/home.jpg')\n",
"assert img_color is not None, \"Image could not be loaded, check the path.\"\n",
"\n",
"hist_gray = cv.calcHist([img_gray], [0], None, [256], [0, 256])\n",
"\n",
"plt.figure(figsize=(10, 5))\n",
"plt.subplot(1, 2, 1)\n",
"plt.imshow(img_gray, cmap='gray')\n",
"plt.title(\"Grayscale Image\")\n",
"plt.axis('off')\n",
"\n",
"plt.subplot(1, 2, 2)\n",
"plt.plot(hist_gray, color='black')\n",
"plt.title(\"Grayscale Histogram\")\n",
"plt.xlim([0, 256])\n",
"\n",
"colors = ('b', 'g', 'r')\n",
"plt.figure(figsize=(10, 5))\n",
"for i, color in enumerate(colors):\n",
" hist_color = cv.calcHist([img_color], [i], None, [256], [0, 256])\n",
" plt.plot(hist_color, color=color)\n",
" plt.xlim([0, 256])\n",
"plt.title(\"Color Histogram\")\n",
"plt.show()\n",
"\n",
"mask = np.zeros(img_gray.shape[:2], np.uint8)\n",
"mask[100:300, 100:400] = 255\n",
"masked_img = cv.bitwise_and(img_gray, img_gray, mask=mask)\n",
"\n",
"hist_full = cv.calcHist([img_gray], [0], None, [256], [0, 256])\n",
"hist_mask = cv.calcHist([img_gray], [0], mask, [256], [0, 256])\n",
"\n",
"plt.figure(figsize=(10, 5))\n",
"plt.subplot(2, 2, 1)\n",
"plt.imshow(img_gray, cmap='gray')\n",
"plt.title(\"Original Grayscale Image\")\n",
"plt.axis('off')\n",
"\n",
"plt.subplot(2, 2, 2)\n",
"plt.imshow(mask, cmap='gray')\n",
"plt.title(\"Mask\")\n",
"plt.axis('off')\n",
"\n",
"plt.subplot(2, 2, 3)\n",
"plt.imshow(masked_img, cmap='gray')\n",
"plt.title(\"Masked Image\")\n",
"plt.axis('off')\n",
"\n",
"plt.subplot(2, 2, 4)\n",
"plt.plot(hist_full, label='Full Image', color='blue')\n",
"plt.plot(hist_mask, label='Masked Region', color='green')\n",
"plt.xlim([0, 256])\n",
"plt.title(\"Histogram Comparison\")\n",
"plt.legend()\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABB4AAAJOCAYAAAAQ+MT+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPY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MG/Ec1PMZs+ePVxwwQV0dnZy991309LSIvdddtll9PX1cfPNN886p62tjXe+852ztv3v//4vb3/72/ne977HihUr+MAHPjBr/8qVKw85R6F4IaJCLY5xvv3tb5NKpfjZz34264cEQENDA1dccQXJZJJvfetbcruIzdy2bRtvf/vbCYVCnH766bP2aUmn03zkIx+hoaEBn8/H61//egYHBzGZTHzpS1+SxxnFbXZ1dXHuuedy//3386IXvQin00lPTw+//OUvZ11jamqK//iP/2D9+vV4vV78fj+vec1rePLJJ5dopA7e27PPPss73/lOAoEA4XCYz3/+85TLZfbv3895552H3++nubmZ73znO7POz+VyfOELX2Djxo0EAgE8Hg8vfelLueeeew651uTkJBdeeCF+v59gMMjFF1/Mk08+aRhzumPHDt785jdTV1eH0+nk5JNP5i9/+cuS3bdCoVAoXtio3wpLh1GOhx/84Accd9xxuN1uQqEQJ598Mr/97W+BmbH61Kc+BUB3d7d0tRf3XygU+OpXv8ry5ctxOBx0dXXxX//1X2Sz2VnXKJVKfOlLX6K1tRW3281ZZ53Ftm3b6Orq4pJLLpHHifH9+9//zgc/+EEaGxtpb28HYGBggA9+8IOsWrUKl8tFfX09b3nLWw7JtyHauP/++/nIRz5COBwmGAxy6aWXksvliEQiXHTRRYRCIUKhEJ/+9Kcpl8tzjt2NN97IOeecQ2trKw6Hg+XLl/PVr36VYrF4yBivW7eObdu2cdZZZ+F2u2lra5s1PwUHDhzgDW94Ax6Ph8bGRj7+8Y8fMnaV+Na3vkUikeDKK6+cJToIent7+ehHPzpnOy6Xi1/96lfU1dXxta99raaxUCheiCiPh2Ocv/71r3R1dfHSl77UcP/LXvYyurq6DlFsAd7ylrewYsUKvv71r1f9R/KSSy7hj3/8IxdeeCGnnnoqf//73znnnHNq7mNfXx9vfvObefe7383FF1/M//t//49LLrmEjRs3ctxxxwHQ39/PDTfcwFve8ha6u7sZHR3liiuu4IwzzmDbtm20trbWfL25eOtb38qaNWv45je/yc0338z//M//UFdXxxVXXMHLX/5y/vd//5ff/OY3/Md//AennHIKL3vZywCIxWL84he/4G1vexvvfe97icfjXHnllWzevJlHHnmEDRs2ADM/Dl73utfxyCOP8IEPfIDVq1dz4403cvHFFx/Sl61bt/KSl7yEtrY2/vM//xOPx8Mf//hH3vCGN/CnP/2pZrdXhUKhUCgqoX4rVCcejzMxMXHI9loM2J///Od85CMf4c1vfjMf/ehHyWQyPPXUUzz88MO8/e1v501vehPPPvssv/vd7/je975HQ0MDgBSA3vOe93DNNdfw5je/mU9+8pM8/PDDfOMb32D79u38+c9/ltf57Gc/y7e+9S1e97rXsXnzZp588kk2b95MJpMx7NcHP/hBwuEwX/jCF0gmkwBs2bKFBx54gAsuuID29nb27t3LT37yE84880y2bduG2+2e1caHP/xhmpub+fKXv8xDDz3Ez372M4LBIA888ADLli3j61//Orfccgvf/va3Wbdu3SHhBHquvvpqvF4vn/jEJ/B6vdx999184QtfIBaL8e1vf3vWsdPT07z61a/mTW96E//2b//Gddddx2c+8xnWr1/Pa17zGmBG7HrFK17Bvn37+MhHPkJrayu/+tWvuPvuu+d8bjDzvejp6eG0006r6fhqeL1e3vjGN3LllVeybds2OWcBMpnMIfPL5/Mds+FGCsWCKSuOWSKRSBkon3feeVWPe/3rX18GyrFYrFwul8tf/OIXy0D5bW972yHHin2CRx99tAyUP/axj8067pJLLikD5S9+8Yty21VXXVUGynv27JHbOjs7y0D5vvvuk9vGxsbKDoej/MlPflJuy2Qy5WKxOOsae/bsKTscjvJXvvKVWduA8lVXXVX1nu+5554yUL722msPubf3ve99cluhUCi3t7eXTSZT+Zvf/KbcPj09XXa5XOWLL7541rHZbHbWdaanp8tNTU3ld73rXXLbn/70pzJQ/v73vy+3FYvF8stf/vJD+v6KV7yivH79+nImk5HbSqVS+bTTTiuvWLGi6j0qFAqFQjEX6rdCZcRvhWp/Ho9n1jlnnHFG+YwzzpCfzzvvvPJxxx1X9Trf/va3D7nncrlcfuKJJ8pA+T3vec+s7f/xH/9RBsp33313uVwul0dGRspWq7X8hje8YdZxX/rSl8rArN8qYnxPP/30cqFQmHV8KpU6pG8PPvhgGSj/8pe/PKSNzZs3l0ulkty+adOmsslkKr///e+X28TvKO2YVMLo+pdeemnZ7XbP+h10xhlnHNKnbDZbbm5uLp9//vly2/e///0yUP7jH/8otyWTyXJvb28ZKN9zzz0V+xKNRmv6Xmjp7Owsn3POORX3f+973ysD5RtvvFFuqzSv5pqbCsXzERVqcQwTj8eBGdW0GmJ/LBabtf3973//nNf429/+Bswo51o+/OEP19zPtWvXzlplCYfDrFq1iv7+frnN4XBgNs9Mx2KxyOTkJF6vl1WrVvHYY4/VfK1aeM973iPfWywWTj75ZMrlMu9+97vl9mAweEgfLRaLjO0slUpMTU1RKBQ4+eSTZ/Xxb3/7Gzabjfe+971ym9ls5rLLLpvVj6mpKe6++27+7d/+Ta62TExMMDk5yebNm9m1axeDg4NLeu8KhUKheGGhfivMzRe+8AXuuOOOQ/7OPvvsOc8NBoMcOHCALVu2zPu6t9xyCwCf+MQnZm0XyQuFB8p
"text/plain": [
"<Figure size 1200x600 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAeQAAAGHCAYAAABhziENAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9d5Blx3Ufjn9ezjnMm5x2ZzYnLIDFIpAACeYkQSBBF0XTIi3bkmiVLEq2aOkrm0WatqusUrAoS5ZMFSVQtBkgAhIDiLTIwCZs3tnd2cnp5ZzD74/5nd4zvfe+9yYsAIrvVE3NzHv3dvft233C54TWNBqNBjrUoQ51qEMd6tBbStq3egAd6lCHOtShDnWoI5A71KEOdahDHXpbUEcgd6hDHepQhzr0NqCOQO5QhzrUoQ516G1AHYHcoQ51qEMd6tDbgDoCuUMd6lCHOtShtwF1BHKHOtShDnWoQ28D6gj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ij0qlsuaaRqOBarUq2qcxUZ/ULp9vPh6l+aOTiPi7ktuQ3wcRjVmeO7k9+T75oAT+nU6nE/NF19HvdtchPR+tQa1W2/RwBupTrX0+b/V6XVzL14jS+Jo9J70btbHTum2H2i2HID9Ho9FYw1fkdSSvLzXie5e/Oz5f/Lnlv/n+4GuVvqf9zK+V+YvcrtFoRK1WW/Oc1FYz0uv1N41L5rk0L2rvkIh/V61WodfrYTQaYTAYoNFoBB8h3sxJp9NBr9eLOeHPajAY1uxN+pvGQ59z3kTvl9ZtvV5X3BN8PdTrdVQ
"text/plain": [
"<Figure size 600x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# https://docs.opencv.org/3.4/d5/daf/tutorial_py_histogram_equalization.html\n",
"import numpy as np\n",
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = cv.imread('img/home.jpg', cv.IMREAD_GRAYSCALE)\n",
"assert img is not None, \"Image could not be read, check with os.path.exists()\"\n",
"\n",
"hist, bins = np.histogram(img.flatten(), 256, [0, 256])\n",
"cdf = hist.cumsum()\n",
"cdf_normalized = cdf * float(hist.max()) / cdf.max()\n",
"\n",
"plt.figure(figsize=(12, 6))\n",
"plt.subplot(2, 2, 1)\n",
"plt.imshow(img, cmap='gray')\n",
"plt.title('Original Image')\n",
"plt.axis('off')\n",
"\n",
"plt.subplot(2, 2, 2)\n",
"plt.plot(cdf_normalized, color='b')\n",
"plt.hist(img.flatten(), 256, [0, 256], color='r', alpha=0.6)\n",
"plt.title('Original Histogram and CDF')\n",
"plt.xlim([0, 256])\n",
"\n",
"cdf_m = np.ma.masked_equal(cdf, 0)\n",
"cdf_m = (cdf_m - cdf_m.min()) * 255 / (cdf_m.max() - cdf_m.min())\n",
"cdf = np.ma.filled(cdf_m, 0).astype('uint8')\n",
"\n",
"img_eq_numpy = cdf[img]\n",
"\n",
"img_eq_opencv = cv.equalizeHist(img)\n",
"\n",
"clahe = cv.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))\n",
"img_clahe = clahe.apply(img)\n",
"\n",
"plt.subplot(2, 2, 3)\n",
"plt.imshow(img_eq_numpy, cmap='gray')\n",
"plt.title('Histogram Equalized (Numpy)')\n",
"plt.axis('off')\n",
"\n",
"plt.subplot(2, 2, 4)\n",
"plt.imshow(img_eq_opencv, cmap='gray')\n",
"plt.title('Histogram Equalized (OpenCV)')\n",
"plt.axis('off')\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n",
"\n",
"plt.figure(figsize=(6, 6))\n",
"plt.imshow(img_clahe, cmap='gray')\n",
"plt.title('CLAHE Result')\n",
"plt.axis('off')\n",
"plt.show()\n",
"\n",
"cv.imwrite('histogram_equalized_numpy.jpg', img_eq_numpy)\n",
"cv.imwrite('histogram_equalized_opencv.jpg', img_eq_opencv)\n",
"cv.imwrite('clahe_result.jpg', img_clahe)\n"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA9cAAAJOCAYAAAC9afQWAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB88UlEQVR4nO3deXhU5f3+8XsSsrHMxLAkRALiCgiigg1xAZSUgEilYBUFREulalBZRKUt4NZScccFuv3AKrigooJfsQgCVQNqlCqILIqAwgQFk0AgC8n5/ZHMMDOZbDM5s75f1zWXmbM885whcnPO5znPsRiGYQgAAAAAAPgsJtgdAAAAAAAg3HFyDQAAAACAnzi5BgAAAADAT5xcAwAAAADgJ06uAQAAAADwEyfXAAAAAAD4iZNrAAAAAAD8xMk1AAAAAAB+4uQaAAAAAAA/cXKNsPDdd9/JYrFo0aJFwe5K2Pr4448VHx+v3bt3B7srIWn06NG6+uqrg90NAIg4ZLj/oj3Dv/rqK7Vo0UKbN28OdleAenFyDX3yySeaNGmSzj77bLVq1UqdO3fW1Vdfre3bt9faduDAgbJYLLJYLIqJiZHVatVZZ52lcePGadWqVY3+zBtuuEGtW7euc73FYtGkSZN8Oh5Xzz77LGFe449//KOuvfZadenSxW25YRh6/vnn1b9/fyUnJ6tly5bq1auX7r//fpWUlASpt/XbtGmTxo4dq4yMDCUkJCglJUXZ2dlauHChKisr9frrr8tiseif//xnnW2sWrVKFotF8+bNkyTdfffdeu211/S///0vUIcBAH4jw6ODtwx3/HkOHz681vaOCxqPPPJIILtpmh49emjYsGGaNWtWsLsC1KtFsDuA4HvooYf04Ycf6je/+Y3OOecc2e12Pf300zr//PO1YcMG9ezZ0237Tp06ac6cOZKkkpIS7dy5U6+//rpeeOEFXX311XrhhRcUFxfXrH3s0qWLjh071uR2n332WbVr10433HBDs/Yn3GzatEnvvfeePvroI7fllZWVuu666/TKK6/okksu0b333quWLVvqv//9r+677z4tXbpU7733nlJTU4PU89r++c9/6uabb1ZqaqrGjRunM844Q4cPH9bq1as1YcIE7d+/X9OmTZPNZtOSJUv0u9/9zms7S5YsUWxsrEaPHi1JOu+889S3b189+uij+ve//x3IQwIAn5Hhka+uDHdYsWKF8vPz1adPnwD3LLBuvvlmXX755frmm2902mmnBbs7gHcGot6HH35olJWVuS3bvn27kZCQYIwZM8Zt+YABA4yzzz67VhvHjx83br31VkOScddddzX4mePHjzdatWpV53pJRm5ubiOPoG5nn322MWDAAL/b8VVJSUnQPtvV7bffbnTu3NmoqqpyW/6Xv/zFkGTceeedtfZ56623jJiYGGPIkCGB6maD8vLyjNjYWOPiiy82iouLa63/5JNPjIULFxqGYRgTJkwwYmJijB9++KHWdseOHTNsNlutY3vkkUeMVq1aGYcPHzal/wDQ3Mhw84R6hg8YMMDo3LmzcdJJJxnDhw93W7dr1y5DkvHwww8HsqumKi8vN0466SRj5syZwe4KUCeGhUMXXnih4uPj3ZadccYZOvvss7V169ZGtREbG6t58+apR48eevrpp1VUVNSsffR2v5bdbteNN96oTp06KSEhQR07dtSVV16p7777TpJ0yimnaMuWLVq3bp1zGNzAgQOd+3/77bf6zW9+o5SUFLVs2VL9+vXT22+/Xeuzd+/erV/96ldq1aqVOnTooClTpujdd9+VxWLR2rVrndsNHDhQPXv2VH5+vvr376+WLVvqD3/4gyTpzTff1LBhw5Senq6EhASddtppeuCBB1RZWen2WY42vvjiCw0YMEAtW7bU6aefrldffVWStG7dOmVmZiopKUlnnXWW3nvvvUZ9f2+88YYuu+wyWSwW57Jjx47p4Ycf1plnnumsYrgaPny4xo8fr5UrV2rDhg3O5aeccoquuOIK/ec//9G5556rxMRE9ejRQ6+//nqtNgoLCzV58mTn8O3TTz9dDz30kKqqqpzbuA5d+/vf/67TTjtNCQkJuuCCC/TJJ5+4tXfffffJYrFo8eLFatOmTa3P69u3r7PCMXbsWFVVVemll16qtd3bb7+toqIijRkzxm35L3/5S5WUlDRpeCQABBMZHp0Z7tCmTRtNmTJFy5cv12effVZvO/fee6/XNhYtWiSLxeL87qUTWb927Vr17dtXSUlJ6tWrl/M7e/3119WrVy8lJiaqT58++vzzz93adNw68O233yonJ0etWrVSenq67r//fhmGIan6trRTTjlFV155Za0+lZaWymaz6fe//71zWVxcnAYOHKg333yz3uMEgomTa3hlGIYKCgrUrl27Ru8TGxura6+9VkePHtUHH3zQqH1++uknr6/GGDVqlJYtW6Ybb7xRzz77rG6//XYdPnxYe/bskSQ98cQT6tSpk7p166bnn39ezz//vP74xz9KkgoKCnThhRfq3Xff1a233qo///nPKi0t1a9+9SstW7bM+RklJSW67LLL9N577+n222/XH//4R3300Ue6++67vfbp4MGDGjp0qM4991w98cQTuvTSSyVVB1fr1q01depUPfnkk+rTp49mzZqle+65p1YbP//8s6644gplZmZq7ty5SkhI0OjRo/Xyyy9r9OjRuvzyy/XXv/5VJSUluuqqq3T48OF6v6cffvhBe/bs0fnnn++2/IMPPtDPP/+s6667Ti1aeL9D5Prrr5dU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333nb766itJ0sqVK3XyySfrV7/6lVu/b7rpJq/tJiQk6MYbb/TaX4fDhw/rp59+0iWXXKKjR4/q66+/dtu2devWzkm2JOmss85ScnKyunfvrszMTOdyx8/ffvttvcd68OBBSdJJJ53kttzxZ+RteLWDY53nFeL
"text/plain": [
"<Figure size 1000x600 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# https://docs.opencv.org/3.4/dd/d0d/tutorial_py_2d_histogram.html\n",
"import numpy as np\n",
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = cv.imread('img/home.jpg')\n",
"assert img is not None, \"Image could not be read, check with os.path.exists()\"\n",
"\n",
"hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV)\n",
"\n",
"hist_cv = cv.calcHist([hsv], [0, 1], None, [180, 256], [0, 180, 0, 256])\n",
"\n",
"plt.figure(figsize=(10, 6))\n",
"plt.subplot(1, 2, 1)\n",
"plt.imshow(hist_cv, interpolation='nearest', extent=[0, 256, 0, 180], aspect='auto', cmap='hot')\n",
"plt.title('2D Histogram (OpenCV)')\n",
"plt.xlabel('Saturation')\n",
"plt.ylabel('Hue')\n",
"plt.colorbar()\n",
"\n",
"h, s, _ = cv.split(hsv)\n",
"hist_np, xbins, ybins = np.histogram2d(h.ravel(), s.ravel(), bins=[180, 256], range=[[0, 180], [0, 256]])\n",
"\n",
"plt.subplot(1, 2, 2)\n",
"plt.imshow(hist_np, interpolation='nearest', extent=[0, 256, 0, 180], aspect='auto', cmap='hot')\n",
"plt.title('2D Histogram (Numpy)')\n",
"plt.xlabel('Saturation')\n",
"plt.ylabel('Hue')\n",
"plt.colorbar()\n",
"\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 8"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAeEAAAH4CAYAAAB9k1V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jRtGvXjipVqlCtWjXOO+88Fi5cGPQ6z5w5k1tuuYV69epRuXJlLrrookLX6cDPd+6551K9enUqVapE586d+frrrws9JzMzk5EjR9KkSROSk5OpW7cuZ599Nj/99FOx10HEbboTlqj03nvv0bx5c0444YSQX7NkyRJOOeUUGjRowJgxY6hcuTKvv/463bt3Z86cOfzrX/8CYOPGjZx88sns2bOH4cOHU6tWLV588UUuuugiZs+eHXjePvfffz+pqamMGTOGlStX8sgjj5CYmEhcXBzbtm3jzjvv5LvvvuOFF16gadOm3H777YHXjhs3jrFjx9KnTx8uv/xyNm/ezCOPPMJpp53Gzz//TFpaGrfeeis7duzgr7/+YvLkyQBUqVKlUAz33HMPSUlJjB49mpycHJKSkoJeg48//pgLLriA9PR0RowYQb169Vi2bBnvvfceI0aMcLx2jRs3Zu7cuXz66aecccYZJV7rlStX0qtXL/79738zaNAgnnvuOS677DI6dOhAmzZtAPuHzltvvUXv3r1p2rQpGzdu5KmnnqJz584sXbqU+vXrF3rPcePG4fP5uOmmm9i0aRNTpkzhrLPOYsGCBaSmpgLw6aefct5559GhQwfuuOMO4uLieP755znjjDP48ssv6dixIwBXXXUVs2fP5tprr6V169ZkZGTw1VdfsWzZMo499tgSP5+Ia4xIlNmxY4cBTPfu3Yu0bdu2zWzevDlw7NmzJ9B25plnmnbt2pns7OzA1/x+vzn55JNNixYtAl8bOXKkAcyXX34Z+FpmZqZp2rSpadKkiSkoKDDGGDNv3jwDmLZt25rc3NzAc/v162d8Pp8577zzCsV20kknmcaNGwcer1mzxsTHx5tx48YVet6iRYtMQkJCoa937dq10Gv32RdDs2bNCn3WA9vmzZtnjDEmPz/fNG3a1DRu3Nhs27at0HP9fn+R9z7Q4sWLTWpqqgHMMcccY0aMGGHeeusts3v37iLPbdy4sQHMF198Efjapk2bTHJysrn++usDX8vOzg5cy31Wr15tkpOTzd13313kczRo0MDs3Lkz8PXXX3/dAGbq1KmBz9CiRQtzzjnnFPo8e/bsMU2bNjVnn3124GvVq1c3w4YNK/Yzi0QDdUdL1Nm5cydQ9G4QbNdtnTp1Asdjjz0G2K7PTz/9lD59+pCZmcmWLVvYsmULGRkZnHPOOaxYsYJ169YB8N///peOHTvSqVOnwPtWqVKFoUOHsmbNGpYuXVronAMHDiQxMTHw+IQTTsAYw5AhQwo974QTTuDPP/8kPz8fgDfeeAO/30+fPn0C8WzZsoV69erRokUL5s2bF/I1GTRoUOBu0MnPP//M6tWrGTlyJGlpaYXafD5fsa9t06YNCxYsoH///qxZs4apU6fSvXt3DjvsMJ5++ukiz2/dujWnnnpq4HGdOnVo1aoVv//+e+BrycnJgTH7goICMjIyqFKlCq1atQraLTxw4ECqVq0aeNyrVy/S09P573//C8CCBQtYsWIFl1xyCRkZGYHruXv3bs4880y++OIL/H4/AGlpaXz//ff8/fffxX5uEa+pO1qizr5fxLt27SrS9tRTT5GZmcnGjRvp379/4OsrV67EGMPYsWMZO3Zs0PfdtGkTDRo0YO3atUG7uY866igA1q5dS9u2bQNfb9SoUaHnVa9eHaDIeHT16tXx+/3s2LGDWrVqsWLFCowxtGjRImg8Byb2kjRt2rTE56xatQqgUOyl0bJlS15++WUKCgpYunQp7733Hg888ABDhw6ladOmnHXWWYHnHnxNAGrUqMG2bdsCj/1+P1OnTuXxxx9n9erVFBQUBNpq1apV5PUHXyefz0fz5s0DM8ZXrFgB2D9InOzYsYMaNWrwwAMPMGjQIBo2bEiHDh04//zzGThwIM2aNQvtYoi4RElYok716tVJT09n8eLFRdr2Jc+Dl/LsuwMaPXo055xzTtD3bd68eZniiY+PL9XXzd5Vf36/H5/PxwcffBD0ucHu9J2UdBccTvHx8bRr14527dpx0kkncfrppzN9+vRCSbikzw5w3333MXbsWIYMGcI999xDzZo1iYuLY+TIkYHvV2nse83EiRM55phjgj5n3zXt06cPp556Km+++SYfffQREydOZMKECbzxxhucd955pT63SKQoCUtU6tq1K8888wzz588PTLYpzr47nMTExELJIpjGjRvz66+/Fvn68uXLA+3hcMQRR2CMoWnTprRs2bLY55bUXRzq+QAWL15c4jUI1XHHHQfA+vXrS/3a2bNnc/rpp/Pss88W+vr27dupXbt2kefvu9PdxxjDypUrOfroo4H9n69atWohfb709HSuueYarrnmGjZt2sSxxx7LuHHjlIQlqmhMWKLSjTfeSKVKlRgyZAgbN24s0m4OqjFTt25dunTpwlNPPRU0YWzevDnw7/PPP5/58+fz7bffBr62e/dupk2bRpMmTWjdunVYPkOPHj2Ij4/nrrvuKhKvMYaMjIzA48qVK7Njx45DOt+xxx5L06ZNmTJlCtu3by9yvuJ8+eWX5OXlFfn6vvHYVq1alTqe+Pj4IuedNWtWYGz+YC+99BKZmZmBx7Nnz2b9+vWBpNmhQweOOOIIJk2aFHSoYt/3uKCgoMi1rFu3LvXr1w+6hEzES7oTlqjUokULZsyYQb9+/WjVqlWgYpYxhtWrVzNjxgzi4uI4/PDDA6957LHH6NSpE+3ateOKK66gWbNmbNy4kW+//Za//vorsD51zJgxvPrqq5x33nkMHz6cmjVr8uKLL7J69WrmzJkTtgIgRxxxBPfeey8333wza9asoXv37lStWpXVq1fz5ptvMnToUEaPHg3YBDNz5kxGjRrF8ccfT5UqVbjwwgtLdb64uDieeOIJLrzwQo455hg
"text/plain": [
"<Figure size 600x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# https://docs.opencv.org/4.x/dc/da5/tutorial_py_drawing_functions.html\n",
"import numpy as np\n",
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = np.zeros((512, 512, 3), np.uint8)\n",
"\n",
"cv.line(img, (0, 0), (511, 511), (255, 0, 0), 5)\n",
"\n",
"cv.rectangle(img, (384, 0), (510, 128), (0, 255, 0), 3)\n",
"\n",
"cv.circle(img, (447, 63), 63, (0, 0, 255), -1)\n",
"\n",
"cv.ellipse(img, (256, 256), (100, 50), 0, 0, 180, 255, -1)\n",
"\n",
"pts = np.array([[10, 5], [20, 30], [70, 20], [50, 10]], np.int32)\n",
"pts = pts.reshape((-1, 1, 2))\n",
"cv.polylines(img, [pts], True, (0, 255, 255))\n",
"\n",
"font = cv.FONT_HERSHEY_SIMPLEX\n",
"cv.putText(img, 'Leon', (10, 500), font, 4, (255, 255, 255), 2, cv.LINE_AA)\n",
"\n",
"plt.figure(figsize=(6, 6))\n",
"plt.imshow(cv.cvtColor(img, cv.COLOR_BGR2RGB))\n",
"plt.title(\"Geometric Shapes\")\n",
"plt.axis('off')\n",
"plt.show()\n",
"\n",
"cv.imwrite('img/geometric_shapes.jpg', img)\n"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time with OpenCV: 0.262867 seconds\n",
"Time with time module: 0.23663091659545898 seconds\n",
"Time without optimization: 0.2363342 seconds\n",
"Time with optimization: 0.2342073 seconds\n"
]
}
],
"source": [
"# https://docs.opencv.org/3.4/dc/d71/tutorial_py_optimization.html\n",
"import cv2 as cv\n",
"import numpy as np\n",
"import time\n",
"\n",
"img1 = cv.imread('img/home.jpg')\n",
"assert img1 is not None, \"file could not be read, check with os.path.exists()\"\n",
"\n",
"e1 = cv.getTickCount()\n",
"for i in range(5, 49, 2):\n",
" img1 = cv.medianBlur(img1, i)\n",
"e2 = cv.getTickCount()\n",
"t_opencv = (e2 - e1) / cv.getTickFrequency()\n",
"\n",
"start_time = time.time()\n",
"for i in range(5, 49, 2):\n",
" img1 = cv.medianBlur(img1, i)\n",
"end_time = time.time()\n",
"t_time_module = end_time - start_time\n",
"\n",
"print(\"Time with OpenCV:\", t_opencv, \"seconds\")\n",
"print(\"Time with time module:\", t_time_module, \"seconds\")\n",
"\n",
"cv.setUseOptimized(False)\n",
"e1 = cv.getTickCount()\n",
"for i in range(5, 49, 2):\n",
" img1 = cv.medianBlur(img1, i)\n",
"e2 = cv.getTickCount()\n",
"t_no_opt = (e2 - e1) / cv.getTickFrequency()\n",
"\n",
"cv.setUseOptimized(True)\n",
"e1 = cv.getTickCount()\n",
"for i in range(5, 49, 2):\n",
" img1 = cv.medianBlur(img1, i)\n",
"e2 = cv.getTickCount()\n",
"t_opt = (e2 - e1) / cv.getTickFrequency()\n",
"\n",
"print(\"Time without optimization:\", t_no_opt, \"seconds\")\n",
"print(\"Time with optimization:\", t_opt, \"seconds\")\n"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"# https://docs.opencv.org/4.x/dd/d43/tutorial_py_video_display.html\n",
"import cv2 as cv\n",
"\n",
"cap = cv.VideoCapture(0)\n",
"fourcc = cv.VideoWriter_fourcc(*'XVID')\n",
"out = cv.VideoWriter('/img/output.avi', fourcc, 20.0, (640, 480))\n",
"\n",
"while cap.isOpened():\n",
" ret, frame = cap.read()\n",
" if not ret:\n",
" break\n",
" out.write(frame)\n",
" cv.imshow('frame', frame)\n",
" if cv.waitKey(1) == ord('q'):\n",
" break\n",
"\n",
"cap.release()\n",
"out.release()\n",
"cv.destroyAllWindows()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 9"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAGHCAYAAAAgIOMGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAeA0lEQVR4nO3dfbBdZWEu8GedE/JNwmcIFwFjDEEQg5aLeJ0QiiMZGWGAKAVMNSJCVRSugx1KEQySYdoRwVqLXHpNQWBwyJUiFAhWPhwtoFC8UHttQYhDkfARIAEChJO97h8hx5x87r1Ozkd4f7+ZNTl77XX2fs97nrPnWe/a56Sq67oOAADF6BrqAQAAMLgUQACAwiiAAACFUQABAAqjAAIAFEYBBAAojAIIAFAYBRAAoDAKIABAYRRAYFi76667UlVV7rrrrqEeCsBbhgII9PEP//APqaoq999//0bvP+yww/Lud797kEe1dd1111057rjjMnny5IwcOTKTJk3KUUcdlR/+8IdDPTSAQTFiqAcAsDmHHnpoXn311YwcOXKrPN7555+fCy64INOmTctpp52WvffeO8uWLcstt9ySOXPm5JprrslJJ520VZ4LYLhSAIEhU9d1XnvttYwZM2aD+1577bWMHDkyXV1dGT169FZ5vkWLFuWCCy7Ixz72sVx77bXZbrvteu/7yle+ksWLF+eNN97o9/P09PSk1WpttdK6JStXrszYsWMH5bmAtwaXgIF+W7hwYQ4//PBMmjQpo0aNyn777ZfLLrtsg+Pe/va356Mf/WgWL16cgw46KGPGjMnll1/e+z6/6667Lueee2722GOPjB07NitWrNjoewAfeeSRzJkzJ5MnT87o0aPztre9LSeccEKWL1++2XF+9atfzU477ZTvfe97fcrfWrNnz85HP/rR3tvPPPNMPvOZz2S33XbL6NGjM2PGjFx55ZV9PmfJkiWpqirf+MY3cumll2bq1KkZNWpU/v3f/z1f+9rXUlVVHn300cybNy877LBDJk6cmE9/+tNZuXLlBs9/9dVX54/+6I8yZsyY7LTTTjnhhBPyxBNP9Dlm7SX4Bx54IIceemjGjh2bc845J0ly//33Z/bs2dlll10yZsyYTJkyJSeffPJm5wQokxVAYKOWL1+e5557boP9G1shu+yyy7L//vvn6KOPzogRI3LTTTfl85//fFqtVr7whS/0OfY//uM/cuKJJ+a0007LZz/72UyfPr33vq9//esZOXJkzjrrrLz++usbXUFbtWpVZs+enddffz1f/OIXM3ny5Dz55JO5+eab8+KLL2bixIkb/XoeeeSR/OY3v8nJJ5+c7bfffotf/6uvvprDDjssjz76aE4//fRMmTIl119/febNm5cXX3wxZ5xxRp/jFy5cmNdeey2nnnpqRo0alZ122qn3vuOPPz5TpkzJRRddlH/913/N3//932fSpEn5q7/6q95jFixYkK9+9as5/vjjc8opp+TZZ5/Nt7/97Rx66KF58MEHs8MOO/Qeu2zZsnzkIx/JCSeckLlz52a33XbLM888kyOOOCK77rprzj777Oywww5ZsmSJ9zUCG1cDrGPhwoV1ks1u+++/f5/PWbly5QaPM3v27Pod73hHn3177713naS+7bbb+uy/88476yT1O97xjg0ea+19d955Z13Xdf3ggw/WSerrr7++o6/rxhtvrJPUl1xySVvHX3rppXWS+uqrr+7dt2rVqvoDH/hAPX78+HrFihV1Xdf1448/XiepJ0yYUD/zzDN9HuP888+vk9Qnn3xyn/3HHntsvfPOO/feXrJkSd3d3V0vWLCgz3EPP/xwPWLEiD77Z82aVSepv/vd7/Y59oYbbqiT1L/85S/b+vqAsrkEDGzUd77znfz4xz/eYHvPe96zwbHrvodv7crhrFmz8thjj21wWXbKlCmZPXv2Rp/zU5/61EbfD7iutSt8ixcv3uhl1E1ZsWJFkrS1+pckt9xySyZPnpwTTzyxd992222XL33pS3n55Zdz99139zl+zpw52XXXXTf6WH/2Z3/W5/bMmTOzbNmy3jH98Ic/TKvVyvHHH5/nnnuud5s8eXKmTZuWO++8s8/njxo1Kp/+9Kf77Fu7QnjzzTdvlfcxAm9tLgEDG3XwwQfnoIMO2mD/jjvuuMGl4Z///Oc5//zzc88992xQypYvX97nsuyUKVM2+Zybu2/dY7785S/nm9/8Zq655prMnDkzRx99dObOnbvJy79JMmHChCTJSy+9tMXnSJLf/e53mTZtWrq6+p4nv+td7+q9v92x77XXXn1u77jjjkmSF154IRMmTMgjjzySuq4zbdq0jX7++u9X3GOPPTa4PD5r1qzMmTMn8+fPzyWXXJLDDjssxxxzTE466aSMGjVqM18pUCIFEOiX3/72t/nQhz6UfffdN9/85jez5557ZuTIkbnllltyySWXpNVq9Tl+cyt8W1r9W+viiy/OvHnzcuONN+b222/Pl770pVx00UW5995787a3vW2jn7PvvvsmSR5++OE2v7LObG7s3d3dG91f13WSpNVqpaqq3HrrrRs9dvz48Vt8rqqqsmjRotx777256aabsnjx4px88sm5+OKLc++9927wGEDZFECgX2666aa8/vrr+dGPftRnpWv9y5Zb2wEHHJADDjgg5557bv7lX/4lH/zgB/Pd7343F1544UaP32effTJ9+vTceOON+da3vrXFQrT33nvnoYceSqvV6rMK+Jvf/Kb3/q1l6tSpqes6U6ZMyT777NOvxzrkkENyyCGHZMGCBbn22mvziU98Itddd11OOeWUrTRa4K3AewCBflm7YrV2NStZc9l34cKFA/J8K1asSE9PT599BxxwQLq6uvL6669v9nPnz5+fZcuW5ZRTTtngMZLk9ttvz80335wkOfLII7N06dL84Ac/6L2/p6cn3/72tzN+/PjMmjVrK3w1axx33HHp7u7O/Pnz+8xjsmZely1btsXHeOGFFzb43AMPPDBJtjgvQHmsAAL9csQRR2TkyJE56qijctppp+Xll1/OFVdckUmTJuWpp57a6s93xx135PTTT8/HP/7x7LPPPunp6cn3v//9dHd3Z86cOZv93D/5kz/Jww8/nAULFuTBBx/MiSee2Ps/gdx22235yU9+kmuvvTZJcuqpp+byyy/PvHnz8sADD+Ttb397Fi1alJ///Oe59NJL2/5lknZMnTo1F154Yf7iL/4iS5YsyTHHHJPtt98+jz/+eG644YaceuqpOeusszb7GFdeeWX+7u/+Lscee2ymTp2al156KVdccUUmTJiQI488cquNFXhrUACBfpk+fXoWLVqUc889N2eddVYmT56cz33uc9l1110H5I8Qz5gxI7Nnz85NN92UJ598MmPHjs2MGTNy66235pBDDtni51944YU5/PDD8zd/8ze57LLL8vzzz2fHHXfMIYcckhtvvDFHH310kjXvs7vrrrty9tln58orr8yKFSsyffr0LFy4MPPmzdvqX9fZZ5+dffbZJ5dccknmz5+fJNlzzz1zxBFH9I5pc2bNmpVf/OIXue666/L0009n4sSJOfjgg3PNNde09cs1QFmqev1rBgAAvKV5DyAAQGEUQACAwiiAAACFUQABAAqjAAIAFEYBBAAojAIIAFAYBXAAnX/++amqytbhtv/++w/1t26bI2uyNlhkTdYGi6w129qlAAIAFEYBBAAojAIIAFAYBRAAoDAKIABAYRRAAIDCKIAAAIVRAAEACqMAAgAURgEEACiMAggAUBgFEACgMAogAEBhFEAAgMIogAAAhVEAAQAKowACABRGAQQAKIwCCABQGAUQAKAwCiAAQGEUQACAwiiAAACFUQABAAqjAAIAFEYBBAAojAIIAFAYBRAAoDAKIABAYRRAAIDCKIAAAIVRAAEACqMAAgAURgEEACiMAggAUBgFEACgMAogAEBhRgz1AN7Kqqoa6iFss+q67nPbXG6e+WlO1jpjfpqTtc6Yn4HVdgFcP7i0p6qq3rlb92M2bd0fenPXPlnrnKw1I2udk7VmZG3guAQ8SNb+8Duj2bJ
"text/plain": [
"<Figure size 800x800 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnwAAAKSCAYAAABIowakAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9eZhsV1U2vqqqq+e+U6abMCQhBoIhAQlRFEKCKJEZCSIgSAhDVCAOj/MPP0BFPvSTQUQQ/CAoQflAlOFDIpMaUfyYBSUQSILIkPne20NVV1fX+f1xeU+/tXqtffaprr73plnv89RTVefss4e1917r3WsPp1EURSGBQCAQCAQCgR2L5tHOQCAQCAQCgUBgexGELxAIBAKBQGCHIwhfIBAIBAKBwA5HEL5AIBAIBAKBHY4gfIFAIBAIBAI7HEH4AoFAIBAIBHY4gvAFAoFAIBAI7HAE4QsEAoFAIBDY4QjCFwgEAoFAILDDEYQvEFD4h3/4B2k0GvIP//APRzsrAcKNN94ojUZDrrzyyuyw/+t//a/tz1gmrrzySmk0GvLJT35ybHE2Gg158YtfPLb4NC666CK56KKLti3+QCBw5BCEL3DUUWUIL7roIrnPfe5zhHM1XvzDP/yDPOEJT5D9+/fL5OSknHjiifKYxzxG3vWudx3trN2p8f73v3/bCM+NN94oz3zmM+WMM86Q6elp2b9/vzzkIQ+RF73oRduSHuOiiy6SRqNRfvbt2yfnn3++vOlNb5LBYLDt6Y+K9fV1OeWUU6TRaMjf/d3fHe3sBAIBwsTRzkAgcKzhIQ95iHQ6HZmcnBxLfC960Yvkt3/7t+XMM8+Uyy+/XE499VS57bbb5P3vf79ccsklctVVV8lTn/rUsaS1k3HqqadKp9ORdrtdXnv/+98vr33ta8dO+r7yla/I+eefLzMzM3LZZZfJaaedJt/61rfk05/+tLz85S+Xl7zkJWNNz8Jd73pXednLXiYiIrfccov8+Z//uTzrWc+SL3/5y/I//+f/FBGRTqcjExPHjhr/yEc+It/61rfktNNOk6uuukoe8YhHHO0sBQKB7+DY0RSBwBFAURTS7XZlZmZm071utyuTk5PSbDZlenp6LOm9853vlN/+7d+WJz7xifK2t71tiKz8yq/8ilx99dWytra25XT6/b4MBoOxkdQqrKysyOzs7BFJC2g0GmOrlyq88pWvlKWlJfnsZz8rp5566tC9m2+++YjkYffu3fK0pz2t/H/55ZfLve51L/njP/5j+Z3f+R1pt9tHTB65eOtb3yr3v//95RnPeIb85m/+piwvL8vc3NzRztYmHOn+EggcC4gp3cCdEm9+85vlh3/4h+XEE0+Uqakp+d7v/V553etetyncaaedJo9+9KPl6quvlgc84AEyMzMjf/qnf1qu0/urv/oreeELXyh3uctdZHZ2Vg4dOmSu4bvuuuvkkksukf3798v09LTc9a53lSc/+cly8ODBZD5/67d+S/bt2ydvetObhsgecPHFF8ujH/3o8v/NN98sz3rWs+Skk06S6elpue997ytvectbhp7h9WmvetWr5IwzzpCpqSn5z//8T3nxi18sjUZDvvKVr8ill14qe/bskd27d8szn/lMWVlZ2ZT+W9/6VjnvvPNkZmZG9u3bJ09+8pPl61//+lAYTKl/6lOfkoc85CEyOzsrv/mbvykiIp/85Cfl4osvluOPP15mZmbk9NNPl8suuywpk1/6pV+S4447ToqiKK+94AUvkEajIX/0R39UXrvpppuk0WiU9arX8F166aXy2te+VkRkaPpT4w1veEMpo/PPP18+8YlPJPMnIvLVr35V7nrXu24ieyIiJ5544tB/bx3daaedJpdeeumm6ysrK3L55ZfLcccdJ7t27ZKf/umfljvuuKMyT7Ozs/LABz5QlpeX5ZZbbtmUdqfTkbPOOkvOOuss6XQ65XO33367nHzyyfJDP/RDsr6+LiIig8FAXvWqV8nZZ58t09PTctJJJ8nll1+elQ8PnU5H/uZv/kae/OQny5Oe9CTpdDry7ne/2wz7d3/3d3LhhRfKwsKC7Nq1S84//3x529veNhTm3/7t3+SRj3yk7N27V+bm5uTcc8+VV7/61eV9b33hpZdeKqeddlr5P9Vfer2e/I//8T/kvPPOk927d8vc3JxccMEF8tGPfnRTvIPBQF796lfLOeecI9PT03LCCSfIj/3Yj5VLUS688EK5733va5b3Xve6l1x88cVVIgwEthXh4QscMzh48KDceuutm65bHrDXve51cvbZZ8tjH/tYmZiYkPe+973ycz/3czIYDOR5z3veUNgvfelL8pSnPEUuv/xyec5zniP3ute9ynu/8zu/I5OTk/LLv/zLsrq6ao74e72eXHzxxbK6uioveMELZP/+/fKNb3xD3ve+98mBAwdk9+7dZnmuu+46ufbaa+Wyyy6ThYWFyvJ3Oh256KKL5Ctf+Yo8//nPl9NPP13e8Y53yKWXXioHDhyQn//5nx8K/+Y3v1m63a4897nPlampKdm3b19570lPepKcfvrp8rKXvUw+/elPy5/92Z/JiSeeKC9/+cvLMC996Uvlt37rt+RJT3qSPPvZz5ZbbrlFXvOa18hDHvIQ+cxnPiN79uwpw952223yiEc8Qp785CfL0572NDnppJPk5ptvloc//OFywgknyK//+q/Lnj175MYbb6xcl3jBBRfIK1/5SvmP//iPcm3mNddcI81mU6655hq54oorymsih6fYLVx++eXyzW9+Uz74wQ/KX/zFX5hh3va2t8ni4qJcfvnl0mg05Pd///flCU94glx//fUmAQdOPfVU+dCHPiQf+chH5Id/+IeT5amL5z//+bJnzx558YtfLF/60pfkda97nXzta18rBxopXH/99dJqtYbqBpiZmZG3vOUt8qAHPUj+v//v/5NXvOIVIiLyvOc9Tw4ePChXXnmltFotETksuyuvvFKe+cxnyhVXXCE33HCD/PEf/7F85jOfkY997GNJ2Xh4z3veI0tLS/LkJz9Z9u/fLxdddJG5XOHKK6+Uyy67TM4++2z5jd/4DdmzZ4985jOfkQ984ANl2A9+8IPy6Ec/Wk4++WT5+Z//edm/f7988YtflPe9732b+kEurP5y6NAh+bM/+zN5ylOeIs95znNkcXFR/vf//t9y8cUXy//7f/9P7ne/+5XPP+tZz5Irr7xSHvGIR8izn/1s6ff7cs0118jHP/5xecADHiBPf/rT5TnPeY584QtfGFpz/IlPfEK+/OUvywtf+MKR8h0IjA1FIHCU8eY3v7kQkeTn7LPPHnpmZWVlUzwXX3xxcY973GPo2qmnnlqISPGBD3xg6PpHP/rRQkSKe9zjHpviwr2PfvSjRVEUxWc+85lCRIp3vOMdtcr17ne/uxCR4pWvfGVW+Fe96lWFiBRvfetby2u9Xq/4wR/8wWJ+fr44dOhQURRFccMNNxQiUuzatau4+eabh+J40YteVIhIcdlllw1d//Ef//HiuOOOK//feOONRavVKl760pcOhfv85z9fTExMDF2/8MILCxEpXv/61w+F/Zu/+ZtCRIpPfOITWeUDbr755kJEij/5kz8piqIoDhw4UDSbzeInfuInipNOOqkMd8UVVxT79u0rBoPBULnf/OY3l2Ge97znFZYaQ9jjjjuuuP3228vrqJP3vve9yTx+4QtfKGZmZgoRKe53v/sVP//zP1/87d/+bbG8vLwprIgUL3rRizZdP/XUU4tnPOMZ5X+08/POO6/o9Xrl9d///d8vRKR497vfXV678MILi7POOqu45ZZbiltuuaX44he/WFxxxRWFiBSPecxjkmn/xm/8RtFsNot/+qd/Kt7xjncUIlK86lWvKu9fc801hYgUV1111dBzH/jABzZdv/DCC4sLL7wwKSvg0Y9+dPGgBz2o/P+GN7yhmJiYGGqjBw4cKBYWFoof+IEfKDqdztDzqOd+v1+cfvrpxamnnlrccccdZphU3p7xjGcUp556avk/1V/6/X6xuro6dO2OO+4oTjrppKE+9JGPfKQQkeKKK67YlB7
"text/plain": [
"<Figure size 800x800 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# https://docs.opencv.org/3.4/dc/d0d/tutorial_py_features_harris.html\n",
"import numpy as np\n",
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img_harris = cv.imread('img/chessboard.jpg')\n",
"gray_harris = cv.cvtColor(img_harris, cv.COLOR_BGR2GRAY)\n",
"gray_harris = np.float32(gray_harris)\n",
"dst_harris = cv.cornerHarris(gray_harris, 2, 3, 0.04)\n",
"dst_harris = cv.dilate(dst_harris, None)\n",
"img_harris[dst_harris > 0.01 * dst_harris.max()] = [0, 0, 255]\n",
"cv.imwrite('img/harris_corners.png', img_harris)\n",
"\n",
"plt.figure(figsize=(8, 8))\n",
"plt.imshow(cv.cvtColor(img_harris, cv.COLOR_BGR2RGB))\n",
"plt.title(\"Harris Corners\")\n",
"plt.axis(\"off\")\n",
"plt.show()\n",
"\n",
"img_subpixel = cv.imread('img/blox.jpg')\n",
"gray_subpixel = cv.cvtColor(img_subpixel, cv.COLOR_BGR2GRAY)\n",
"gray_subpixel = np.float32(gray_subpixel)\n",
"dst_subpixel = cv.cornerHarris(gray_subpixel, 2, 3, 0.04)\n",
"dst_subpixel = cv.dilate(dst_subpixel, None)\n",
"_, dst_subpixel = cv.threshold(dst_subpixel, 0.01 * dst_subpixel.max(), 255, 0)\n",
"dst_subpixel = np.uint8(dst_subpixel)\n",
"_, labels, stats, centroids = cv.connectedComponentsWithStats(dst_subpixel)\n",
"criteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 100, 0.001)\n",
"corners = cv.cornerSubPix(gray_subpixel, np.float32(centroids), (5, 5), (-1, -1), criteria)\n",
"res = np.hstack((centroids, corners))\n",
"res = np.intp(res)\n",
"img_subpixel[res[:, 1], res[:, 0]] = [0, 0, 255]\n",
"img_subpixel[res[:, 3], res[:, 2]] = [0, 255, 0]\n",
"cv.imwrite('img/harris_subpixel.png', img_subpixel)\n",
"\n",
"plt.figure(figsize=(8, 8))\n",
"plt.imshow(cv.cvtColor(img_subpixel, cv.COLOR_BGR2RGB))\n",
"plt.title(\"Harris Corners with SubPixel Accuracy\")\n",
"plt.axis(\"off\")\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnwAAAKSCAYAAABIowakAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9e7BtWVUfPPbeZz/OOfece/t2NzR00zQPpXljkBjFAIoYySf4gJiY0hhNTCXtAy0Uy0rUVMWET9TiS0iZYP7wnYoQEUkCSiciH6J8aIIEIW3zbkD63X3vee33+v64/Nb57XHGmHOuffa59/Zh/Kp27b3Xmms+xxzjN8d8rFZVVZUEAoFAIBAIBE4t2lc6A4FAIBAIBAKBk0UQvkAgEAgEAoFTjiB8gUAgEAgEAqccQfgCgUAgEAgETjmC8AUCgUAgEAiccgThCwQCgUAgEDjlCMIXCAQCgUAgcMoRhC8QCAQCgUDglCMIXyAQCAQCgcApRxC+QOCLBK1WS77/+78/G+6Xf/mXpdVqyac+9amTz9RVhBe96EXyohe96EpnIxAIBE4EQfgCgUc4PvShD8krX/lKefzjHy+DwUBuvPFGeclLXiJveMMbTiS9VqtV9PmDP/iDE0n/asBsNpNf+qVfkhe96EVy/vx56ff7csstt8h3f/d3y5/+6Z9e6ewFAoHAEbTiXbqBwCMXf/RHfyRf8zVfIzfffLN813d9l9xwww3ymc98Rt73vvfJxz/+cfnYxz5Wh221WvJ93/d98m//7b9NxjmbzWQymUi/35dWq3Xk/q//+q8v/P/VX/1Vuf322+XXfu3XFq6/5CUvkUc/+tHHKN3lxXg8FhGRXq+XDHdwcCDf+q3fKr/7u78rL3jBC+RlL3uZnD9/Xj71qU/Jm970JrnzzjvlrrvukptuuulyZDsQCASKsHalMxAIBJbHv/yX/1LOnj0rf/InfyLnzp1buHfvvfcuFWen05FOp+Pe/47v+I6F/+973/vk9ttvP3L9kYYc0QN+9Ed/VH73d39XXv/618sP/dAPLdz7qZ/6KXn961+/kvzs7e3J5ubmSuLKYT6fy3g8lsFgcFnSCwQClx8xpRsIPILx8Y9/XJ7+9KcfIXsiIo961KPMZ9761rfKM57xDOn3+/L0pz9dfvd3f3fh/irW8O3t7cmrX/1qedzjHif9fl+e8pSnyM/93M+JnlDAusI3v/nN8rSnPU3W19flK7/yK+VDH/qQiIi88Y1vlCc/+ckyGAzkRS960ZE8vec975G/9bf+ltx8883S7/flcY97nPzwD/+wHBwcLIS7++675bu/+7vlpptukn6/L495zGPkm77pmxbiK1nD99nPflbe+MY3ykte8pIjZE/kEln+kR/5kQXv3gc+8AF56UtfKtvb23LmzBl58YtfLO973/sWnkOdv/vd75bbbrtNHvWoR9VxvOhFL5JnPOMZ8pGPfES+5mu+RjY2NuTGG2+U173udUfSH41G8lM/9VPy5Cc/ua6P17zmNTIajcx6/43f+A15+tOfLv1+v5aD//Sf/pM897nPla2tLdne3pZnPvOZ8q//9b9O1ksgELj6ER6+QOARjMc//vHyx3/8x/Lnf/7n8oxnPCMb/g//8A/lLW95i9x2222ytbUl/+bf/Bt5xSteIXfddZdce+21K8lTVVXy8pe/XN71rnfJP/gH/0Ce85znyO/93u/Jj/7oj8rnPve5Ix6w97znPfK2t71Nvu/7vk9ERF772tfKN37jN8prXvMa+YVf+AW57bbb5KGHHpLXve518j3f8z3y+7//+/Wzb37zm2V/f1/+yT/5J3LttdfK+9//fnnDG94gn/3sZ+XNb35zHe4Vr3iFfPjDH5Yf+IEfkFtuuUXuvfdeuf322+Wuu+6SW265pbhs73jHO2Q6ncp3fud3FoX/8Ic/LH/9r/912d7elte85jXS7XbljW98o7zoRS+Sd7/73fIVX/EVC+Fvu+02uf766+Unf/InZW9vr77+0EMPyTd8wzfIt37rt8q3fdu3yX/+z/9ZfuzHfkye+cxnyktf+lIRueSle/nLXy5/+Id/KP/oH/0jeepTnyof+tCH5PWvf73ceeed8ta3vnUhrd///d+XN73pTfL93//9ct1118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s5ONux9990n+/v78pSnPOXIvac+9akyn8/lM5/5zML1JzzhCWZcN91005Ed07rdPvrRj8qHP/xhuf766xc+X/qlXyoiRzfxWGnddttt8qVf+qXy0pe+VG666Sb5nu/5niNrPAOBwCMTQfgCgVOCXq8nz3ve8+Rf/at/Jf/u3/07mUwmC+vYRMTdfVslTmd61ateJY95zGPqz7d+67euNN9ennJ5nc1m8pKXvET+23/7b/JjP/Zj8ta3vlVuv/12+eVf/mURubSmDfihH/ohufPOO+W1r32tDAYD+Ymf+Al56lOfWnsBS3HrrbeKiNSbSlYN9lgyStptPp/LM5/5TLn99tvNz2233ZZN61GPepT82Z/9mbztbW+r12G+9KUvle/6ru86RqkCgcDVgNi0EQicQnz5l3+5iIh8/vOfP3Zcr3nNaxamE6+55ppk+Mc//vHy3//7f5ednZ0FL98dd9xR318FPvShD8mdd94pv/IrvyJ/7+/9vfq6Nx35pCc9SV796lfLq1/9avnoRz8qz3nOc+Tnf/7nj5wrmMJLX/pS6XQ68uu//uvZjRvXX3+9bGxsyF/8xV8cuXfHHXdIu90+4sU8Dp70pCfJBz/4QXnxi19snp9Yil6vJy972cvkZS97mcznc7ntttvkjW98o/zET/yEPPnJT15ZfgOBwOVFePgCgUcw3vWud5neube//e0iIuZ0YlM87WlPk6/7uq+rP8997nOT4f/m3/ybMpvNjhzw/PrXv15arVa9q/S4gNeLy19V1ZEjRPb392U4HC5ce9KTniRbW1tHjivJ4XGPe5x87/d
"text/plain": [
"<Figure size 800x800 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# https://docs.opencv.org/3.4/d4/d8c/tutorial_py_shi_tomasi.html\n",
"import numpy as np\n",
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = cv.imread('img/blox.jpg')\n",
"gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n",
"corners = cv.goodFeaturesToTrack(gray, 25, 0.01, 10)\n",
"corners = np.intp(corners)\n",
"\n",
"for i in corners:\n",
" x, y = i.ravel()\n",
" cv.circle(img, (x, y), 3, (255, 0, 0), -1)\n",
"\n",
"cv.imwrite('img/shi_tomasi_corners.png', img)\n",
"\n",
"plt.figure(figsize=(8, 8))\n",
"plt.imshow(cv.cvtColor(img, cv.COLOR_BGR2RGB))\n",
"plt.title(\"Shi-Tomasi Corners\")\n",
"plt.axis(\"off\")\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAH7CAYAAABcwC68AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9eZRk2V3fi37OHCfmjJwra8iq6urqWS21Wt1CEi2BhJ6QEBdLF0nPgouu7YvNs9+9rPUwBrNsgxe2wV5mWoCxlzELjH1BMlwEaEBYEpK6NbWkHqu7qmuuyjFyiDnOfN4fUfv0yegYMyOrsrrju1auzIw4Z+999tnDd39/v/3bUhiGIWOMMcYYY4wxxhhjvGYg3+oCjDHGGGOMMcYYY4xxczEmgGOMMcYYY4wxxhivMYwJ4BhjjDHGGGOMMcZrDGMCOMYYY4wxxhhjjPEaw5gAjjHGGGOMMcYYY7zGMCaAY4wxxhhjjDHGGK8xjAngGGOMMcYYY4wxxmsMYwI4xhhjjDHGGGOM8RrDmACOMcYYY4wxxhhjvMYwJoBjjDHGGLcA/+Jf/AskSbrVxRhjjDFeoxgTwDHGGGMHnn32WT74wQ9y7NgxEokECwsLvOtd7+I3fuM3dly3uLjI+973vh2fSZLU8Wdubo7f+73f6/p9/GdxcbFr2b74xS8iSRKf+MQndnzuOA7ve9/7kGWZ3/3d3x1ZXRxUPPHEE/yLf/EvKJVKt7ooY4wxxm0K9VYXYIwxxjg4eOKJJ3jHO97B0aNH+Xt/7+8xNzfHtWvX+Nr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1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# https://docs.opencv.org/3.4/da/df5/tutorial_py_sift_intro.html\n",
"import cv2 as cv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = cv.imread('img/home.jpg')\n",
"gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n",
"\n",
"sift = cv.SIFT_create()\n",
"kp = sift.detect(gray, None)\n",
"img_with_keypoints = cv.drawKeypoints(gray, kp, None, flags=cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)\n",
"\n",
"cv.imwrite('img/sift_keypoints.jpg', img_with_keypoints)\n",
"\n",
"plt.figure(figsize=(8, 8))\n",
"plt.imshow(cv.cvtColor(img_with_keypoints, cv.COLOR_BGR2RGB))\n",
"plt.title(\"SIFT Keypoints\")\n",
"plt.axis(\"off\")\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 10"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW0AAAGiCAYAAAAsv5dDAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9d5Rc2X3fi35OqJy6q3M30EAjpwEwETPDKEYNRYkSeWWJlhwoXzlci/YTn5/v1ZMlmusumZatZcuSScnPliX5mlSkSJqkGMRhmjyYAAxy6pyru3I+Vee8P6p+B7sPqhvADDADDPu3Vq3uqjp1zj777P3dv/39Jc1xHIdN2ZRN2ZRNuStEf6MbsCmbsimbsik3LpugvSmbsimbchfJJmhvyqZsyqbcRbIJ2puyKZuyKXeRbIL2pmzKpmzKXSSboL0pm7Ipm3IXySZob8qmbMqm3EWyCdqbsimbsil3kWyC9qZsyqZsyl0km6C9KZ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w+nw/HcahUKlSrVYqFAv5SibELF4hPTmJms9h9fTTicZr3348eCKxr/FXve1NDuztlE6zfeLmrQVuVjQDyesBwOzntTqJq1EKFCEjW63Xm5+d5/vnneeqpp9zPAEKhEPF4nFqtRrlcJhKJuLSFeo+iXUsVe5XuEC09FAoRi8Vc/npubg5oVb6Px+NEo9FrjKNi+Jw8d45zlQrBfJ5ENIq9YwfO8DBYFmYk4i4a1+v3TcDelDe7bHLat0Fej4hH7yKi/q1UKkAr8KVQKDA9Pc2pU6c
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = cv.imread('img/coins.jpg', cv.IMREAD_GRAYSCALE)\n",
"\n",
"sift = cv.SIFT_create()\n",
"\n",
"kp, des = sift.detectAndCompute(img, None)\n",
"\n",
"img2 = cv.drawKeypoints(img, kp, None, (255, 0, 0), 4)\n",
"plt.imshow(img2)\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAa4AAAGiCAYAAAC/NyLhAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9d6wk+XXf+6ncOd0cJ+eZTbOZyyhSFClRFEnLVhZkPQs2LAE2YRgWYEuWYUB4fg/PenKAANvPlGwFi5IlkQRFUVwxLLmzaXZ3ZnfinXDn5tw5VH5/VFdv3ZrqOzMbRF5ufYFGd1dXV/1Sne8553d+5ye4rusSI0aMGDFi7BKI3+0CxIgRI0aMGPeCmLhixIgRI8auQkxcMWLEiBFjVyEmrhgxYsSIsasQE1eMGDFixNhViIkrRowYMWLsKsTEFSNGjBgxdhVi4ooRI0aMGLsKMX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X43hNadLJGdAi7C3+8l2tK3uIJtIYqiZ6E4DnQ6OIAjyzi+QHddBMfx+sNxIJnEFUUIkJV/bcuyItv5Xtyk/ZQYn7h6pGdZCM0muRdewJmdxbYs9PvvR5icRNA0pMFB1NVVhM1NxBdeQDh6FFeSQFXvqiwx3n2IiSvGXSEYIBDUqAVBQKhWkV56CfW3fxthbc07ZlnYH/oQ1sc+hv3hD+N2J96jsJPwj/ocnlfa0Qp8k2R3J1feTvcOz8/cjSsv6j/+nOK2l20jttswN4cjSTgjI9ipFLbr4nQJQt7cRGy1sKamsBMJXFnuW75
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAa4AAAGiCAYAAAC/NyLhAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9d5Ak2X3f+Ulfvqq97/F2Z+1gLRYLgFoABEgQIng8QSJ5DIpH3jEkRUgIhUKIkIPuIninU5x4lKjQ/SEJ5NGCVgRFwhLALoG1s7uzOzM73rSb9tXlq9K9+yMza7Kzs7p71gBobn4jKqoq7XsvX/78+/0kIYQgQYIECRIk2COQv98NSJAgQYIECe4GCeNKkCBBggR7CgnjSpAgQYIEewoJ40qQIEGCBHsKCeNKkCBBggR7CgnjSpAgQYIEewoJ40qQIEGCBHsKCeNKkCBBggR7CgnjSpAgQYIEewoJ40qQIEGCBHsK3zfG9Wu/9mvs37+fVCrFo48+yosvvvj9akqCBAkSJNhD+L4wrt/7vd/js5/9LP/yX/5LXnnlFe6//34+9rGPsby8/P1oToIECRIk2EOQvh9Jdh999FEefvhh/sN/+A8AuK7L1NQU/+Af/AP+6T/9p9/r5iRIkCBBgj0E9Xt9Q9M0OXPmDJ/73Oe622RZ5umnn+a5556LP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HG+GzNpVIgJEDCuLtOzbaRGg8KLL+LevIlj23Tuvx9pchLJMFAGB9GXlpDW1pBffBHp+HGEooCu76otCd57SBhXgl0hHCDgui7Sxgb6V7+K9oUvoFy5gtTpeEQ1IGLNJuqzz6K89BLq0hLW3/k7nhmohx8
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#https://docs.opencv.org/3.4/df/d0c/tutorial_py_fast.html\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"\n",
"img = cv.imread('img/blox.jpg', cv.IMREAD_GRAYSCALE)\n",
"\n",
"fast = cv.FastFeatureDetector_create()\n",
"kp = fast.detect(img, None)\n",
"img2 = cv.drawKeypoints(img, kp, None, color=(255, 0, 0))\n",
"plt.imshow(img2)\n",
"plt.show()\n",
"\n",
"fast.setNonmaxSuppression(0)\n",
"kp = fast.detect(img, None)\n",
"img3 = cv.drawKeypoints(img, kp, None, color=(255, 0, 0))\n",
"plt.imshow(img3)\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAGFCAYAAAASI+9IAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9eZxkVX03jr+rqmvtvXumZ5/p2RlmGDZZZB0EBUEERE3UiEs0ouGJy6Nx/SYmT/YEEw1iHqOJBEUEIygoi8gyLDPADMwwzL5vva9V1bVX3d8f/fuc+dxPnXPr3uqeEZ/c9+vVr666de+5Z/3s53MClmVZ8OHDhw8fPgAEf9sV8OHDhw8fbxz4TMGHDx8+fCj4TMGHDx8+fCj4TMGHDx8+fCj4TMGHDx8+fCj4TMGHDx8+fCj4TMGHDx8+fCj4TMGHDx8+fCg0u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FEKhEOLxOCqVinFncD2YP38+Ojo6cODAAWVKCgaDajwlnBiD7MO+vj4MDw9jyZIlaGpqMmpulUoF+Xweu3btQi6XQzQaRalUQlNTk+pPmrdcA+QCC1DtFNfVUSeI+CGvb0z45qNTBMuykM/nlWTFFyqZMbjUGw6HEQwGkc/nlSbA/QUAcM0119gWlVdJ1qv9/2Sg1gYwYLKeF1xwQZWtn3DgwAE88cQTtmsNDQ0oFAqq7+g9FJIZjUaRSCRUFE4kEkEwGNRqCjqJeDrAzTpDQ0N48MEHlbbH66HTHGppbqVSCffddx8uuOACnHnmmdr39/T0qH4LBAIoFovKt5BOp5FKpdDY2IhYLIZyuYxYLKYYBB830m6IsVGdZPSUzgzmC5BvPPhM4RRCF80h7fjcDEILdHx8HJlMBseOHcPKlSvR0tI
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# https://docs.opencv.org/3.4/dc/d7d/tutorial_py_brief.html\n",
"import cv2 as cv\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"\n",
"def brief_descriptor(image, keypoints, patch_size=31, pairs=256):\n",
" descriptors = []\n",
" for kp in keypoints:\n",
" x, y = int(kp.pt[0]), int(kp.pt[1])\n",
" patch = image[y - patch_size // 2:y + patch_size // 2 + 1,\n",
" x - patch_size // 2:x + patch_size // 2 + 1]\n",
" if patch.shape != (patch_size, patch_size):\n",
" continue\n",
" patch = cv.GaussianBlur(patch, (5, 5), 0)\n",
" desc = []\n",
" for _ in range(pairs):\n",
" p1 = np.random.randint(0, patch_size, 2)\n",
" p2 = np.random.randint(0, patch_size, 2)\n",
" desc.append(1 if patch[p1[0], p1[1]] < patch[p2[0], p2[1]] else 0)\n",
" descriptors.append(desc)\n",
" return np.array(descriptors, dtype=np.uint8)\n",
"\n",
"img = cv.imread('img/blox.jpg', cv.IMREAD_GRAYSCALE)\n",
"\n",
"fast = cv.FastFeatureDetector_create()\n",
"keypoints = fast.detect(img, None)\n",
"descriptors = brief_descriptor(img, keypoints)\n",
"\n",
"img_with_circles = img.copy()\n",
"for kp in keypoints:\n",
" x, y = int(kp.pt[0]), int(kp.pt[1])\n",
" radius = int(kp.size / 2)\n",
" cv.circle(img_with_circles, (x, y), radius, (255, 0, 0), 2)\n",
"\n",
"plt.imshow(img_with_circles, cmap='gray')\n",
"plt.axis('off')\n",
"plt.show()\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 11"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(290, 32)\n",
"Descriptor size: 32 bytes (default for BRIEF)\n",
"Descriptor shape: (290, 32)\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAa4AAAGiCAYAAAC/NyLhAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOy9Z5Bk2XUe+N1n01Zmma6q9m56emZ6LGbAwYAACLcYgk4ksSuBgYilW1IhiYwVIROCVksKDO4iQqENMihDbawkUgyKThSDIVEkaIYgAXAGbrzp7mnvyldW+nz+7Y+X5/XJ2/dlZXX3ACjM+yIy0r1337XnO+fcc+8VcRzHyJEjR44cOXYJtG90BnLkyJEjR46dICeuHDly5Mixq5ATV44cOXLk2FXIiStHjhw5cuwq5MSVI0eOHDl2FXLiypEjR44cuwo5ceXIkSNHjl2FnLhy5MiRI8euQk5cOXLkyJFjVyEnrhw5cuTIsavwDSOuf/Nv/g2OHDmCQqGAJ598El/5yle+UVnJkSNHjhy7CN8Q4vqd3/kdfPKTn8TP/dzP4YUXXsAjjzyCp59+Gmtra9+I7OTIkSNHjl0E8Y3YZPfJJ5/EO9/5Tvzrf/2vAQBRFOHgwYP46Z/+afyTf/JPvt7ZyZEjR44cuwjG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CZBZbkeNU2DruspGckkttN5yRxvP+TElWMicEGZatQAzC99CebnPw/7P/yH5DohEutqZQXW7/0ezL/8S/TvvRfx0aMQGZssjxP+qs/yvFKWAM36bRKME+iqz6r5m3H5EkJ
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#https://docs.opencv.org/3.4/d1/d89/tutorial_py_orb.html\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"\n",
"img = cv.imread('img/blox.jpg', cv.IMREAD_GRAYSCALE)\n",
"\n",
"orb = cv.ORB_create()\n",
"kp, des = orb.detectAndCompute(img, None)\n",
"\n",
"print(des.shape)\n",
"print(f\"Descriptor size: {des.shape[1]} bytes (default for BRIEF)\")\n",
"print(f\"Descriptor shape: {des.shape}\")\n",
"img_with_keypoints = cv.drawKeypoints(img, kp, None, color=(255, 0, 0))\n",
"plt.imshow(img_with_keypoints)\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAD3CAYAAACAR1dxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9WXBdWXIejH77zPOE4RyMBEAQIEGCM4tkV7FYrK6qrupB3eqhWuqWWvol9R/Xclz7RijCD/fJ4et3h+xwyPYf17JsyZKs7laruqq7uqaugcV5JkGCBEDMOBjOgDPPe9+H07mYJ7HBKvra8T+IKwIB4Jy915ArV+aXuXLl0gzDMPC0PC1Py9PytDwtT8s/2mL5v7sDT8vT8rQ8LU/L0/K0/N9bnoKBp+VpeVqelqflaflHXp6CgaflaXlanpan5Wn5R16egoGn5Wl5Wp6Wp+Vp+UdenoKBp+VpeVqelqflaflHXp6CgaflaXlanpan5Wn5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O/m3WByrcYjRrS4IYsg6tVityuRzi8XjLNht/lrxmDocDhtG0rmkfXfaHeJsDFjOZLcEJnzdaf7wO3idap5xuUvFIC5pkS7lcNpU5ZjSidsiNzo0TM2DA+RPAFoNFej0kwNvOYMvlcmoOzPgOaJUPvE2fzwePx9PSvnxe0pYKn1deN2+T8yW9s518fVz53GAAgIpy5Q1TocETSqvVarh58yaCwSA0TVMgwm63o1qttqAov9+vlC3QVLy1Wk0pBe7epb16m82GSqXSIgTIIiQmJWVEysMwDGX9SeFBxCYQQ8SmBUOInCs2Ais0Zq6
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#https://docs.opencv.org/3.4/dc/dc3/tutorial_py_matcher.html\n",
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img1 = cv.imread('img/box.png', cv.IMREAD_GRAYSCALE)\n",
"img2 = cv.imread('img/box_in_scene.png', cv.IMREAD_GRAYSCALE)\n",
"\n",
"orb = cv.ORB_create()\n",
"kp1, des1 = orb.detectAndCompute(img1, None)\n",
"kp2, des2 = orb.detectAndCompute(img2, None)\n",
"\n",
"bf = cv.BFMatcher(cv.NORM_HAMMING, crossCheck=True)\n",
"matches = bf.match(des1, des2)\n",
"matches = sorted(matches, key=lambda x: x.distance)\n",
"\n",
"img3 = cv.drawMatches(img1, kp1, img2, kp2, matches[:10], None, flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)\n",
"plt.imshow(img3)\n",
"plt.axis('off')\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAD3CAYAAACAR1dxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAEl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qVV/dX7odPIMAw3FswLtOlzpJSPAg+SvtJI08drmib5fN4dixdY0+cJIB6PP8Ab6lP3PEuQpK8B1Y4X4NPnX46lUCi0eUr1OmQsjfouPXapVKoNIMi1L8fsJfd0fpHgUfKw5CXJe/9DPANNO8i271n2V98GTGrhU5SizxM0mwSsVYLVW/gKv8IwTRx/F0T3Q/wQVqgf24iAGcA0/W2Dh11FK4mvJlIpNMdpt6DlYKUykopO1ucV/CKZQPZHtuE4jtu3YDDoWo+SJmpCVb9brVab0tAXmJwcL7e1ZAgv95BulelMJf/XBZsOMrwsRCnIdaDitVjVXOn0lMJFoWnVpgJWuvBWdajtIH1OFD2lF0e1pXih0Wi0jU3SUPKWsjRUXxRgkSBRzaWsfy/3sr6QJZ28FJn+uypyLr1oL+m7FyjwErC64JPfdT7w2gqQz0tvgeRpdY++76/3W86PzjO6QpFrUdJZH4OqV8a96PXtRTepvHTa6d+9+qCKtBi92tJBjLIOfT4fxWKRtbW1tm02ea/ymgWDQRxn17pW++h6fxRvS8CiAywp56SMVUWtP1mH7JNap5JuuuLRLWglW2q1mqfM8aKRake50aVx4gUMJH8CDxgsutdDB3h7GWzFYtGdAy++g3b5INuMx+NEo9G29vX7ddqqIudV1i3b1IGTF3j7LOU
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img1 = cv.imread('img/box.png', cv.IMREAD_GRAYSCALE)\n",
"img2 = cv.imread('img/box_in_scene.png', cv.IMREAD_GRAYSCALE)\n",
"\n",
"sift = cv.SIFT_create()\n",
"kp1, des1 = sift.detectAndCompute(img1, None)\n",
"kp2, des2 = sift.detectAndCompute(img2, None)\n",
"\n",
"bf = cv.BFMatcher()\n",
"matches = bf.knnMatch(des1, des2, k=2)\n",
"\n",
"good_matches = []\n",
"for m, n in matches:\n",
" if m.distance < 0.75 * n.distance:\n",
" good_matches.append([m])\n",
"\n",
"img3 = cv.drawMatchesKnn(img1, kp1, img2, kp2, good_matches, None, flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)\n",
"plt.imshow(img3)\n",
"plt.axis('off')\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAD3CAYAAACAR1dxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9Z5hk13XfC//qVI7d1dU5z0z35BwwGACDnEGCIJgpihJpJcqy/FrXlpyt63QtyTYl+7VEZSaBEYEgACINgJnBREzOuXOO1ZXDOef90L0Lq/ecBoH7+j73g2Y/Tz2Vztl77bVX+K+1w3HZtm1zq9wqt8qtcqvcKrfK39ti/L9NwK1yq9wqt8qtcqvcKv/vlltg4Fa5VW6VW+VWuVX+npdbYOBWuVVulVvlVrlV/p6XW2DgVrlVbpVb5Va5Vf6el1tg4Fa5VW6VW+VWuVX+npdbYOBWuVVulVvlVrlV/p6XW2DgVrlVbpVb5Va5Vf6el1tg4Fa5VW6VW+VWuVX+nhfPh72wrq4Ol8sFQKlUwuVy4Xa7AXC73ZTL5cr/LpcL27axbRvDMLBtu/Kf/F39p17qXsMwFl1r2zYejweXy4Vpmov+V++WZS1qQ75LmlwuV+Wl6lH3lsvlyvWKPsuysG0bt9tduV/WY1lWpS3VH9WeLDo/ZN8ljbIfkjZ5vWpbtqXoVP/JNuVv6ndZh6RN1SN5pvNP9k8/s0p9NwzjprGS9+j9kfTrNEk6JI2KL5ZlVcZBXSOLvF9dZ1lW5Tr1v6pL/aZk2jAM6uvrCQQCi/ioy6rqk6xD9kPyTdZTLpcXyY7b7a58L5fLi+RZ3Sf7q/Peabx1nZFjpNo0TbPSRj6fp1gs4vF4cLvd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1yE0fTDlg6jeZSZAdVxG5qkfVqTsM6chkH3VjoAZApbwk86WRlgZZKjK8bwx0AZIOWdGv3qUhlkKrX+uUDVBt6oZO54MOUKQhk1MNKrpQ18p5ND0SluBH8j4QCFR4J9tz4rUeFer/S+ep6lS0KyMoM1ESBMo2FY/VWBaLRWqGhnj67/6OzI4djNg260+e5LfKZf4AsBwiLCdFkyBUHy/JG51fUuFl0VO+ToZH560TryXd8hrdYKhrnKIKqYe6Pi81jffz+OVkDGX/nJyGzgfZF30cZDu6jil6ZRtOPJTXS8em7nfin65LekZI58vc3BwTExOLeAjz8p7P5yu2tFAoLJp6lXbT7XYvytIqenU6dB65XK7KWjAn0KaPkWmaVJfLrO/ro1xTw0hjI6a9ODiR/ZM0JJPJSl+cwJo+TgCRSOQm2VDveuZZgiRdB1Q7ToBPH3/Zl7m5uUWZUr0OuZZGfZYZu6qqqkUAQeq+7LOT3dPlRYJHKcNSlqTs/T+SGShZYdbPPM7++tcgH+COS83sCn6VXI2PodAQF0IX2BPYgxs3CTNBV7GLteW1NJqNBMtBfLYPj8uzqPMw72gl89VAKodm24sjaNlZ6Yyko5P1OS1+kUIg6ZFt2LZdoc3n81WiR8kTNaCK7nK5vCj1pCuYHByntLUUCKf0kB6V6UIlv+uGTQcZThGiNOQ6UHFSVjVWOj+lcVFoWrWpgJVuvFUdajpIHxPFT5nFUW0pWSgWi4v6JnkoZUtFGooWBVg2HD9ObanEufZ2Bjs7+fiVK3gX5jil8ulFV2TJJydHpv+vihxLJ95L/i4FCpwMrG745GddDpymAuT9MlsgZVpdo8/763TL8dFlRo63blAln/U+qHrluhe9vqX4Jp2Xzjv9sxMNqsiI0aktHcSo6NDtdpNKpRgZGVk0zSavVVkzn8+Hbc9H12oeXadHybYELDrAknZO2lhVlP7JOiRNiWKRL46OUhcKERsaonpmhovr1iFDLD2CVrYln8872hwnHil7oNLoMjh
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img1 = cv.imread('img/box.png', cv.IMREAD_GRAYSCALE)\n",
"img2 = cv.imread('img/box_in_scene.png', cv.IMREAD_GRAYSCALE)\n",
"\n",
"sift = cv.SIFT_create()\n",
"kp1, des1 = sift.detectAndCompute(img1, None)\n",
"kp2, des2 = sift.detectAndCompute(img2, None)\n",
"\n",
"FLANN_INDEX_KDTREE = 1\n",
"index_params = dict(algorithm=FLANN_INDEX_KDTREE, trees=5)\n",
"search_params = dict(checks=50)\n",
"flann = cv.FlannBasedMatcher(index_params, search_params)\n",
"\n",
"matches = flann.knnMatch(des1, des2, k=2)\n",
"\n",
"matchesMask = [[0, 0] for _ in range(len(matches))]\n",
"for i, (m, n) in enumerate(matches):\n",
" if m.distance < 0.7 * n.distance:\n",
" matchesMask[i] = [1, 0]\n",
"\n",
"draw_params = dict(matchColor=(0, 255, 0),\n",
" singlePointColor=(255, 0, 0),\n",
" matchesMask=matchesMask,\n",
" flags=cv.DrawMatchesFlags_DEFAULT)\n",
"\n",
"img3 = cv.drawMatchesKnn(img1, kp1, img2, kp2, matches, None, **draw_params)\n",
"plt.imshow(img3)\n",
"plt.axis('off')\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Краткое описание методов:\n",
"\n",
" Brute-Force Matching с ORB:\n",
" Используется Hamming Distance для бинарных дескрипторов.\n",
" Подходит для ORB, BRIEF, BRISK.\n",
"\n",
" Brute-Force Matching с SIFT:\n",
" Используется L2 расстояние для вещественных дескрипторов.\n",
" Применяется knnMatch и тест отношения Дэвида Лоу (Ratio Test).\n",
"\n",
" FLANN Matcher:\n",
" Быстрее для больших наборов данных.\n",
" Использует K-D деревья для вещественных дескрипторов (например, SIFT, SURF).\n",
" Использует LSH для бинарных дескрипторов (например, ORB)."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEU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Ubv69FPziXpEZJ0SaVSiEQiDTQE6vxeKBSULC0Wiw1Lr1xuSi8ttVe2Q9LIYDCoWDA90CbHiJQPgQdOX26kyf4ajUYkk0nVFz2wJscJANxu9yO8QZ/S88xBkpwDVI8e4JPjz/tCS+J8+ZuXwWNp6Dv32Pl8vgaAwOc+77Oe3JP8wsEj52HOS5z3/od4BkjJy8mqaVqD6wJAg8XHwYBkHKCuaDnxgYcuauo8t6B5Z7ky4oqOl6cX/EK/U+K/80GktlmtVmU9cprQgFK7K5VKAx3kBOODo+e25gyh5x6SVplkKv6/FGwSZOhZiFyQS6CiN1lprCQ9uXAhNE11ErCSwpvKoOUgOSZET+7FobqIF0qlUkPfOA05b5GlQW0hwMJBIo0lL38r97KcyJxOeopM/k6Jj6Ue7Tl9twIFegJWCj7+XfKBtPLk+9xbwHma8sh1f9luPj6SZ6RC4XOR01n2gcrlcS+yvK3oxpWXpJ38rtcGStxi1KtLghiyDk0mE9LpNMLhcMMyG89LXjOr1QpNq1vXtI4u20O8zQGLnsyW4ISPG80/XgZvE81TTjepeKQFTbKlUCjoyhw9GlE95EbnxokeMOD8CeARg0V6PSTA28pgS6fTagz0+A5olA+8TrfbDafT2VC/zC9pS4mPKy+b18n5kt7ZSr4+Ln1mMABARbnyiilR5wmllctl3Lx5Ez6fDwaDQYEIi8WCUqnUgKI8Ho9StkBd8ZbLZaUUuHuX1urNZjOKxWKDECCLkJiUlBEpD03TlPUnhQcRm0AMEZsmDCFyrtgIrFCfuaKWil4KHxooyai
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#https://docs.opencv.org/3.4/d1/de0/tutorial_py_feature_homography.html\n",
"import numpy as np\n",
"import cv2 as cv\n",
"from matplotlib import pyplot as plt\n",
"\n",
"MIN_MATCH_COUNT = 10\n",
"\n",
"img1 = cv.imread('img/box.png', cv.IMREAD_GRAYSCALE) # queryImage\n",
"img2 = cv.imread('img/box_in_scene.png', cv.IMREAD_GRAYSCALE) # trainImage\n",
"\n",
"sift = cv.SIFT_create()\n",
"\n",
"kp1, des1 = sift.detectAndCompute(img1, None)\n",
"kp2, des2 = sift.detectAndCompute(img2, None)\n",
"\n",
"FLANN_INDEX_KDTREE = 1\n",
"index_params = dict(algorithm=FLANN_INDEX_KDTREE, trees=5)\n",
"search_params = dict(checks=50)\n",
"\n",
"flann = cv.FlannBasedMatcher(index_params, search_params)\n",
"\n",
"matches = flann.knnMatch(des1, des2, k=2)\n",
"\n",
"good = []\n",
"for m, n in matches:\n",
" if m.distance < 0.7 * n.distance:\n",
" good.append(m)\n",
"\n",
"if len(good) > MIN_MATCH_COUNT:\n",
" src_pts = np.float32([kp1[m.queryIdx].pt for m in good]).reshape(-1, 1, 2)\n",
" dst_pts = np.float32([kp2[m.trainIdx].pt for m in good]).reshape(-1, 1, 2)\n",
"\n",
" M, mask = cv.findHomography(src_pts, dst_pts, cv.RANSAC, 5.0)\n",
" matchesMask = mask.ravel().tolist()\n",
"\n",
" h, w = img1.shape\n",
" pts = np.float32([[0, 0], [0, h - 1], [w - 1, h - 1], [w - 1, 0]]).reshape(-1, 1, 2)\n",
" dst = cv.perspectiveTransform(pts, M)\n",
"\n",
" img2 = cv.polylines(img2, [np.int32(dst)], True, 255, 3, cv.LINE_AA)\n",
"else:\n",
" print(f\"Not enough matches are found - {len(good)}/{MIN_MATCH_COUNT}\")\n",
" matchesMask = None\n",
"\n",
"draw_params = dict(matchColor=(0, 255, 0),\n",
" singlePointColor=None,\n",
" matchesMask=matchesMask,\n",
" flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)\n",
"\n",
"img3 = cv.drawMatches(img1, kp1, img2, kp2, good, None, **draw_params)\n",
"\n",
"plt.imshow(img3, 'gray')\n",
"plt.axis('off')\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Лаба 12"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"#https://docs.opencv.org/3.4/db/d28/tutorial_cascade_classifier.html\n",
"import cv2 as cv\n",
"\n",
"def detectAndDisplay(frame):\n",
" frame_gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)\n",
" frame_gray = cv.equalizeHist(frame_gray)\n",
"\n",
" faces = face_cascade.detectMultiScale(frame_gray)\n",
" for (x, y, w, h) in faces:\n",
" center = (x + w // 2, y + h // 2)\n",
" frame = cv.ellipse(frame, center, (w // 2, h // 2), 0, 0, 360, (255, 0, 255), 4)\n",
"\n",
" faceROI = frame_gray[y:y + h, x:x + w]\n",
" eyes = eyes_cascade.detectMultiScale(faceROI)\n",
" for (x2, y2, w2, h2) in eyes:\n",
" eye_center = (x + x2 + w2 // 2, y + y2 + h2 // 2)\n",
" radius = int(round((w2 + h2) * 0.25))\n",
" frame = cv.circle(frame, eye_center, radius, (255, 0, 0), 4)\n",
"\n",
" cv.imshow('Capture - Face detection', frame)\n",
"\n",
"face_cascade = cv.CascadeClassifier()\n",
"eyes_cascade = cv.CascadeClassifier()\n",
"\n",
"face_cascade_name = 'data/haarcascade_frontalface_alt.xml'\n",
"eyes_cascade_name = 'data/haarcascade_eye_tree_eyeglasses.xml'\n",
"\n",
"if not face_cascade.load(cv.samples.findFile(face_cascade_name)):\n",
" print('--(!)Error loading face cascade')\n",
" exit(0)\n",
"if not eyes_cascade.load(cv.samples.findFile(eyes_cascade_name)):\n",
" print('--(!)Error loading eyes cascade')\n",
" exit(0)\n",
"\n",
"cap = cv.VideoCapture(0)\n",
"if not cap.isOpened():\n",
" print('--(!)Error opening video capture')\n",
" exit(0)\n",
"\n",
"while True:\n",
" ret, frame = cap.read()\n",
" if frame is None:\n",
" print('--(!) No captured frame -- Break!')\n",
" break\n",
"\n",
" detectAndDisplay(frame)\n",
"\n",
" if cv.waitKey(1) & 0xFF == ord('q'): # Нажмите 'q' для выхода\n",
" break\n",
"\n",
"cap.release()\n",
"cv.destroyAllWindows()\n",
"\n"
]
},
{
"attachments": {
"image.png": {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0jAPi/sLyrfL782nkZf+HKevM73l/96ouF49X6EnjnQ+ZZ/R4iWLwswPzjGZ2g46GlEefit91cPSvcJ/1i/FksXsJCuo6Dv/NwNcqS8d726k7YI3dso4UWWmihhRYeW9CcOHhYJwxaaKGFFlpo4QHAopMGebXNRM9o6V05U3oHZsqK/unSK2c42p0wAM4/aXs5d/3Z9esY8KwLynn1dTF4wTtzm/+l5VXvelPD+Jfh+qZS3kPYLX9Yyq/9jMJeUN5JvDweMG/7wlLw+XLdBe8R/neWF2DYnvfB8pI8WnBpKW96QIZtNaoXGM6LlwXD/LzywZfcUsNy18Xx0EKc2KlBnPeUD8qgT1gs/XmL8GepfBaj6/74O58e6uW6FzYnbMSXG36k5vOq8vlf+wOlaKGFFlpo4dEOOZ7dn2uhhRZaaKGFFh4fsPidBhU8WSDX249rTBpIV2huVDt3wzl29wufv6HcUl8XhY/myjQr3E2Q4fqe1xYfpT/3teWNr/p8ueGYiJaCZ5WX/EA9kH/rzeW6psH/wneJvAVIj2f1P43qjrFdvRcrS91t8caFlwIcFy2K86w/LK+r+M997Rtl0Fc4nvTAUvGWoutYYFyNnSP3qRfxJYl9wY8o5nXl5gcyJ9NCCy200MIjCjme3Z9r4aGD5pGE5lGFFlpooYUWWng0wDEnDWLCICYL+nj2xaRBKAupMBwt0zMzZWJisn4vAef+QHnJs95V/m6p5WYM9BeWcqmVkVvKHz6r+t8Hbi03X1dfHzS8quZX3cLVdF/8l+HsTjhOOO6yNOF+
}
},
"cell_type": "markdown",
"metadata": {},
"source": [
"![image.png](attachment:image.png)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAw4AAAMsCAYAAAD9JvVwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQ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dN66ijjjrq6H+n1OU4dNRRRx111FFHHXXUUUc3Upfj0FFHHXXUUUcdddRRRx3dSJ3h0FFHHXXUUUcdddRRRx3dSJ3h0FFHHXXUUUcdddRRRx3dSNsnR3+GTxrtqKOOOuqoo4466qijjv4roS3SnjuPQ0cdddRRRx111FFHHXV0I3WGQ0cdddRRRx111FFHHXV0I3WGQ0cdddRRRx111FFHHXV0I3WGQ0cdddRRRx111FFHHXV0I22dHP1rf/L/CgBQUAAUtFYih4ISp7VSUEpBaw1rLaw1/veZzqC1hnJJ1quqgjEGdP6cAqdeW1goZQFlAdCrrms0TYPpdIblcomLi0vMF3PMpjMopaGUxtHRIYbDEY6OT1AUBbTOAGvhz7dTgFYaSivkeQ6tFZqmhjEGdV3zw127LaAA5fqjlIryRaxrmrEG1ljfJ6jQDyjlxgPQWvkxMqaBMRZN08BaG8ZMaWqjDrac5RGx/pY0ViJR3RoLawze/D//Cg5eeXnb6fR0NRzi//ff/XeYWIvLq0tkWYYizzAYDNHr9VCvVmiMgTUGWmuMhoPo+QpAlmXQmYZxffLvruEKgHHjqtw
"text/plain": [
"<Figure size 1000x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#https://docs.opencv.org/3.4/d6/d10/tutorial_py_houghlines.html\n",
"import cv2 as cv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = cv.imread('img/sudoku.png')\n",
"gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n",
"edges = cv.Canny(gray, 50, 150, apertureSize=3)\n",
"\n",
"lines = cv.HoughLines(edges, 1, np.pi / 180, 200)\n",
"for line in lines:\n",
" rho, theta = line[0]\n",
" a = np.cos(theta)\n",
" b = np.sin(theta)\n",
" x0 = a * rho\n",
" y0 = b * rho\n",
" x1 = int(x0 + 1000 * (-b))\n",
" y1 = int(y0 + 1000 * (a))\n",
" x2 = int(x0 - 1000 * (-b))\n",
" y2 = int(y0 - 1000 * (a))\n",
" cv.line(img, (x1, y1), (x2, y2), (0, 0, 255), 2)\n",
"\n",
"plt.figure(figsize=(10, 10))\n",
"plt.imshow(cv.cvtColor(img, cv.COLOR_BGR2RGB))\n",
"plt.title(\"Hough Lines\")\n",
"plt.axis(\"off\")\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAw4AAAMsCAYAAAD9JvVwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9edRtWVUfDP/W2nuf/jz9c++tSxVUpaD4JBT4vmgSIgQQhigq9ohfjGBgoCZIHDEZH0ZfBYZKYoeKAWJMClSMvGpMRcWAvIIYxRHbiPqiRVN91e2e9rS7Wev7Y6651tzr7HMbQEHdE5567nPOblY715y/2SlrrUVLLbXUUksttdRSSy211NJVSH+qG9BSSy211FJLLbXUUkstffpTqzi01FJLLbXUUksttdRSS9ekVnFoqaWWWmqppZZaaqmllq5JreLQUksttdRSSy211FJLLV2TWsWhpZZaaqmlllpqqaWWWromtYpDSy211FJLLbXUUksttXRNahWHllpqqaWWWmqppZZaauma1CoOLbXUUksttdRSSy211NI1qVUcWmqppZZaaqmlllpqqaVrUqs4tNRSS38rSCmFV77ylZ+05731rW+FUgq/93u/d81rn/3sZ+PZz362//vee++FUgpvfetb/Wevec1roJT6pLXvpS99KW699dZP2vP+uhCP7Q/8wA/8pb5HKYXXvOY1f6nvaKmlllr6dKNWcWippZY+ZcTCN//0ej3ccccdeOUrX4kLFy58qpv3aU8PP/wwXvOa1+CP/uiP/lLf89KXvhSj0Wjt959spexTSe973/uglMLP//zPf6qb0lJLLbX0aUfpp7oBLbXUUkuve93rcNttt2GxWOB//s//iTe/+c145zvfiT/5kz/BYDD4VDfvE6Z3v/vd17zmO77jO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5je+c534ty5c7X4lCzL8KpXvQqTyQS/8Ru/cUNtf/jhh/HBD34QX/d1X1fL7vSsZz0Ld955Z+M9X/3VX43t7W3/N1tkPvrRj97Qu2+UvvEbv7H29zOf+UxcuXIFJycnAID/+l//K4wxeNGLXoTLly/7n3PnzuEJT3gC3vve9wKAtyi8613vanR1aqmlllr6VFDrqtRSSy19yunf//t/jzvuuANpmuLs2bN44hOfCK3ruEaaprj55ptrn9133304f/48xuNx7fPP+IzP8N9LesITnrDy7jvuuAOz2QyXLl3CuXPnMJ/P8frXvx533XUXHnrooVqsRJNvefzM0WiEm266aW1MxPXSV3/1V+MnfuIn8PKXvxyvfvWr8dznPhdf/uVfjq/8yq9cGZvroY985CM4f/48dnZ2Pq72JEmC5z3vedd17X333YcnPOEJK+1cNy/X8zwAePzjH7/y3eMf//hGhe6xj31s7W9WIuL4k082Xe29GxsbuOeee2CtbVyLQAhqv+222/Av/+W/xA/90A/h7W9/O575zGfihS98Ib72a7+2dVNqqaWWPmXUKg4ttdTSp5z+3t/7e9f0se92ux+XwHyj9M3f/M2466678C3f8i14+tOfjs3NTSil8OIXv/ivNL1pv9/H+9//frz3ve/Fr/zKr+B//I//gXe84x343M/9XLz73e9GkiR/ZW35y6J1lg62/nwitG587Jqg+U8WXeu9xhgopfCrv/qrjddKi8oP/uAP4qUvfSnuvvtuvPvd78arXvUqvP71r8fv/M7vrCjRLbXUUkt/FdQqDi211NJfW3rc4x6H97znPTg9Pa1ZHT70oQ/57yXdc889K8/4i7/4CwwGA+zv7wMAfv7nfx4veclL8IM/+IP+msVigaOjo8Y23HPPPXjOc57j/55MJnjkkUfwghe84OPuF5P
"text/plain": [
"<Figure size 1000x1000 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import cv2 as cv\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = cv.imread('img/sudoku.png')\n",
"gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n",
"edges = cv.Canny(gray, 50, 150, apertureSize=3)\n",
"\n",
"lines = cv.HoughLinesP(edges, 1, np.pi / 180, 100, minLineLength=100, maxLineGap=10)\n",
"for line in lines:\n",
" x1, y1, x2, y2 = line[0]\n",
" cv.line(img, (x1, y1), (x2, y2), (0, 255, 0), 2)\n",
"\n",
"plt.figure(figsize=(10, 10))\n",
"plt.imshow(cv.cvtColor(img, cv.COLOR_BGR2RGB))\n",
"plt.title(\"Probabilistic Hough Lines\")\n",
"plt.axis(\"off\")\n",
"plt.show()\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnwAAAKSCAYAAABIowakAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACVU0lEQVR4nOzdd5wkVbk38N+pqo6T88zmwC4L7LJLDgtLFhREkCCgKAYUhavgRX0FE2JGRUQviAG9IFevAgooKJcgBkCWzAZYdpeFDZN3QvfMdKg67x81p6a6p7unJ3Sc33c/89mu6uruMz3dXU+fc57zCCmlBBERERGVLa3QDSAiIiKi3GLAR0RERFTmGPARERERlTkGfERERERljgEfERERUZljwEdERERU5hjwEREREZU5BnxEREREZY4BHxEREVGZY8BHRATg+OOPx/HHHz+j9/nLX/4SQgi88cYbM3J/b7zxBoQQ+OUvfzkj90dEswcDPqJZQgUf6sfv92POnDk49dRT8cMf/hCDg4NTvu+NGzfiK1/5yowFNun861//wle+8hX09fXl9HEmYpombr/9dhx//PGor6+Hz+fDokWL8MEPfhDr168vaNuIiFJhwEc0y3z1q1/FHXfcgVtuuQX/8R//AQC48sorsWrVKrz00ktTus+NGzfiuuuuy0vAd9111xU04BseHsYZZ5yBD33oQ5BS4pprrsEtt9yC97///XjyySdx+OGHY+fOnQCAiy++GMPDw1i4cGHB2ktEBABGoRtARPn19re/HYceeqiz/fnPfx6PPvoozjjjDJx55pnYtGkTAoFAAVtY3D7zmc/goYcewo033ogrr7wy4bovf/nLuPHGG51tXdeh63rG+5NSYmRkhM85EeUUe/iICCeeeCK++MUvYseOHbjzzjsTrtu8eTPOPfdc1NfXw+/349BDD8V9993nXP/LX/4S5513HgDghBNOcIaMH3/8ceeYBx98EMceeywqKipQVVWF008/HRs2bBjXjs2bN+P8889HU1MTAoEA9t13X1x77bUAgK985Sv4zGc+AwBYvHix8zjuXsU777wThxxyCAKBAOrr63HBBRfgrbfeGvc4t912G5YuXYpAIIDDDz8cf//737N6nnbu3Imf/OQnOOWUU8YFe4Ad4F199dWYN2+e89wkt3HRokU444wz8Je//AWHHnooAoEAfvKTnwAA+vr6cNVVV2HRokXw+XyYN28e3v/+96O7uztjuyb6GwFALBbDddddh2XLlsHv96OhoQHHHHMMHn744ax+dyIqbQz4iAiAPfwIAH/961+dfRs2bMCRRx6JTZs24f/9v/+H733ve6ioqMBZZ52Fe++9FwCwbt06fPKTnwQAXHPNNbjjjjtwxx13YL/99gMA3HHHHTj99NNRWVmJb3/72/jiF7+IjRs34phjjkkIhF566SUcccQRePTRR3HppZfipptuwllnnYX7778fAPDud78bF154IQDgxhtvdB6nqakJAPD1r38d73//+7Fs2TJ8//vfx5VXXolHHnkE69atSxgC/vnPf46PfexjaG1txXe+8x2sXbsWZ555ZsrAMNmDDz6IeDzuPFdT9eqrr+LCCy/EKaecgptuuglr1qxBKBTCsccei5tvvhlve9vbcNNNN+Gyyy7D5s2bnSHiVLL5GwF2wHzdddfhhBNOwI9+9CNce+21WLBgAZ577rlp/S5EVCIkEc0Kt99+uwQgn3nmmbTH1NTUyIMOOsjZPumkk+SqVavkyMiIs8+yLHn00UfLZcuWOft+97vfSQDyscceS7i/wcFBWVtbKy+99NKE/e3t7bKmpiZh/7p162RVVZXcsWNHwrGWZTmXb7jhBglAbt++PeGYN954Q+q6Lr/+9a8n7H/55ZelYRjO/mg0Kpubm+WaN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E2699VZEo1HnmF/+8pdZLeY8f/58XHrppfjrX/+Km2++edz1lmXhe9/7Xsas2nTOOeccvPjiiwmZte7fIZXJ/I3Uc6BUVlZin332QSQSmXRbiaj0sIePaJZ58MEHsXnzZsTjcXR0dODRRx/Fww8/jIULF+K+++6D3+93jv3xj3+MY445BqtWrcKll16KJUuWoKOjA08++SR27tyJF198EQCwZs0a6LqOb3/72+jv74fP58OJJ56I5uZm3HLLLbj44otx8MEH44ILLkBTUxPefPNN/OlPf8LatWvxox/9CADwwx/+EMcccwwOPvhgfPSjH8XixYvxxhtv4E9/+hNeeOEFAMAhhxwCALj22mtxwQUXwOPx4J3vfCeWLl2Kr33ta/j85z+PN954A2eddRaqqqqwfft23HvvvfjoRz+Kq6++Gh6PB1/72tfwsY99DCeeeCLe8573YPv27bj99tuzmsMHAN/73vewdetWfPKTn8Q999yDM844A3V1dXjzzTfxu9/9Dps3b8YFF1ww6b/LZz7zGfz+97/Heeedhw996EM45JBD0Nvbi/vuuw+33npr2t7HbP9G+++/P44//ngccsghqK+vx/r16/H73/8eV1xxxaTbSkQlqHAJwkSUT2qJEPXj9Xpla2urPOWUU+RNN90kBwYGUt5u69at8v3vf79sbW2VHo9Hzp07V55xxhny97//fcJxP/3pT+WSJUukruvjlmh57LHH5Kmnnipramqk3++XS5culZdccolcv359wn288sor8uyzz5a1tbXS7/fLfffdV37xi19MOOb666+Xc+fOlZqmjVvy5O6775bHHHOMrKiokBUVFXLFihXy8ssvl6+++mrCffzXf/2XXLx4sfT5fPLQQw+VTzzxhDzuuOMmXJZFicfj8mc/+5k89thjZU1NjfR4PHLhwoXygx/8YMKSLemWZUm3PEpPT4+84oor5Ny5c6XX65Xz5s2TH/jAB2R3d7eUMvWyLFJm9zf62te+Jg8//HBZW1srA4GAXLFihfz6178uo9FoVr8zEZU
"text/plain": [
"<Figure size 800x800 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#https://docs.opencv.org/3.4/da/d53/tutorial_py_houghcircles.html\n",
"import numpy as np\n",
"import cv2 as cv\n",
"import matplotlib.pyplot as plt\n",
"\n",
"img = cv.imread('img/geometric_shapes.jpg', cv.IMREAD_GRAYSCALE)\n",
"assert img is not None, \"Image could not be read. Check the file path.\"\n",
"\n",
"img = cv.medianBlur(img, 5)\n",
"cimg = cv.cvtColor(img, cv.COLOR_GRAY2BGR)\n",
"\n",
"circles = cv.HoughCircles(img, cv.HOUGH_GRADIENT, 1, 20,\n",
" param1=50, param2=30, minRadius=0, maxRadius=0)\n",
"\n",
"if circles is not None:\n",
" circles = np.uint16(np.around(circles))\n",
" for i in circles[0, :]:\n",
" cv.circle(cimg, (i[0], i[1]), i[2], (0, 255, 0), 2) # Draw the circle\n",
" cv.circle(cimg, (i[0], i[1]), 2, (0, 0, 255), 3) # Draw the center\n",
"\n",
"plt.figure(figsize=(8, 8))\n",
"plt.imshow(cv.cvtColor(cimg, cv.COLOR_BGR2RGB))\n",
"plt.title(\"Detected Circles\")\n",
"plt.axis(\"off\")\n",
"plt.show()\n"
]
}
],
"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.11"
}
},
"nbformat": 4,
"nbformat_minor": 2
}