computer-vision/opencv.ipynb

422 lines
770 KiB
Plaintext
Raw Normal View History

2019-12-08 03:13:45 +00:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Basic opencv\n",
"=================="
]
},
{
"cell_type": "code",
"execution_count": 10,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fe60c10f810>"
2019-12-08 03:13:45 +00:00
]
},
"execution_count": 10,
2019-12-08 03:13:45 +00:00
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW8AAAD8CAYAAAC4uSVNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOy9v8t125bn9RljzLWfc++tyixF2gYNBFMTDYwFwaDRSA0MBCvqQDARI6FTf2AkXNFAEE00kobGv0BaTfzRKI0gtjRio9Ba977PXnOMYfAdcz/vuXXOqbKqD30u9cxL1Tnnffdee6255hw/vuM7vtO6m8/xOT7H5/gcv13D/27fwOf4HJ/jc3yO///j03h/js/xOT7Hb+H4NN6f43N8js/xWzg+jffn+Byf43P8Fo5P4/05Psfn+By/hePTeH+Oz/E5Psdv4fjRjLeZ/VNm9j+Z2V83s3/tx/qdz/E5Psfn+LM47MfgeZtZAP8z8E8CfwP4q8A/393/49/xH/scn+NzfI4/g+PHirz/MeCvd/f/0t1P4D8F/sKP9Fuf43N8js/xZ26sH+m6fw743776778B/OPf9+Fvvln9u7/7RhsYgBk2CUHTfCQHNn+vv/l6KIOw19/pk/MZm++9/qRp0G+YQeu/+ToLMfv4V+zbn9O355rnNz++3/P7/a17NF2yP+7n/Obc+bc+76/f//hnd3/rcx+f/7jex5P+xviYGs3pa+K++olv/ZrNd+yreftqjuxjfv/QZ75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WiTKrtgk3sFdtyIvAJbSYLv0dKHfXy4IY1dNJuFQhtl
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import cv2\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"\n",
"img = cv2.imread('sheep.png')\n",
"\n",
"plt.imshow(img[:,:,::-1])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"load images (matlab equiv)"
]
},
{
"cell_type": "code",
"execution_count": 20,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"numpy.ndarray"
]
},
"execution_count": 20,
2019-12-08 03:13:45 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(img)"
]
},
{
"cell_type": "code",
"execution_count": 21,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([82, 88, 87], dtype=uint8)"
2019-12-08 03:13:45 +00:00
]
},
"execution_count": 21,
2019-12-08 03:13:45 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"px = img[100, 100]\n",
"px"
]
},
{
"cell_type": "code",
"execution_count": 22,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fd67a6bc490>"
2019-12-08 03:13:45 +00:00
]
},
"execution_count": 22,
2019-12-08 03:13:45 +00:00
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW8AAAD8CAYAAAC4uSVNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOy9W6xtSZae9UXMudbe55pZWZWZVV2Xru52d+MrxmouxpaAB8ASCGMjGWw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mtT5aJ30RhdIMO0ipF4t3usAVQpiKWGQlpluA0aaht/L9rUVgQGAq2GIQE9d5HhmRBselo8AyJKyNR6LVlch/JuHVah02WJ/XNcxnstxJj7teRf925SVrkFl/j+vivs0uLPvY+1SFnwvjiTVKP3QMYOCIPn9Vqq4hoTJYXjPqYxzkPx77qvwd+iPbwQv0/qsA09sKza35KzlGeP3TKxju91Gd9i4CTvoaD1me6HGIBdcZgyydgHXH/XApY3L6Gi5J4XWLYhTEWTZe61SJjM/RZbwj4UqIM2ICUiIWlCEEaFq5BS3cdn7cpbsZsntytU2liALoHoUlq7LQXxHtWovg3DQofzLmNha8xAEA7WAOllONhjpQUDaeRn+7d+t03ctJHWrvt0YhPaQFVINzdRjZ+rTWnjlV6KFbzG2DVfXlaQN2QqoZN0CKehfPqEZk5neRVaQ09JEX1TpjnONdYa5Ibqw2X1Y8s5vKWC1q2NuV/kwSRSnzbZVgIptgkBMlEnDrDXHuC+IvmUkisaRxptxiYGoW57S0b/iwDKFuOmyTDYUEmeu/hS3+xgzrQ
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"img[100:300, 100:200] = [255, 0, 0]\n",
"img[:, :, 2] = 0\n",
"plt.imshow(img[:,:,::-1])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"set pixels red"
]
},
{
"cell_type": "code",
"execution_count": 23,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(213, 320, 3)\n",
"uint8\n"
]
}
],
"source": [
"print(img.shape)\n",
"print(img.dtype)"
]
},
{
"cell_type": "code",
"execution_count": 24,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([[0, 0, 0, ..., 0, 0, 0],\n",
" [0, 0, 0, ..., 0, 0, 0],\n",
" [0, 0, 0, ..., 0, 0, 0],\n",
" ...,\n",
" [0, 0, 0, ..., 0, 0, 0],\n",
" [0, 0, 0, ..., 0, 0, 0],\n",
" [0, 0, 0, ..., 0, 0, 0]], dtype=uint8),\n",
" array([[103, 103, 104, ..., 104, 103, 102],\n",
" [103, 102, 104, ..., 104, 105, 102],\n",
" [101, 101, 103, ..., 105, 103, 102],\n",
" ...,\n",
" [104, 102, 86, ..., 116, 87, 86],\n",
" [117, 90, 79, ..., 83, 71, 100],\n",
" [210, 97, 87, ..., 84, 108, 101]], dtype=uint8),\n",
" array([[ 53, 53, 53, ..., 49, 52, 49],\n",
" [ 51, 50, 52, ..., 46, 46, 45],\n",
" [ 50, 48, 52, ..., 49, 49, 47],\n",
" ...,\n",
" [ 51, 42, 19, ..., 57, 35, 35],\n",
" [ 77, 37, 19, ..., 30, 28, 43],\n",
" [173, 52, 26, ..., 27, 56, 46]], dtype=uint8))"
]
},
"execution_count": 24,
2019-12-08 03:13:45 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"b, g, r = cv2.split(img)\n",
"r, g, b"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"fairly expensive"
]
},
{
"cell_type": "code",
"execution_count": 25,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [],
"source": [
"img = cv2.merge((b, g, r))"
]
},
{
"cell_type": "code",
"execution_count": 26,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [],
"source": [
"BLUE = [255, 0, 0]\n",
"constant = cv2.copyMakeBorder(img, 10, 10, 10, 10, cv2.BORDER_CONSTANT, value=BLUE)"
]
},
{
"cell_type": "code",
"execution_count": 27,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[255]], dtype=uint8)"
]
},
"execution_count": 27,
2019-12-08 03:13:45 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.uint8([250])\n",
"y = np.uint8([10])\n",
"cv2.add(x, y)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"use numpy integers"
]
},
{
"cell_type": "code",
"execution_count": 28,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [],
"source": [
"blended = cv2.addWeighted(img[0:200, 0:200], 0.8, img[0:200, 0:200], 0.2, 0)"
]
},
{
"cell_type": "code",
"execution_count": 29,
2019-12-08 03:13:45 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fd67a432e90>"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW8AAAD8CAYAAAC4uSVNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOy9Wcxly3Ue9q3a+wz/2HP37cs7keIgybZESo5lQwIsx7ERI0BsR5AhB0gMJDCTBz0k8EMEPQVxHhwgI/IQmE6CJECCRIFlZLAc2xHihA4BQSNFShRJ8fLyzn177n8409618lC1Vn1V5/S9tKgbN6F/A93//5+zd42rvvWtoWqLquLiurgurovr4vruusI/7QZcXBfXxXVxXVz/5NcFeF9cF9fFdXF9F14X4H1xXVwX18X1XXhdgPfFdXFdXBfXd+F1Ad4X18V1cV1c34XXBXhfXBfXxXVxfRdeHxp4i8g/LyJfFZHfFZGf+bDqubgurovr4vqDeMmHkectIh2ArwH4MwDeBPDLAP6yqv7273tlF9fFdXFdXH8Arw+Lef8xAL+rqq+q6hrA/wjgz39IdV1cF9fFdXH9gbv6D6ncjwB4g/5+E8CPPLURewc6Pbqa/hCAbQEBdnxAn7V/t/fZV3QffQXlWz+oDG6PfOAjW+22x7RpwFb9PAZtY9uPm3Go+tM+lr8Qbb+whtXlQLA9vrsqEGwPxK7LB6CUrZLaI3FXg/P33J52vNo5CvxHvr9t8662NvdZfcpjwFfb510y2pS/qw27bt312NN+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s6pc9ZfizgYOV3qxrgeV7a/qXBgadyWvuqoJXNkS1C8oX
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
2019-12-08 03:13:45 +00:00
"source": [
"img = cv2.imread('sheep.png')\n",
"img = cv2.normalize(img.astype('float'), None, alpha=0, beta=1, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_32F)\n",
"grayscale = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n",
"plt.imshow(grayscale)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fe60db583d0>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAACSCAYAAAC+Pop7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOy9TY9/WZLf9YmHc+8v///qngfGIA8eCyOxgTXwCpDYICRWwAvwihdgiXfBchZskBBsEBssWWaNBF6xwBJoQLKwBSNmppmuqszfvedEBIs4mVXtmWmD5JabUZ5Wq6oyfw/33nNOnIjvQ6RUFZ/jc3yOz/E5/nIN/Wd9AZ/jc3yOz/E5/umPz+D+OT7H5/gcfwnHZ3D/HJ/jc3yOv4TjM7h/js/xOT7HX8LxGdw/x+f4HJ/jL+H4DO6f43N8js/xl3D8yoK7iPzbIvI/i8gfiMjf+lV9z+f4HJ/jc3yOPzvkV6FzFxED/hfg3wL+IfD3gP+gqv7+P/Uv+xyf43N8js/xZ8avKnP/N4A/qKr/rapu4L8A/t1f0Xd9js/xOT7H5/jHhv+KPvdfBP73H/33PwT+zb/wIh6POn/6DSICJVQlAiDCR11RRQkI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5deVnFTPMCEU04iJmHKyC5XowqGd2BiweyDSHYGj04SxUkqC1clUvju/p6RJy9jcK1n37tZH/LS2fGdXe0cDHJXbVWF6cG0SVYx1Ekphg6GO0Ewq7CCZz2xclI7+NzzjWfcgDaUhZFZ1JpEZVc5ZpQqEcGy4jh/E4lgaZHxRNdoQNUcEScKTITBPrhzkSYbNkkyN/R
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"img = cv2.imread('sheep.png')\n",
"x = np.concatenate((img, img), axis=1)\n",
"plt.imshow(x)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fe60dac5890>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAMsAAAD8CAYAAADZhFAmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOy9a6yt63Xf9RtjPM/7zjnX2vdzP44vce04KYlDm+CGJE0KaloV9QY0JQipoKoVSCAkQEokJBB8oSC+wRfyAQRF0PZD0jQ0tEl6SVWnbWziJLWd2D4+9rkf77Pva6055/tcxuDD857tkygndkROcpD2kLbWmnPN+V6e9xm3//iPsSUieCSP5JF8bdHf6wt4JI/k/y/ySFkeySP5OuWRsjySR/J1yiNleSSP5OuUR8rySB7J1ymPlOWRPJKvU94xZRGRPy4inxOR50TkR96p8zySR/K7JfJO1FlExIDPA38UeBn4BPBDEfHZ3/GTPZJH8rsk75Rn+ZeA5yLi+YgowF8D/vQ7dK5H8kh+VyS9Q8d9FnjpLa9fBj72thex2cR8+RQRgRAiHAEQ4aHfiyDGm+NzBEEg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aooQESEJWr+EByRNhhlqiccAiEAwxmDHcA/WOitG8gSUkQJNjthmer1VClO4yEB+Z6X2PB+Q8ITJyJ8HwULQHx2UPZmRLJJtBO70LStD9SJVGBBRTNmkaz6w6oYmE0myEjOFOz0bSGaKjKgRK94aI0cIGPMrEZAYbaKFMtlZ7REbq40KQUA103qKAuhGR2ZiOEGw5p/SBvpnpyNcsoykNwESVcKVaJkWjOJTmuB8gDI1
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"img = cv2.imread('sheep.png')\n",
"x = np.concatenate((img, img), axis=0)\n",
"plt.imshow(x)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x7fe5ffd8e810>"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW8AAAD8CAYAAAC4uSVNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO2dfewm1XXfv6dkWYoNxRvoag2kC9biyk7pmq5YV3EoNcbYKM3GlUXhDwcSq2vXRorVVPU6rmI3VSQn9YtcJcJZxMpQ2YALdkwtUgzELo1UsBe8Xi8mwEKw2PWaTfwCJFRrXk7/eOYxs3fvnblvM/fOPN+P9NPveeaZuXNm7sx3zj333DuiqiCEEDIt/l5pAwghhIRD8SaEkAlC8SaEkAlC8SaEkAlC8SaEkAlC8SaEkAkymHiLyNtE5GER2S8iO4baDyGErCIyRJ63iBwH4BEAFwM4AOCbAK5Q1e9m3xkhhKwgQ3ne5wPYr6qPq+pPAdwEYNtA+yKEkJXj5wYq93QAT7a+HwCw1bXy8bJWT8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YonNoCgh3LYbMcSOmtPKarEjFz6ZJT7rhZabaxtSPzmyTd4O4AFVfQoAlv8BQESuBfCVDPsIItTbcA148N1uLGoW31yMdTw5Y8cxWSXt7YaCXve8ySHeV6AVMhGRDap6qPn6DgD7MuzDm9xZBK715yaaq4xt0FGsR1z6urB1SJN5kiTeIvIKABcDeE9r8R+KyGYswiZPGL9VxxAXt6+48yEQxhCDeXIJnW0iqL4yUx8YZLVJ6rBU1b9T1Z9X1adby96lqv9EVc9V1V9teeGzwNdLd2VPzLEp63NMIcf
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"img = cv2.imread('sheep.png')\n",
"edges = cv2.Canny(img, 150, 220)\n",
"plt.imshow(edges)"
2019-12-08 03:13:45 +00:00
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}