initial commit

This commit is contained in:
aj 2019-12-08 03:13:45 +00:00
commit 284519c51d
9 changed files with 1187 additions and 0 deletions

124
.gitignore vendored Normal file
View File

@ -0,0 +1,124 @@
scratch.py
node_modules/
# Byte-compiled / optimized / DLL files
*/__pycache__/*
*.py[cod]
*$py.class
.idea
.vscode
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
/msrc/

3
README.md Normal file
View File

@ -0,0 +1,3 @@
computer vision testing
==================

32
descriptors.ipynb Normal file
View File

@ -0,0 +1,32 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h2><center>average RGB</center></h2>"
]
}
],
"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
}

127
edge-detection.ipynb Normal file

File diff suppressed because one or more lines are too long

13
gui.py Normal file
View File

@ -0,0 +1,13 @@
import cv2
img = cv2.imread('nebula2.jpg', 0)
cv2.imshow('image', img)
k = cv2.waitKey(0)
if k == 27: # wait for ESC key to exit
cv2.destroyAllWindows()
elif k == ord('s'): # wait for 's' key to save and exit
cv2.imwrite('messigray.png', img)
cv2.destroyAllWindows()
# cv2.imwrite('nebula2.jpg', img)

540
numpy.ipynb Normal file
View File

@ -0,0 +1,540 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3><center>arrays</center></h3>"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1, 2, 3],\n",
" [4, 5, 6]], dtype=int32)"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"\n",
"x = np.array([[1, 2, 3], [4, 5, 6]], np.int32)\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(2, 3)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x.shape"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"dtype('int32')"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x.dtype"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x[0, 1]"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1, 4], dtype=int32)"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x[:, 0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3><center>inserting</center></h3>"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1, 2, 3, 4, 5, 6, 7, 8, 9])"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"x = np.append(x, [7, 8, 9])\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1, 2, 3],\n",
" [4, 5, 6],\n",
" [7, 8, 9]])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"x = np.append(arr=x, values=[[7, 8, 9]], axis=0)\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 2, 4, 6],\n",
" [ 8, 10, 12]], dtype=int32)"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"x = np.add(x, x)\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[[1, 2, 3], [4, 5, 6], [7, 8, 9]]"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n",
"x.tolist()"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[1],\n",
" [2],\n",
" [3],\n",
" [4],\n",
" [5],\n",
" [6]])"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"np.reshape(x, (-1, 1))"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[1 2 3]\n",
" [4 5 6]]\n"
]
},
{
"data": {
"text/plain": [
"array([[1, 4],\n",
" [2, 5],\n",
" [3, 6]])"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"print(x)\n",
"x.transpose()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1, 2, 3, 4, 5, 6])"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"x.flatten()"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[4, 3],\n",
" [5, 7]])"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = [4, 3, 5, 7, 6, 8]\n",
"np.take(a, [[0, 1], [2, 3]])"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([-44, 1, -55, 3, 4])"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = np.arange(5)\n",
"np.put(a, [0, 2], [-44, -55])\n",
"a"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([10, 1, 10, 3, 4])"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = np.arange(5)\n",
"np.put(a, [0, 2], 10)\n",
"a"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6\n",
"[4 5 6]\n",
"[3 6]\n"
]
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"print(x.max())\n",
"print(x.max(axis=0))\n",
"print(x.max(axis=1))"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0.125, 0.754, 0.345],\n",
" [0.453, 0.896, 0.384]])"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.array([[0.12541, 0.753682, 0.3453453], [0.45261364, 0.8957225, 0.3842736]])\n",
"np.round(x, 3)"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"21\n",
"[ 6 15]\n"
]
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"print(np.sum(x))\n",
"print(np.sum(x, axis=1))"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3.5\n",
"[2.5 3.5 4.5]\n"
]
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"print(np.mean(x))\n",
"print(np.mean(x, axis=0))"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1.707825127659933\n",
"[1.5 1.5 1.5]\n"
]
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"print(np.std(x))\n",
"print(np.std(x, axis=0))"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[2 3 4]\n",
" [5 6 7]]\n",
"[[ 2 4 6]\n",
" [ 8 10 12]]\n",
"[[0.5 1. 1.5]\n",
" [2. 2.5 3. ]]\n",
"floor [[0 1 1]\n",
" [2 2 3]]\n",
"mod [[1 0 1]\n",
" [0 1 0]]\n",
"power [[ 1 4 9]\n",
" [16 25 36]]\n"
]
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"print(x + 1)\n",
"print(x * 2)\n",
"print(x / 2)\n",
"print('floor', x // 2)\n",
"print('mod', x % 2)\n",
"print('power', pow(x, 2))"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 4, 16, 36],\n",
" [ 64, 100, 144]])"
]
},
"execution_count": 68,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = np.array([[1, 2, 3], [4, 5, 6]])\n",
"x *= 2\n",
"x **= 2\n",
"x"
]
}
],
"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
}

293
opencv.ipynb Normal file

File diff suppressed because one or more lines are too long

55
requirements.txt Normal file
View File

@ -0,0 +1,55 @@
attrs==19.3.0
backcall==0.1.0
bleach==3.1.0
cycler==0.10.0
decorator==4.4.1
defusedxml==0.6.0
entrypoints==0.3
importlib-metadata==1.2.0
ipykernel==5.1.3
ipython==7.10.1
ipython-genutils==0.2.0
jedi==0.15.1
Jinja2==2.10.3
joblib==0.14.0
json5==0.8.5
jsonschema==3.2.0
jupyter-client==5.3.4
jupyter-core==4.6.1
jupyterlab==1.2.3
jupyterlab-server==1.0.6
kiwisolver==1.1.0
MarkupSafe==1.1.1
matplotlib==3.1.2
mistune==0.8.4
more-itertools==8.0.2
nbconvert==5.6.1
nbformat==4.4.0
notebook==6.0.2
numpy==1.17.4
opencv-python==4.1.2.30
pandas==0.25.3
pandocfilters==1.4.2
parso==0.5.1
pexpect==4.7.0
pickleshare==0.7.5
prometheus-client==0.7.1
prompt-toolkit==3.0.2
ptyprocess==0.6.0
Pygments==2.5.2
pyparsing==2.4.5
pyrsistent==0.15.6
python-dateutil==2.8.1
pytz==2019.3
pyzmq==18.1.1
scikit-learn==0.22
scipy==1.3.3
Send2Trash==1.5.0
six==1.13.0
terminado==0.8.3
testpath==0.4.4
tornado==6.0.3
traitlets==4.3.3
wcwidth==0.1.7
webencodings==0.5.1
zipp==0.6.0

BIN
sheep.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB