master
Uzemiu 2 years ago
commit 18da4e7017

143
DIPFA/.gitignore vendored

@ -0,0 +1,143 @@
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
<<<<<<< HEAD
pip-wheel-metadata/
=======
>>>>>>> f03fc332c19e5377de86345c1ea0efe6e0b2f051
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
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# 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/
.idea/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/

@ -0,0 +1,78 @@
# dipfa
### 说明
本项目使用flask作为后端采用网页的形式进行展示交互
### 环境
python3.7+
### 开始
```
pip install -r requirements.txt
python app.py # 默认在 127.0.0.1:5000
```
如果打算使用 GPU由于 cuda 版本不同pytorch 和 torchvision 需要自行下载,建议从以下网站找到对应版本下载 whl 文件安装 \
https://download.pytorch.org/whl/torch/ \
https://download.pytorch.org/whl/torchvision/
```python
import torch
torch.cuda.is_available() # 返回 True 才能使用 GPU
```
如果 GPU 显存不够,可以直接修改 myTransfer.py 和 models.py设置 device = 'cpu'
### 风格迁移说明
<code>models</code>下包含风格迁移的模型文件下载地址,需运行 models.bat 和 myModels.bat 下载 \
其中models.bat 下载固定风格任意内容的模型myModels.bat 下载任意风格任意内容的模型。\
任意风格任意内容迁移的代码、研究与报告见项目 StyleTransfer。
```
- models
- COCO2014_1000
- *.png
- metanet_base32_style300000.0_tv1e-06_tagnohvd.pth
- metanet_base32_style300000.0_tv1e-06_tagnohvd_transform_net.pth
- candy.t7
- feathers.t7
- *.t7
```
myModels.bat 受限于服务器带宽,下载所有文件需要约 30 min。\
为了减少下载时间:
1. 如果本地已经有完整的 COCO2014可以运行 genCOCO2014_1000.py 脚本生成数据集 \
如果没有,可以运行 getCOCO2014_1000.bat 下载, \
也可以从[这里](http://images.cocodataset.org/zips/train2014.zip)下载,解压并运行 genCOCO2014_1000.py 脚本 \
需要将 genCOCO2014_1000.py 的这行改成自己数据集的路径
```python
src = "../../COCO2014/train2014"
```
2. 目前已经将 vgg19 改成了 pretrained=True通过 torchvision 下载,所以项目初次运行会先进行下载。 \
如果下载不了的话可以找其他的源下载,并修改代码,\
或者运行 getVgg19.bat 从服务器获取,享受极(慢)速(度)(约 20 min)
```python
vgg19 = models.vgg19(pretrained=False)
vgg19.load_state_dict(torch.load(${模型路径}))
```
![style transfer](docImg/style_transfer.png)
如图,左侧为内容图,右侧为风格图。对于一张风格图,第一次运行会花费额外的时间(取决于设备)。
之后风格图不变,更换内容图,进行迁移需要约 5-8s。
### 后端文档说明
采用 sphinx 自动生成 \
起始页面: ./doc/_build/html/index.html
### 测试说明
./test 下是对每一个 service 的测试,其中 main.py 运行全部的测试showImg 为 True 会显示图片,否则不会。\
批量测试前建议把这两个函数注释掉,后面单独测试,否则有概率爆内存。
```python
# noiseBlur_test.py
def test_harmonic_blur():
res = noiseBlurService.harmonic_blur([blur], {'ksize': 3})
display('harmonic_blur', res)
def test_low_pass_filter():
res = noiseBlurService.low_pass_filter([blur], {'threshold2': 200})
display('low_pass', res)
```

@ -0,0 +1,175 @@
import json
import os
import traceback
import uuid
import numpy as np
import cv2 as cv
import service.histService
import service.colorSpaceService
import service.morphologyService as morphology_service
import service.houghService as hough_service
import service.affineService as affine_service
import service.computeService as compute_service
import service.edgeDetectionService as edge_detection_service
import service.noiseBlurService as noise_blur_service
import service.augmentService as augment_service
import service.flipService as flip_service
import transfer
import myTransfer
from flask import Flask, request, jsonify, render_template, send_file
from flask_cors import CORS, cross_origin
import base64
app = Flask(__name__, static_folder='static', static_url_path='/')
cors = CORS(app)
def base64_encode(img):
return str(base64.b64encode(cv.imencode('.jpg', img)[1]))[2:-1]
def base_response(status=200, message='ok', data=None):
return {
'status': status,
'message': message,
'data': data
}
def style_transfer(images, args):
return transfer.style_transfer(images[0], args['model'])
def my_style_transfer(images, args=None):
style_img = images[1]
content_img = images[0]
return myTransfer.style_transfer(style_img, content_img)
command_map = {
# 基本计算
'and': compute_service.andOp,
'or': compute_service.orOp,
'not': compute_service.notOp,
'add': compute_service.add,
'subtract': compute_service.subtract,
'multiply': compute_service.multiply,
'divide': compute_service.divide,
'scale': compute_service.scale,
'translate': compute_service.translate,
'rotate': compute_service.rotate,
'flipHor': flip_service.horizontalFlip,
'flipVer': flip_service.verticalFlip,
'affine': affine_service.affine,
# 边缘检测
'roberts': edge_detection_service.roberts,
'sobel': edge_detection_service.sobel,
'laplacian': edge_detection_service.laplacian,
'LoG': edge_detection_service.LoG,
'canny': edge_detection_service.canny,
'hough': hough_service.hough,
'houghP': hough_service.houghP,
# 噪声滤波,
# 添加噪声
'spNoise': noise_blur_service.sp_noise,
'gaussianNoise': noise_blur_service.gaussian_noise,
# 均值/排序统计滤波
'avgBlur': noise_blur_service.avg_blur,
'maxBlur': noise_blur_service.max_blur,
'minBlur': noise_blur_service.min_blur,
'medBlur': noise_blur_service.med_blur,
'gaussianBlur': noise_blur_service.gaussian_blur,
'geometricBlur': noise_blur_service.geometric_blur,
'harmonicBlur': noise_blur_service.harmonic_blur,
# 选择性滤波
'lowPass': noise_blur_service.low_pass_filter,
'highPass': noise_blur_service.high_pass_filter,
'bandPass': noise_blur_service.band_pass_filter,
'bandStop': noise_blur_service.band_stop_filter,
# 图像增强
'lpFilter': augment_service.lp_filter,
'blpFilter': augment_service.butterworth_lp_filter,
'glpFilter': augment_service.gauss_lp_filter,
'hpFilter': augment_service.hp_filter,
'bhpFilter': augment_service.butterworth_hp_filter,
'ghpFilter': augment_service.gauss_hp_filter,
'robertsGrad': augment_service.roberts_grad,
'sobelGrad': augment_service.sobel_grad,
'prewittGrad': augment_service.prewitt_grad,
'laplacianGrad': augment_service.laplacian_grad,
# 形态学操作
'morphOpen': morphology_service.morphOpen,
'morphClose': morphology_service.morphClose,
'morphErode': morphology_service.erode,
'morphDilate': morphology_service.dilate,
# 其他
'hist': service.histService.histCover,
'getRGB': service.colorSpaceService.getRGB,
'getHSV': service.colorSpaceService.getHSV,
# 风格迁移
'transfer': style_transfer,
'myTransfer': my_style_transfer
}
@app.errorhandler(Exception)
def exception_handler(e):
msg = e.args[0] if e.args[0] else 'Internal server error'
traceback.print_exc()
return jsonify(base_response(400, msg)), 400 # 一般异常
@app.route('/')
def index(): # put application's code here
return send_file('./static/index.html')
@app.route('/process', methods=['POST'])
def upload():
# parse form data
command = request.form.get('command')
files = request.files.getlist('files')
dst = []
for file in files:
dst.append('./images/' + str(uuid.uuid1()))
args = {}
try:
args = json.loads(request.form['args'])
except:
print(f'error in parse json: {args}')
# execute command
do_command = command_map.get(command)
if do_command:
try:
for i in range(len(files)):
files[i].save(dst[i])
imgs = []
for d in dst:
imgs.append(cv.imread(d, 1))
resp_data = do_command(imgs, args)
if isinstance(resp_data, tuple):
tmp = []
for img in resp_data:
tmp.append(base64_encode(img))
resp_data = tmp
else:
resp_data = [base64_encode(resp_data)]
except Exception as e:
raise e
finally:
# clean tmp file
for path in dst:
os.remove(path)
else:
raise Exception(f'未知命令: {command}')
return jsonify(base_response(data=resp_data))
if __name__ == '__main__':
app.run()

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 198deffa2b69012a52f7e01b122b4f2d
tags: 645f666f9bcd5a90fca523b33c5a78b7

@ -0,0 +1,20 @@
.. DIPFA documentation master file, created by
sphinx-quickstart on Thu Jul 21 00:06:59 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to DIPFA's documentation!
=================================
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

@ -0,0 +1,7 @@
service
=======
.. toctree::
:maxdepth: 4
service

@ -0,0 +1,93 @@
service package
===============
Submodules
----------
service.affineService module
----------------------------
.. automodule:: service.affineService
:members:
:undoc-members:
:show-inheritance:
service.augmentService module
-----------------------------
.. automodule:: service.augmentService
:members:
:undoc-members:
:show-inheritance:
service.colorSpaceService module
--------------------------------
.. automodule:: service.colorSpaceService
:members:
:undoc-members:
:show-inheritance:
service.computeService module
-----------------------------
.. automodule:: service.computeService
:members:
:undoc-members:
:show-inheritance:
service.edgeDetectionService module
-----------------------------------
.. automodule:: service.edgeDetectionService
:members:
:undoc-members:
:show-inheritance:
service.flipService module
--------------------------
.. automodule:: service.flipService
:members:
:undoc-members:
:show-inheritance:
service.histService module
--------------------------
.. automodule:: service.histService
:members:
:undoc-members:
:show-inheritance:
service.houghService module
---------------------------
.. automodule:: service.houghService
:members:
:undoc-members:
:show-inheritance:
service.morphologyService module
--------------------------------
.. automodule:: service.morphologyService
:members:
:undoc-members:
:show-inheritance:
service.noiseBlurService module
-------------------------------
.. automodule:: service.noiseBlurService
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: service
:members:
:undoc-members:
:show-inheritance:

@ -0,0 +1,134 @@
/*
* _sphinx_javascript_frameworks_compat.js
* ~~~~~~~~~~
*
* Compatability shim for jQuery and underscores.js.
*
* WILL BE REMOVED IN Sphinx 6.0
* xref RemovedInSphinx60Warning
*
*/
/**
* select a different prefix for underscore
*/
$u = _.noConflict();
/**
* small helper function to urldecode strings
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
*/
jQuery.urldecode = function(x) {
if (!x) {
return x
}
return decodeURIComponent(x.replace(/\+/g, ' '));
};
/**
* small helper function to urlencode strings
*/
jQuery.urlencode = encodeURIComponent;
/**
* This function returns the parsed url parameters of the
* current request. Multiple values per key are supported,
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s === 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
for (var i = 0; i < parts.length; i++) {
var tmp = parts[i].split('=', 2);
var key = jQuery.urldecode(tmp[0]);
var value = jQuery.urldecode(tmp[1]);
if (key in result)
result[key].push(value);
else
result[key] = [value];
}
return result;
};
/**
* highlight a given string on a jquery object by wrapping it in
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node, addItems) {
if (node.nodeType === 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 &&
!jQuery(node.parentNode).hasClass(className) &&
!jQuery(node.parentNode).hasClass("nohighlight")) {
var span;
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.className = className;
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
var bbox = node.parentElement.getBBox();
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute('class', className);
addItems.push({
"parent": node.parentNode,
"target": rect});
}
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this, addItems);
});
}
}
var addItems = [];
var result = this.each(function() {
highlight(this, addItems);
});
for (var i = 0; i < addItems.length; ++i) {
jQuery(addItems[i].parent).before(addItems[i].target);
}
return result;
};
/*
* backward compatibility for jQuery.browser
* This will be supported until firefox bug is fixed.
*/
if (!jQuery.browser) {
jQuery.uaMatch = function(ua) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
jQuery.browser = {};
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
}

@ -0,0 +1,899 @@
/*
* basic.css
* ~~~~~~~~~
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
/* -- main layout ----------------------------------------------------------- */
div.clearer {
clear: both;
}
div.section::after {
display: block;
content: '';
clear: left;
}
/* -- relbar ---------------------------------------------------------------- */
div.related {
width: 100%;
font-size: 90%;
}
div.related h3 {
display: none;
}
div.related ul {
margin: 0;
padding: 0 0 0 10px;
list-style: none;
}
div.related li {
display: inline;
}
div.related li.right {
float: right;
margin-right: 5px;
}
/* -- sidebar --------------------------------------------------------------- */
div.sphinxsidebarwrapper {
padding: 10px 5px 0 10px;
}
div.sphinxsidebar {
float: left;
width: 230px;
margin-left: -100%;
font-size: 90%;
word-wrap: break-word;
overflow-wrap : break-word;
}
div.sphinxsidebar ul {
list-style: none;
}
div.sphinxsidebar ul ul,
div.sphinxsidebar ul.want-points {
margin-left: 20px;
list-style: square;
}
div.sphinxsidebar ul ul {
margin-top: 0;
margin-bottom: 0;
}
div.sphinxsidebar form {
margin-top: 10px;
}
div.sphinxsidebar input {
border: 1px solid #98dbcc;
font-family: sans-serif;
font-size: 1em;
}
div.sphinxsidebar #searchbox form.search {
overflow: hidden;
}
div.sphinxsidebar #searchbox input[type="text"] {
float: left;
width: 80%;
padding: 0.25em;
box-sizing: border-box;
}
div.sphinxsidebar #searchbox input[type="submit"] {
float: left;
width: 20%;
border-left: none;
padding: 0.25em;
box-sizing: border-box;
}
img {
border: 0;
max-width: 100%;
}
/* -- search page ----------------------------------------------------------- */
ul.search {
margin: 10px 0 0 20px;
padding: 0;
}
ul.search li {
padding: 5px 0 5px 20px;
background-image: url(file.png);
background-repeat: no-repeat;
background-position: 0 7px;
}
ul.search li a {
font-weight: bold;
}
ul.search li p.context {
color: #888;
margin: 2px 0 0 30px;
text-align: left;
}
ul.keywordmatches li.goodmatch a {
font-weight: bold;
}
/* -- index page ------------------------------------------------------------ */
table.contentstable {
width: 90%;
margin-left: auto;
margin-right: auto;
}
table.contentstable p.biglink {
line-height: 150%;
}
a.biglink {
font-size: 1.3em;
}
span.linkdescr {
font-style: italic;
padding-top: 5px;
font-size: 90%;
}
/* -- general index --------------------------------------------------------- */
table.indextable {
width: 100%;
}
table.indextable td {
text-align: left;
vertical-align: top;
}
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {
height: 10px;
}
table.indextable tr.cap {
margin-top: 10px;
background-color: #f2f2f2;
}
img.toggler {
margin-right: 3px;
margin-top: 3px;
cursor: pointer;
}
div.modindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
div.genindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
/* -- domain module index --------------------------------------------------- */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* -- general body styles --------------------------------------------------- */
div.body {
min-width: 360px;
max-width: 800px;
}
div.body p, div.body dd, div.body li, div.body blockquote {
-moz-hyphens: auto;
-ms-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
a.headerlink {
visibility: hidden;
}
a.brackets:before,
span.brackets > a:before{
content: "[";
}
a.brackets:after,
span.brackets > a:after {
content: "]";
}
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink,
caption:hover > a.headerlink,
p.caption:hover > a.headerlink,
div.code-block-caption:hover > a.headerlink {
visibility: visible;
}
div.body p.caption {
text-align: inherit;
}
div.body td {
text-align: left;
}
.first {
margin-top: 0 !important;
}
p.rubric {
margin-top: 30px;
font-weight: bold;
}
img.align-left, figure.align-left, .figure.align-left, object.align-left {
clear: left;
float: left;
margin-right: 1em;
}
img.align-right, figure.align-right, .figure.align-right, object.align-right {
clear: right;
float: right;
margin-left: 1em;
}
img.align-center, figure.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
img.align-default, figure.align-default, .figure.align-default {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-default {
text-align: center;
}
.align-right {
text-align: right;
}
/* -- sidebars -------------------------------------------------------------- */
div.sidebar,
aside.sidebar {
margin: 0 0 0.5em 1em;
border: 1px solid #ddb;
padding: 7px;
background-color: #ffe;
width: 40%;
float: right;
clear: right;
overflow-x: auto;
}
p.sidebar-title {
font-weight: bold;
}
div.admonition, div.topic, blockquote {
clear: left;
}
/* -- topics ---------------------------------------------------------------- */
div.topic {
border: 1px solid #ccc;
padding: 7px;
margin: 10px 0 10px 0;
}
p.topic-title {
font-size: 1.1em;
font-weight: bold;
margin-top: 10px;
}
/* -- admonitions ----------------------------------------------------------- */
div.admonition {
margin-top: 10px;
margin-bottom: 10px;
padding: 7px;
}
div.admonition dt {
font-weight: bold;
}
p.admonition-title {
margin: 0px 10px 5px 0px;
font-weight: bold;
}
div.body p.centered {
text-align: center;
margin-top: 25px;
}
/* -- content of sidebars/topics/admonitions -------------------------------- */
div.sidebar > :last-child,
aside.sidebar > :last-child,
div.topic > :last-child,
div.admonition > :last-child {
margin-bottom: 0;
}
div.sidebar::after,
aside.sidebar::after,
div.topic::after,
div.admonition::after,
blockquote::after {
display: block;
content: '';
clear: both;
}
/* -- tables ---------------------------------------------------------------- */
table.docutils {
margin-top: 10px;
margin-bottom: 10px;
border: 0;
border-collapse: collapse;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
table.align-default {
margin-left: auto;
margin-right: auto;
}
table caption span.caption-number {
font-style: italic;
}
table caption span.caption-text {
}
table.docutils td, table.docutils th {
padding: 1px 8px 1px 5px;
border-top: 0;
border-left: 0;
border-right: 0;
border-bottom: 1px solid #aaa;
}
th {
text-align: left;
padding-right: 5px;
}
table.citation {
border-left: solid 1px gray;
margin-left: 1px;
}
table.citation td {
border-bottom: none;
}
th > :first-child,
td > :first-child {
margin-top: 0px;
}
th > :last-child,
td > :last-child {
margin-bottom: 0px;
}
/* -- figures --------------------------------------------------------------- */
div.figure, figure {
margin: 0.5em;
padding: 0.5em;
}
div.figure p.caption, figcaption {
padding: 0.3em;
}
div.figure p.caption span.caption-number,
figcaption span.caption-number {
font-style: italic;
}
div.figure p.caption span.caption-text,
figcaption span.caption-text {
}
/* -- field list styles ----------------------------------------------------- */
table.field-list td, table.field-list th {
border: 0 !important;
}
.field-list ul {
margin: 0;
padding-left: 1em;
}
.field-list p {
margin: 0;
}
.field-name {
-moz-hyphens: manual;
-ms-hyphens: manual;
-webkit-hyphens: manual;
hyphens: manual;
}
/* -- hlist styles ---------------------------------------------------------- */
table.hlist {
margin: 1em 0;
}
table.hlist td {
vertical-align: top;
}
/* -- object description styles --------------------------------------------- */
.sig {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
}
.sig-name, code.descname {
background-color: transparent;
font-weight: bold;
}
.sig-name {
font-size: 1.1em;
}
code.descname {
font-size: 1.2em;
}
.sig-prename, code.descclassname {
background-color: transparent;
}
.optional {
font-size: 1.3em;
}
.sig-paren {
font-size: larger;
}
.sig-param.n {
font-style: italic;
}
/* C++ specific styling */
.sig-inline.c-texpr,
.sig-inline.cpp-texpr {
font-family: unset;
}
.sig.c .k, .sig.c .kt,
.sig.cpp .k, .sig.cpp .kt {
color: #0033B3;
}
.sig.c .m,
.sig.cpp .m {
color: #1750EB;
}
.sig.c .s, .sig.c .sc,
.sig.cpp .s, .sig.cpp .sc {
color: #067D17;
}
/* -- other body styles ----------------------------------------------------- */
ol.arabic {
list-style: decimal;
}
ol.loweralpha {
list-style: lower-alpha;
}
ol.upperalpha {
list-style: upper-alpha;
}
ol.lowerroman {
list-style: lower-roman;
}
ol.upperroman {
list-style: upper-roman;
}
:not(li) > ol > li:first-child > :first-child,
:not(li) > ul > li:first-child > :first-child {
margin-top: 0px;
}
:not(li) > ol > li:last-child > :last-child,
:not(li) > ul > li:last-child > :last-child {
margin-bottom: 0px;
}
ol.simple ol p,
ol.simple ul p,
ul.simple ol p,
ul.simple ul p {
margin-top: 0;
}
ol.simple > li:not(:first-child) > p,
ul.simple > li:not(:first-child) > p {
margin-top: 0;
}
ol.simple p,
ul.simple p {
margin-bottom: 0;
}
dl.footnote > dt,
dl.citation > dt {
float: left;
margin-right: 0.5em;
}
dl.footnote > dd,
dl.citation > dd {
margin-bottom: 0em;
}
dl.footnote > dd:after,
dl.citation > dd:after {
content: "";
clear: both;
}
dl.field-list {
display: grid;
grid-template-columns: fit-content(30%) auto;
}
dl.field-list > dt {
font-weight: bold;
word-break: break-word;
padding-left: 0.5em;
padding-right: 5px;
}
dl.field-list > dt:after {
content: ":";
}
dl.field-list > dd {
padding-left: 0.5em;
margin-top: 0em;
margin-left: 0em;
margin-bottom: 0em;
}
dl {
margin-bottom: 15px;
}
dd > :first-child {
margin-top: 0px;
}
dd ul, dd table {
margin-bottom: 10px;
}
dd {
margin-top: 3px;
margin-bottom: 10px;
margin-left: 30px;
}
dl > dd:last-child,
dl > dd:last-child > :last-child {
margin-bottom: 0;
}
dt:target, span.highlighted {
background-color: #fbe54e;
}
rect.highlighted {
fill: #fbe54e;
}
dl.glossary dt {
font-weight: bold;
font-size: 1.1em;
}
.versionmodified {
font-style: italic;
}
.system-message {
background-color: #fda;
padding: 5px;
border: 3px solid red;
}
.footnote:target {
background-color: #ffa;
}
.line-block {
display: block;
margin-top: 1em;
margin-bottom: 1em;
}
.line-block .line-block {
margin-top: 0;
margin-bottom: 0;
margin-left: 1.5em;
}
.guilabel, .menuselection {
font-family: sans-serif;
}
.accelerator {
text-decoration: underline;
}
.classifier {
font-style: oblique;
}
.classifier:before {
font-style: normal;
margin: 0 0.5em;
content: ":";
display: inline-block;
}
abbr, acronym {
border-bottom: dotted 1px;
cursor: help;
}
/* -- code displays --------------------------------------------------------- */
pre {
overflow: auto;
overflow-y: hidden; /* fixes display issues on Chrome browsers */
}
pre, div[class*="highlight-"] {
clear: both;
}
span.pre {
-moz-hyphens: none;
-ms-hyphens: none;
-webkit-hyphens: none;
hyphens: none;
white-space: nowrap;
}
div[class*="highlight-"] {
margin: 1em 0;
}
td.linenos pre {
border: 0;
background-color: transparent;
color: #aaa;
}
table.highlighttable {
display: block;
}
table.highlighttable tbody {
display: block;
}
table.highlighttable tr {
display: flex;
}
table.highlighttable td {
margin: 0;
padding: 0;
}
table.highlighttable td.linenos {
padding-right: 0.5em;
}
table.highlighttable td.code {
flex: 1;
overflow: hidden;
}
.highlight .hll {
display: block;
}
div.highlight pre,
table.highlighttable pre {
margin: 0;
}
div.code-block-caption + div {
margin-top: 0;
}
div.code-block-caption {
margin-top: 1em;
padding: 2px 5px;
font-size: small;
}
div.code-block-caption code {
background-color: transparent;
}
table.highlighttable td.linenos,
span.linenos,
div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
-webkit-user-select: text; /* Safari fallback only */
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
}
div.code-block-caption span.caption-number {
padding: 0.1em 0.3em;
font-style: italic;
}
div.code-block-caption span.caption-text {
}
div.literal-block-wrapper {
margin: 1em 0;
}
code.xref, a code {
background-color: transparent;
font-weight: bold;
}
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
background-color: transparent;
}
.viewcode-link {
float: right;
}
.viewcode-back {
float: right;
font-family: sans-serif;
}
div.viewcode-block:target {
margin: -1px -10px;
padding: 0 10px;
}
/* -- math display ---------------------------------------------------------- */
img.math {
vertical-align: middle;
}
div.body div.math p {
text-align: center;
}
span.eqno {
float: right;
}
span.eqno a.headerlink {
position: absolute;
z-index: 1;
}
div.math:hover a.headerlink {
visibility: visible;
}
/* -- printout stylesheet --------------------------------------------------- */
@media print {
div.document,
div.documentwrapper,
div.bodywrapper {
margin: 0 !important;
width: 100%;
}
div.sphinxsidebar,
div.related,
div.footer,
#top-link {
display: none;
}
}

@ -0,0 +1 @@
.fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

File diff suppressed because one or more lines are too long

@ -0,0 +1,264 @@
/*
* doctools.js
* ~~~~~~~~~~~
*
* Base JavaScript utilities for all Sphinx HTML documentation.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
"use strict";
const _ready = (callback) => {
if (document.readyState !== "loading") {
callback();
} else {
document.addEventListener("DOMContentLoaded", callback);
}
};
/**
* highlight a given string on a node by wrapping it in
* span elements with the given class name.
*/
const _highlight = (node, addItems, text, className) => {
if (node.nodeType === Node.TEXT_NODE) {
const val = node.nodeValue;
const parent = node.parentNode;
const pos = val.toLowerCase().indexOf(text);
if (
pos >= 0 &&
!parent.classList.contains(className) &&
!parent.classList.contains("nohighlight")
) {
let span;
const closestNode = parent.closest("body, svg, foreignObject");
const isInSVG = closestNode && closestNode.matches("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.classList.add(className);
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
parent.insertBefore(
span,
parent.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling
)
);
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
const rect = document.createElementNS(
"http://www.w3.org/2000/svg",
"rect"
);
const bbox = parent.getBBox();
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute("class", className);
addItems.push({ parent: parent, target: rect });
}
}
} else if (node.matches && !node.matches("button, select, textarea")) {
node.childNodes.forEach((el) => _highlight(el, addItems, text, className));
}
};
const _highlightText = (thisNode, text, className) => {
let addItems = [];
_highlight(thisNode, addItems, text, className);
addItems.forEach((obj) =>
obj.parent.insertAdjacentElement("beforebegin", obj.target)
);
};
/**
* Small JavaScript module for the documentation.
*/
const Documentation = {
init: () => {
Documentation.highlightSearchWords();
Documentation.initDomainIndexTable();
Documentation.initOnKeyListeners();
},
/**
* i18n support
*/
TRANSLATIONS: {},
PLURAL_EXPR: (n) => (n === 1 ? 0 : 1),
LOCALE: "unknown",
// gettext and ngettext don't access this so that the functions
// can safely bound to a different name (_ = Documentation.gettext)
gettext: (string) => {
const translated = Documentation.TRANSLATIONS[string];
switch (typeof translated) {
case "undefined":
return string; // no translation
case "string":
return translated; // translation exists
default:
return translated[0]; // (singular, plural) translation tuple exists
}
},
ngettext: (singular, plural, n) => {
const translated = Documentation.TRANSLATIONS[singular];
if (typeof translated !== "undefined")
return translated[Documentation.PLURAL_EXPR(n)];
return n === 1 ? singular : plural;
},
addTranslations: (catalog) => {
Object.assign(Documentation.TRANSLATIONS, catalog.messages);
Documentation.PLURAL_EXPR = new Function(
"n",
`return (${catalog.plural_expr})`
);
Documentation.LOCALE = catalog.locale;
},
/**
* highlight the search words provided in the url in the text
*/
highlightSearchWords: () => {
const highlight =
new URLSearchParams(window.location.search).get("highlight") || "";
const terms = highlight.toLowerCase().split(/\s+/).filter(x => x);
if (terms.length === 0) return; // nothing to do
// There should never be more than one element matching "div.body"
const divBody = document.querySelectorAll("div.body");
const body = divBody.length ? divBody[0] : document.querySelector("body");
window.setTimeout(() => {
terms.forEach((term) => _highlightText(body, term, "highlighted"));
}, 10);
const searchBox = document.getElementById("searchbox");
if (searchBox === null) return;
searchBox.appendChild(
document
.createRange()
.createContextualFragment(
'<p class="highlight-link">' +
'<a href="javascript:Documentation.hideSearchWords()">' +
Documentation.gettext("Hide Search Matches") +
"</a></p>"
)
);
},
/**
* helper function to hide the search marks again
*/
hideSearchWords: () => {
document
.querySelectorAll("#searchbox .highlight-link")
.forEach((el) => el.remove());
document
.querySelectorAll("span.highlighted")
.forEach((el) => el.classList.remove("highlighted"));
const url = new URL(window.location);
url.searchParams.delete("highlight");
window.history.replaceState({}, "", url);
},
/**
* helper function to focus on search bar
*/
focusSearchBar: () => {
document.querySelectorAll("input[name=q]")[0]?.focus();
},
/**
* Initialise the domain index toggle buttons
*/
initDomainIndexTable: () => {
const toggler = (el) => {
const idNumber = el.id.substr(7);
const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`);
if (el.src.substr(-9) === "minus.png") {
el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`;
toggledRows.forEach((el) => (el.style.display = "none"));
} else {
el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`;
toggledRows.forEach((el) => (el.style.display = ""));
}
};
const togglerElements = document.querySelectorAll("img.toggler");
togglerElements.forEach((el) =>
el.addEventListener("click", (event) => toggler(event.currentTarget))
);
togglerElements.forEach((el) => (el.style.display = ""));
if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler);
},
initOnKeyListeners: () => {
// only install a listener if it is really needed
if (
!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS &&
!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS
)
return;
const blacklistedElements = new Set([
"TEXTAREA",
"INPUT",
"SELECT",
"BUTTON",
]);
document.addEventListener("keydown", (event) => {
if (blacklistedElements.has(document.activeElement.tagName)) return; // bail for input elements
if (event.altKey || event.ctrlKey || event.metaKey) return; // bail with special keys
if (!event.shiftKey) {
switch (event.key) {
case "ArrowLeft":
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
const prevLink = document.querySelector('link[rel="prev"]');
if (prevLink && prevLink.href) {
window.location.href = prevLink.href;
event.preventDefault();
}
break;
case "ArrowRight":
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
const nextLink = document.querySelector('link[rel="next"]');
if (nextLink && nextLink.href) {
window.location.href = nextLink.href;
event.preventDefault();
}
break;
case "Escape":
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break;
Documentation.hideSearchWords();
event.preventDefault();
}
}
// some keyboard layouts may need Shift to get /
switch (event.key) {
case "/":
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break;
Documentation.focusSearchBar();
event.preventDefault();
}
});
},
};
// quick alias for translations
const _ = Documentation.gettext;
_ready(Documentation.init);

@ -0,0 +1,14 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
FILE_SUFFIX: '.html',
LINK_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
NAVIGATION_WITH_KEYS: false,
SHOW_SEARCH_SUMMARY: true,
ENABLE_SEARCH_SHORTCUTS: true,
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}({4:function(e,t,r){}});

@ -0,0 +1,4 @@
/**
* @preserve HTML5 Shiv 3.7.3-pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=y.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=y.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),y.elements=c+" "+a,j(b)}function f(a){var b=x[a[v]];return b||(b={},w++,a[v]=w,x[w]=b),b}function g(a,c,d){if(c||(c=b),q)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():u.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||t.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),q)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return y.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(y,b.frag)}function j(a){a||(a=b);var d=f(a);return!y.shivCSS||p||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),q||i(a,d),a}function k(a){for(var b,c=a.getElementsByTagName("*"),e=c.length,f=RegExp("^(?:"+d().join("|")+")$","i"),g=[];e--;)b=c[e],f.test(b.nodeName)&&g.push(b.applyElement(l(b)));return g}function l(a){for(var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(A+":"+a.nodeName);d--;)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function m(a){for(var b,c=a.split("{"),e=c.length,f=RegExp("(^|[\\s,>+~])("+d().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),g="$1"+A+"\\:$2";e--;)b=c[e]=c[e].split("}"),b[b.length-1]=b[b.length-1].replace(f,g),c[e]=b.join("}");return c.join("{")}function n(a){for(var b=a.length;b--;)a[b].removeNode()}function o(a){function b(){clearTimeout(g._removeSheetTimer),d&&d.removeNode(!0),d=null}var d,e,g=f(a),h=a.namespaces,i=a.parentWindow;return!B||a.printShived?a:("undefined"==typeof h[A]&&h.add(A),i.attachEvent("onbeforeprint",function(){b();for(var f,g,h,i=a.styleSheets,j=[],l=i.length,n=Array(l);l--;)n[l]=i[l];for(;h=n.pop();)if(!h.disabled&&z.test(h.media)){try{f=h.imports,g=f.length}catch(o){g=0}for(l=0;g>l;l++)n.push(f[l]);try{j.push(h.cssText)}catch(o){}}j=m(j.reverse().join("")),e=k(a),d=c(a,j)}),i.attachEvent("onafterprint",function(){n(e),clearTimeout(g._removeSheetTimer),g._removeSheetTimer=setTimeout(b,500)}),a.printShived=!0,a)}var p,q,r="3.7.3",s=a.html5||{},t=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,v="_html5shiv",w=0,x={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",p="hidden"in a,q=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){p=!0,q=!0}}();var y={elements:s.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:r,shivCSS:s.shivCSS!==!1,supportsUnknownElements:q,shivMethods:s.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=y,j(b);var z=/^$|\b(?:all|print)\b/,A="html5shiv",B=!q&&function(){var c=b.documentElement;return!("undefined"==typeof b.namespaces||"undefined"==typeof b.parentWindow||"undefined"==typeof c.applyElement||"undefined"==typeof c.removeNode||"undefined"==typeof a.attachEvent)}();y.type+=" print",y.shivPrint=o,o(b),"object"==typeof module&&module.exports&&(module.exports=y)}("undefined"!=typeof window?window:this,document);

@ -0,0 +1,4 @@
/**
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3-pre",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);

File diff suppressed because one or more lines are too long

@ -0,0 +1,199 @@
/*
* language_data.js
* ~~~~~~~~~~~~~~~~
*
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
/* Non-minified version is copied as a separate JS file, is available */
/**
* Porter Stemmer
*/
var Stemmer = function() {
var step2list = {
ational: 'ate',
tional: 'tion',
enci: 'ence',
anci: 'ance',
izer: 'ize',
bli: 'ble',
alli: 'al',
entli: 'ent',
eli: 'e',
ousli: 'ous',
ization: 'ize',
ation: 'ate',
ator: 'ate',
alism: 'al',
iveness: 'ive',
fulness: 'ful',
ousness: 'ous',
aliti: 'al',
iviti: 'ive',
biliti: 'ble',
logi: 'log'
};
var step3list = {
icate: 'ic',
ative: '',
alize: 'al',
iciti: 'ic',
ical: 'ic',
ful: '',
ness: ''
};
var c = "[^aeiou]"; // consonant
var v = "[aeiouy]"; // vowel
var C = c + "[^aeiouy]*"; // consonant sequence
var V = v + "[aeiou]*"; // vowel sequence
var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
var s_v = "^(" + C + ")?" + v; // vowel in stem
this.stemWord = function (w) {
var stem;
var suffix;
var firstch;
var origword = w;
if (w.length < 3)
return w;
var re;
var re2;
var re3;
var re4;
firstch = w.substr(0,1);
if (firstch == "y")
w = firstch.toUpperCase() + w.substr(1);
// Step 1a
re = /^(.+?)(ss|i)es$/;
re2 = /^(.+?)([^s])s$/;
if (re.test(w))
w = w.replace(re,"$1$2");
else if (re2.test(w))
w = w.replace(re2,"$1$2");
// Step 1b
re = /^(.+?)eed$/;
re2 = /^(.+?)(ed|ing)$/;
if (re.test(w)) {
var fp = re.exec(w);
re = new RegExp(mgr0);
if (re.test(fp[1])) {
re = /.$/;
w = w.replace(re,"");
}
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1];
re2 = new RegExp(s_v);
if (re2.test(stem)) {
w = stem;
re2 = /(at|bl|iz)$/;
re3 = new RegExp("([^aeiouylsz])\\1$");
re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re2.test(w))
w = w + "e";
else if (re3.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
else if (re4.test(w))
w = w + "e";
}
}
// Step 1c
re = /^(.+?)y$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(s_v);
if (re.test(stem))
w = stem + "i";
}
// Step 2
re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step2list[suffix];
}
// Step 3
re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step3list[suffix];
}
// Step 4
re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
re2 = /^(.+?)(s|t)(ion)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
if (re.test(stem))
w = stem;
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1] + fp[2];
re2 = new RegExp(mgr1);
if (re2.test(stem))
w = stem;
}
// Step 5
re = /^(.+?)e$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
re2 = new RegExp(meq1);
re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
w = stem;
}
re = /ll$/;
re2 = new RegExp(mgr1);
if (re.test(w) && re2.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
// and turn initial Y back to y
if (firstch == "y")
w = firstch.toLowerCase() + w.substr(1);
return w;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

@ -0,0 +1,74 @@
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #f8f8f8; }
.highlight .c { color: #3D7B7B; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #FF0000 } /* Error */
.highlight .k { color: #008000; font-weight: bold } /* Keyword */
.highlight .o { color: #666666 } /* Operator */
.highlight .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #9C6500 } /* Comment.Preproc */
.highlight .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
.highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #E40000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #008400 } /* Generic.Inserted */
.highlight .go { color: #717171 } /* Generic.Output */
.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #0044DD } /* Generic.Traceback */
.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008000 } /* Keyword.Pseudo */
.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #B00040 } /* Keyword.Type */
.highlight .m { color: #666666 } /* Literal.Number */
.highlight .s { color: #BA2121 } /* Literal.String */
.highlight .na { color: #687822 } /* Name.Attribute */
.highlight .nb { color: #008000 } /* Name.Builtin */
.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
.highlight .no { color: #880000 } /* Name.Constant */
.highlight .nd { color: #AA22FF } /* Name.Decorator */
.highlight .ni { color: #717171; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0000FF } /* Name.Function */
.highlight .nl { color: #767600 } /* Name.Label */
.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #19177C } /* Name.Variable */
.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #666666 } /* Literal.Number.Bin */
.highlight .mf { color: #666666 } /* Literal.Number.Float */
.highlight .mh { color: #666666 } /* Literal.Number.Hex */
.highlight .mi { color: #666666 } /* Literal.Number.Integer */
.highlight .mo { color: #666666 } /* Literal.Number.Oct */
.highlight .sa { color: #BA2121 } /* Literal.String.Affix */
.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
.highlight .sc { color: #BA2121 } /* Literal.String.Char */
.highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */
.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
.highlight .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
.highlight .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
.highlight .sx { color: #008000 } /* Literal.String.Other */
.highlight .sr { color: #A45A77 } /* Literal.String.Regex */
.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
.highlight .ss { color: #19177C } /* Literal.String.Symbol */
.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0000FF } /* Name.Function.Magic */
.highlight .vc { color: #19177C } /* Name.Variable.Class */
.highlight .vg { color: #19177C } /* Name.Variable.Global */
.highlight .vi { color: #19177C } /* Name.Variable.Instance */
.highlight .vm { color: #19177C } /* Name.Variable.Magic */
.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */

@ -0,0 +1,530 @@
/*
* searchtools.js
* ~~~~~~~~~~~~~~~~
*
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
"use strict";
/**
* Simple result scoring code.
*/
if (typeof Scorer === "undefined") {
var Scorer = {
// Implement the following function to further tweak the score for each result
// The function takes a result array [docname, title, anchor, descr, score, filename]
// and returns the new score.
/*
score: result => {
const [docname, title, anchor, descr, score, filename] = result
return score
},
*/
// query matches the full name of an object
objNameMatch: 11,
// or matches in the last dotted part of the object name
objPartialMatch: 6,
// Additive scores depending on the priority of the object
objPrio: {
0: 15, // used to be importantResults
1: 5, // used to be objectResults
2: -5, // used to be unimportantResults
},
// Used when the priority is not in the mapping.
objPrioDefault: 0,
// query found in title
title: 15,
partialTitle: 7,
// query found in terms
term: 5,
partialTerm: 2,
};
}
const _removeChildren = (element) => {
while (element && element.lastChild) element.removeChild(element.lastChild);
};
/**
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
*/
const _escapeRegExp = (string) =>
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
const _displayItem = (item, highlightTerms, searchTerms) => {
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT;
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
const [docName, title, anchor, descr] = item;
let listItem = document.createElement("li");
let requestUrl;
let linkUrl;
if (docBuilder === "dirhtml") {
// dirhtml builder
let dirname = docName + "/";
if (dirname.match(/\/index\/$/))
dirname = dirname.substring(0, dirname.length - 6);
else if (dirname === "index/") dirname = "";
requestUrl = docUrlRoot + dirname;
linkUrl = requestUrl;
} else {
// normal html builders
requestUrl = docUrlRoot + docName + docFileSuffix;
linkUrl = docName + docLinkSuffix;
}
const params = new URLSearchParams();
params.set("highlight", [...highlightTerms].join(" "));
let linkEl = listItem.appendChild(document.createElement("a"));
linkEl.href = linkUrl + "?" + params.toString() + anchor;
linkEl.innerHTML = title;
if (descr)
listItem.appendChild(document.createElement("span")).innerHTML =
" (" + descr + ")";
else if (showSearchSummary)
fetch(requestUrl)
.then((responseData) => responseData.text())
.then((data) => {
if (data)
listItem.appendChild(
Search.makeSearchSummary(data, searchTerms, highlightTerms)
);
});
Search.output.appendChild(listItem);
};
const _finishSearch = (resultCount) => {
Search.stopPulse();
Search.title.innerText = _("Search Results");
if (!resultCount)
Search.status.innerText = Documentation.gettext(
"Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories."
);
else
Search.status.innerText = _(
`Search finished, found ${resultCount} page(s) matching the search query.`
);
};
const _displayNextItem = (
results,
resultCount,
highlightTerms,
searchTerms
) => {
// results left, load the summary and display it
// this is intended to be dynamic (don't sub resultsCount)
if (results.length) {
_displayItem(results.pop(), highlightTerms, searchTerms);
setTimeout(
() => _displayNextItem(results, resultCount, highlightTerms, searchTerms),
5
);
}
// search finished, update title and status message
else _finishSearch(resultCount);
};
/**
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a
* custom function per language.
*
* The regular expression works by splitting the string on consecutive characters
* that are not Unicode letters, numbers, underscores, or emoji characters.
* This is the same as ``\W+`` in Python, preserving the surrogate pair area.
*/
if (typeof splitQuery === "undefined") {
var splitQuery = (query) => query
.split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu)
.filter(term => term) // remove remaining empty strings
}
/**
* Search Module
*/
const Search = {
_index: null,
_queued_query: null,
_pulse_status: -1,
htmlToText: (htmlString) => {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() });
const docContent = htmlElement.querySelector('[role="main"]');
if (docContent !== undefined) return docContent.textContent;
console.warn(
"Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template."
);
return "";
},
init: () => {
const query = new URLSearchParams(window.location.search).get("q");
document
.querySelectorAll('input[name="q"]')
.forEach((el) => (el.value = query));
if (query) Search.performSearch(query);
},
loadIndex: (url) =>
(document.body.appendChild(document.createElement("script")).src = url),
setIndex: (index) => {
Search._index = index;
if (Search._queued_query !== null) {
const query = Search._queued_query;
Search._queued_query = null;
Search.query(query);
}
},
hasIndex: () => Search._index !== null,
deferQuery: (query) => (Search._queued_query = query),
stopPulse: () => (Search._pulse_status = -1),
startPulse: () => {
if (Search._pulse_status >= 0) return;
const pulse = () => {
Search._pulse_status = (Search._pulse_status + 1) % 4;
Search.dots.innerText = ".".repeat(Search._pulse_status);
if (Search._pulse_status >= 0) window.setTimeout(pulse, 500);
};
pulse();
},
/**
* perform a search for something (or wait until index is loaded)
*/
performSearch: (query) => {
// create the required interface elements
const searchText = document.createElement("h2");
searchText.textContent = _("Searching");
const searchSummary = document.createElement("p");
searchSummary.classList.add("search-summary");
searchSummary.innerText = "";
const searchList = document.createElement("ul");
searchList.classList.add("search");
const out = document.getElementById("search-results");
Search.title = out.appendChild(searchText);
Search.dots = Search.title.appendChild(document.createElement("span"));
Search.status = out.appendChild(searchSummary);
Search.output = out.appendChild(searchList);
const searchProgress = document.getElementById("search-progress");
// Some themes don't use the search progress node
if (searchProgress) {
searchProgress.innerText = _("Preparing search...");
}
Search.startPulse();
// index already loaded, the browser was quick!
if (Search.hasIndex()) Search.query(query);
else Search.deferQuery(query);
},
/**
* execute search (requires search index to be loaded)
*/
query: (query) => {
// stem the search terms and add them to the correct list
const stemmer = new Stemmer();
const searchTerms = new Set();
const excludedTerms = new Set();
const highlightTerms = new Set();
const objectTerms = new Set(splitQuery(query.toLowerCase().trim()));
splitQuery(query.trim()).forEach((queryTerm) => {
const queryTermLower = queryTerm.toLowerCase();
// maybe skip this "word"
// stopwords array is from language_data.js
if (
stopwords.indexOf(queryTermLower) !== -1 ||
queryTerm.match(/^\d+$/)
)
return;
// stem the word
let word = stemmer.stemWord(queryTermLower);
// select the correct list
if (word[0] === "-") excludedTerms.add(word.substr(1));
else {
searchTerms.add(word);
highlightTerms.add(queryTermLower);
}
});
// console.debug("SEARCH: searching for:");
// console.info("required: ", [...searchTerms]);
// console.info("excluded: ", [...excludedTerms]);
// array of [docname, title, anchor, descr, score, filename]
let results = [];
_removeChildren(document.getElementById("search-progress"));
// lookup as object
objectTerms.forEach((term) =>
results.push(...Search.performObjectSearch(term, objectTerms))
);
// lookup as search terms in fulltext
results.push(...Search.performTermsSearch(searchTerms, excludedTerms));
// let the scorer override scores with a custom scoring function
if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item)));
// now sort the results by score (in opposite order of appearance, since the
// display function below uses pop() to retrieve items) and then
// alphabetically
results.sort((a, b) => {
const leftScore = a[4];
const rightScore = b[4];
if (leftScore === rightScore) {
// same score: sort alphabetically
const leftTitle = a[1].toLowerCase();
const rightTitle = b[1].toLowerCase();
if (leftTitle === rightTitle) return 0;
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
}
return leftScore > rightScore ? 1 : -1;
});
// remove duplicate search results
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
let seen = new Set();
results = results.reverse().reduce((acc, result) => {
let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(',');
if (!seen.has(resultStr)) {
acc.push(result);
seen.add(resultStr);
}
return acc;
}, []);
results = results.reverse();
// for debugging
//Search.lastresults = results.slice(); // a copy
// console.info("search results:", Search.lastresults);
// print the results
_displayNextItem(results, results.length, highlightTerms, searchTerms);
},
/**
* search for object names
*/
performObjectSearch: (object, objectTerms) => {
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const objects = Search._index.objects;
const objNames = Search._index.objnames;
const titles = Search._index.titles;
const results = [];
const objectSearchCallback = (prefix, match) => {
const name = match[4]
const fullname = (prefix ? prefix + "." : "") + name;
const fullnameLower = fullname.toLowerCase();
if (fullnameLower.indexOf(object) < 0) return;
let score = 0;
const parts = fullnameLower.split(".");
// check for different match types: exact matches of full name or
// "last name" (i.e. last dotted part)
if (fullnameLower === object || parts.slice(-1)[0] === object)
score += Scorer.objNameMatch;
else if (parts.slice(-1)[0].indexOf(object) > -1)
score += Scorer.objPartialMatch; // matches in last name
const objName = objNames[match[1]][2];
const title = titles[match[0]];
// If more than one term searched for, we require other words to be
// found in the name/title/description
const otherTerms = new Set(objectTerms);
otherTerms.delete(object);
if (otherTerms.size > 0) {
const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase();
if (
[...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0)
)
return;
}
let anchor = match[3];
if (anchor === "") anchor = fullname;
else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname;
const descr = objName + _(", in ") + title;
// add custom score for some objects according to scorer
if (Scorer.objPrio.hasOwnProperty(match[2]))
score += Scorer.objPrio[match[2]];
else score += Scorer.objPrioDefault;
results.push([
docNames[match[0]],
fullname,
"#" + anchor,
descr,
score,
filenames[match[0]],
]);
};
Object.keys(objects).forEach((prefix) =>
objects[prefix].forEach((array) =>
objectSearchCallback(prefix, array)
)
);
return results;
},
/**
* search for full-text terms in the index
*/
performTermsSearch: (searchTerms, excludedTerms) => {
// prepare search
const terms = Search._index.terms;
const titleTerms = Search._index.titleterms;
const docNames = Search._index.docnames;
const filenames = Search._index.filenames;
const titles = Search._index.titles;
const scoreMap = new Map();
const fileMap = new Map();
// perform the search on the required terms
searchTerms.forEach((word) => {
const files = [];
const arr = [
{ files: terms[word], score: Scorer.term },
{ files: titleTerms[word], score: Scorer.title },
];
// add support for partial matches
if (word.length > 2) {
const escapedWord = _escapeRegExp(word);
Object.keys(terms).forEach((term) => {
if (term.match(escapedWord) && !terms[word])
arr.push({ files: terms[term], score: Scorer.partialTerm });
});
Object.keys(titleTerms).forEach((term) => {
if (term.match(escapedWord) && !titleTerms[word])
arr.push({ files: titleTerms[word], score: Scorer.partialTitle });
});
}
// no match but word was a required one
if (arr.every((record) => record.files === undefined)) return;
// found search word in contents
arr.forEach((record) => {
if (record.files === undefined) return;
let recordFiles = record.files;
if (recordFiles.length === undefined) recordFiles = [recordFiles];
files.push(...recordFiles);
// set score for the word in each file
recordFiles.forEach((file) => {
if (!scoreMap.has(file)) scoreMap.set(file, {});
scoreMap.get(file)[word] = record.score;
});
});
// create the mapping
files.forEach((file) => {
if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1)
fileMap.get(file).push(word);
else fileMap.set(file, [word]);
});
});
// now check if the files don't contain excluded terms
const results = [];
for (const [file, wordList] of fileMap) {
// check if all requirements are matched
// as search terms with length < 3 are discarded
const filteredTermCount = [...searchTerms].filter(
(term) => term.length > 2
).length;
if (
wordList.length !== searchTerms.size &&
wordList.length !== filteredTermCount
)
continue;
// ensure that none of the excluded terms is in the search result
if (
[...excludedTerms].some(
(term) =>
terms[term] === file ||
titleTerms[term] === file ||
(terms[term] || []).includes(file) ||
(titleTerms[term] || []).includes(file)
)
)
break;
// select one (max) score for the file.
const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w]));
// add result to the result list
results.push([
docNames[file],
titles[file],
"",
null,
score,
filenames[file],
]);
}
return results;
},
/**
* helper function to return a node containing the
* search summary for a given text. keywords is a list
* of stemmed words, highlightWords is the list of normal, unstemmed
* words. the first one is used to find the occurrence, the
* latter for highlighting it.
*/
makeSearchSummary: (htmlText, keywords, highlightWords) => {
const text = Search.htmlToText(htmlText);
if (text === "") return null;
const textLower = text.toLowerCase();
const actualStartPosition = [...keywords]
.map((k) => textLower.indexOf(k.toLowerCase()))
.filter((i) => i > -1)
.slice(-1)[0];
const startWithContext = Math.max(actualStartPosition - 120, 0);
const top = startWithContext === 0 ? "" : "...";
const tail = startWithContext + 240 < text.length ? "..." : "";
let summary = document.createElement("p");
summary.classList.add("context");
summary.textContent = top + text.substr(startWithContext, 240).trim() + tail;
highlightWords.forEach((highlightWord) =>
_highlightText(summary, highlightWord, "highlighted")
);
return summary;
},
};
_ready(Search.init);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -0,0 +1,443 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &mdash; DIPFA documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="#" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> DIPFA
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<!-- Local TOC -->
<div class="local-toc"></div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">DIPFA</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li>Index</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1 id="index">Index</h1>
<div class="genindex-jumpbox">
<a href="#A"><strong>A</strong></a>
| <a href="#B"><strong>B</strong></a>
| <a href="#C"><strong>C</strong></a>
| <a href="#D"><strong>D</strong></a>
| <a href="#E"><strong>E</strong></a>
| <a href="#F"><strong>F</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#H"><strong>H</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#N"><strong>N</strong></a>
| <a href="#O"><strong>O</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#R"><strong>R</strong></a>
| <a href="#S"><strong>S</strong></a>
| <a href="#T"><strong>T</strong></a>
| <a href="#V"><strong>V</strong></a>
</div>
<h2 id="A">A</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.computeService.add">add() (in module service.computeService)</a>
</li>
<li><a href="service.html#service.affineService.affine">affine() (in module service.affineService)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.computeService.andOp">andOp() (in module service.computeService)</a>
</li>
<li><a href="service.html#service.noiseBlurService.avg_blur">avg_blur() (in module service.noiseBlurService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="B">B</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.noiseBlurService.band_pass_filter">band_pass_filter() (in module service.noiseBlurService)</a>
</li>
<li><a href="service.html#service.noiseBlurService.band_stop_filter">band_stop_filter() (in module service.noiseBlurService)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.augmentService.butterworth_hp_filter">butterworth_hp_filter() (in module service.augmentService)</a>
</li>
<li><a href="service.html#service.augmentService.butterworth_lp_filter">butterworth_lp_filter() (in module service.augmentService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="C">C</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.edgeDetectionService.canny">canny() (in module service.edgeDetectionService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="D">D</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.morphologyService.dilate">dilate() (in module service.morphologyService)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.computeService.divide">divide() (in module service.computeService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="E">E</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.morphologyService.erode">erode() (in module service.morphologyService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="F">F</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.augmentService.frequency_filter">frequency_filter() (in module service.augmentService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="G">G</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.augmentService.gauss_hp_filter">gauss_hp_filter() (in module service.augmentService)</a>
</li>
<li><a href="service.html#service.augmentService.gauss_lp_filter">gauss_lp_filter() (in module service.augmentService)</a>
</li>
<li><a href="service.html#service.noiseBlurService.gaussian_blur">gaussian_blur() (in module service.noiseBlurService)</a>
</li>
<li><a href="service.html#service.noiseBlurService.gaussian_noise">gaussian_noise() (in module service.noiseBlurService)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.noiseBlurService.geometric_blur">geometric_blur() (in module service.noiseBlurService)</a>
</li>
<li><a href="service.html#service.houghService.getEdges">getEdges() (in module service.houghService)</a>
</li>
<li><a href="service.html#service.colorSpaceService.getHSV">getHSV() (in module service.colorSpaceService)</a>
</li>
<li><a href="service.html#service.colorSpaceService.getRGB">getRGB() (in module service.colorSpaceService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="H">H</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.noiseBlurService.harmonic_blur">harmonic_blur() (in module service.noiseBlurService)</a>
</li>
<li><a href="service.html#service.noiseBlurService.high_pass_filter">high_pass_filter() (in module service.noiseBlurService)</a>
</li>
<li><a href="service.html#service.histService.histCover">histCover() (in module service.histService)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.flipService.horizontalFlip">horizontalFlip() (in module service.flipService)</a>
</li>
<li><a href="service.html#service.houghService.hough">hough() (in module service.houghService)</a>
</li>
<li><a href="service.html#service.houghService.houghP">houghP() (in module service.houghService)</a>
</li>
<li><a href="service.html#service.augmentService.hp_filter">hp_filter() (in module service.augmentService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.edgeDetectionService.laplacian">laplacian() (in module service.edgeDetectionService)</a>
</li>
<li><a href="service.html#service.augmentService.laplacian_grad">laplacian_grad() (in module service.augmentService)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.edgeDetectionService.LoG">LoG() (in module service.edgeDetectionService)</a>
</li>
<li><a href="service.html#service.noiseBlurService.low_pass_filter">low_pass_filter() (in module service.noiseBlurService)</a>
</li>
<li><a href="service.html#service.augmentService.lp_filter">lp_filter() (in module service.augmentService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.noiseBlurService.max_blur">max_blur() (in module service.noiseBlurService)</a>
</li>
<li><a href="service.html#service.noiseBlurService.med_blur">med_blur() (in module service.noiseBlurService)</a>
</li>
<li><a href="service.html#service.noiseBlurService.min_blur">min_blur() (in module service.noiseBlurService)</a>
</li>
<li>
module
<ul>
<li><a href="service.html#module-service">service</a>
</li>
<li><a href="service.html#module-service.affineService">service.affineService</a>
</li>
<li><a href="service.html#module-service.augmentService">service.augmentService</a>
</li>
<li><a href="service.html#module-service.colorSpaceService">service.colorSpaceService</a>
</li>
<li><a href="service.html#module-service.computeService">service.computeService</a>
</li>
<li><a href="service.html#module-service.edgeDetectionService">service.edgeDetectionService</a>
</li>
<li><a href="service.html#module-service.flipService">service.flipService</a>
</li>
<li><a href="service.html#module-service.histService">service.histService</a>
</li>
<li><a href="service.html#module-service.houghService">service.houghService</a>
</li>
<li><a href="service.html#module-service.morphologyService">service.morphologyService</a>
</li>
<li><a href="service.html#module-service.noiseBlurService">service.noiseBlurService</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.morphologyService.morphClose">morphClose() (in module service.morphologyService)</a>
</li>
<li><a href="service.html#service.morphologyService.morphOpen">morphOpen() (in module service.morphologyService)</a>
</li>
<li><a href="service.html#service.computeService.multiply">multiply() (in module service.computeService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="N">N</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.computeService.notOp">notOp() (in module service.computeService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="O">O</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.computeService.orOp">orOp() (in module service.computeService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.augmentService.prewitt_grad">prewitt_grad() (in module service.augmentService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.edgeDetectionService.roberts">roberts() (in module service.edgeDetectionService)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.augmentService.roberts_grad">roberts_grad() (in module service.augmentService)</a>
</li>
<li><a href="service.html#service.computeService.rotate">rotate() (in module service.computeService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.computeService.scale">scale() (in module service.computeService)</a>
</li>
<li>
service
<ul>
<li><a href="service.html#module-service">module</a>
</li>
</ul></li>
<li>
service.affineService
<ul>
<li><a href="service.html#module-service.affineService">module</a>
</li>
</ul></li>
<li>
service.augmentService
<ul>
<li><a href="service.html#module-service.augmentService">module</a>
</li>
</ul></li>
<li>
service.colorSpaceService
<ul>
<li><a href="service.html#module-service.colorSpaceService">module</a>
</li>
</ul></li>
<li>
service.computeService
<ul>
<li><a href="service.html#module-service.computeService">module</a>
</li>
</ul></li>
<li>
service.edgeDetectionService
<ul>
<li><a href="service.html#module-service.edgeDetectionService">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
service.flipService
<ul>
<li><a href="service.html#module-service.flipService">module</a>
</li>
</ul></li>
<li>
service.histService
<ul>
<li><a href="service.html#module-service.histService">module</a>
</li>
</ul></li>
<li>
service.houghService
<ul>
<li><a href="service.html#module-service.houghService">module</a>
</li>
</ul></li>
<li>
service.morphologyService
<ul>
<li><a href="service.html#module-service.morphologyService">module</a>
</li>
</ul></li>
<li>
service.noiseBlurService
<ul>
<li><a href="service.html#module-service.noiseBlurService">module</a>
</li>
</ul></li>
<li><a href="service.html#service.edgeDetectionService.sobel">sobel() (in module service.edgeDetectionService)</a>
</li>
<li><a href="service.html#service.augmentService.sobel_grad">sobel_grad() (in module service.augmentService)</a>
</li>
<li><a href="service.html#service.noiseBlurService.sp_noise">sp_noise() (in module service.noiseBlurService)</a>
</li>
<li><a href="service.html#service.computeService.subtract">subtract() (in module service.computeService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="T">T</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.computeService.translate">translate() (in module service.computeService)</a>
</li>
</ul></td>
</tr></table>
<h2 id="V">V</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="service.html#service.flipService.verticalFlip">verticalFlip() (in module service.flipService)</a>
</li>
</ul></td>
</tr></table>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022, csc &amp; wch.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

@ -0,0 +1,111 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to DIPFAs documentation! &mdash; DIPFA documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="#" class="icon icon-home"> DIPFA
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<!-- Local TOC -->
<div class="local-toc"><ul>
<li><a class="reference internal" href="#">Welcome to DIPFAs documentation!</a></li>
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
</ul>
</div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="#">DIPFA</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="#" class="icon icon-home"></a> &raquo;</li>
<li>Welcome to DIPFAs documentation!</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="welcome-to-dipfa-s-documentation">
<h1>Welcome to DIPFAs documentation!<a class="headerlink" href="#welcome-to-dipfa-s-documentation" title="Permalink to this heading"></a></h1>
<div class="toctree-wrapper compound">
</div>
</section>
<section id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this heading"></a></h1>
<ul class="simple">
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li>
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
</ul>
</section>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022, csc &amp; wch.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>service &mdash; DIPFA documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> DIPFA
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<!-- Local TOC -->
<div class="local-toc"><ul>
<li><a class="reference internal" href="#">service</a></li>
</ul>
</div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">DIPFA</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li>service</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/modules.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="service">
<h1>service<a class="headerlink" href="#service" title="Permalink to this heading"></a></h1>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="service.html">service package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="service.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.affineService">service.affineService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.augmentService">service.augmentService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.colorSpaceService">service.colorSpaceService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.computeService">service.computeService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.edgeDetectionService">service.edgeDetectionService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.flipService">service.flipService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.histService">service.histService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.houghService">service.houghService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.morphologyService">service.morphologyService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service.noiseBlurService">service.noiseBlurService module</a></li>
<li class="toctree-l2"><a class="reference internal" href="service.html#module-service">Module contents</a></li>
</ul>
</li>
</ul>
</div>
</section>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022, csc &amp; wch.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

Binary file not shown.

@ -0,0 +1,163 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python Module Index &mdash; DIPFA documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> DIPFA
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<!-- Local TOC -->
<div class="local-toc"></div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">DIPFA</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li>Python Module Index</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Python Module Index</h1>
<div class="modindex-jumpbox">
<a href="#cap-s"><strong>s</strong></a>
</div>
<table class="indextable modindextable">
<tr class="pcap"><td></td><td>&#160;</td><td></td></tr>
<tr class="cap" id="cap-s"><td></td><td>
<strong>s</strong></td><td></td></tr>
<tr>
<td><img src="_static/minus.png" class="toggler"
id="toggle-1" style="display: none" alt="-" /></td>
<td>
<a href="service.html#module-service"><code class="xref">service</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.affineService"><code class="xref">service.affineService</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.augmentService"><code class="xref">service.augmentService</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.colorSpaceService"><code class="xref">service.colorSpaceService</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.computeService"><code class="xref">service.computeService</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.edgeDetectionService"><code class="xref">service.edgeDetectionService</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.flipService"><code class="xref">service.flipService</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.histService"><code class="xref">service.histService</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.houghService"><code class="xref">service.houghService</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.morphologyService"><code class="xref">service.morphologyService</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="service.html#module-service.noiseBlurService"><code class="xref">service.noiseBlurService</code></a></td><td>
<em></em></td></tr>
</table>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022, csc &amp; wch.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

@ -0,0 +1,113 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &mdash; DIPFA documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/js/theme.js"></script>
<script src="_static/searchtools.js"></script>
<script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="#" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> DIPFA
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="#" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<!-- Local TOC -->
<div class="local-toc"></div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">DIPFA</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li>Search</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<noscript>
<div id="fallback" class="admonition warning">
<p class="last">
Please activate JavaScript to enable the search functionality.
</p>
</div>
</noscript>
<div id="search-results">
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022, csc &amp; wch.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<script>
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
<script id="searchindexloader"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

@ -0,0 +1,580 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>service package &mdash; DIPFA documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> DIPFA
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<!-- Local TOC -->
<div class="local-toc"><ul>
<li><a class="reference internal" href="#">service package</a><ul>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-service.affineService">service.affineService module</a></li>
<li><a class="reference internal" href="#module-service.augmentService">service.augmentService module</a></li>
<li><a class="reference internal" href="#module-service.colorSpaceService">service.colorSpaceService module</a></li>
<li><a class="reference internal" href="#module-service.computeService">service.computeService module</a></li>
<li><a class="reference internal" href="#module-service.edgeDetectionService">service.edgeDetectionService module</a></li>
<li><a class="reference internal" href="#module-service.flipService">service.flipService module</a></li>
<li><a class="reference internal" href="#module-service.histService">service.histService module</a></li>
<li><a class="reference internal" href="#module-service.houghService">service.houghService module</a></li>
<li><a class="reference internal" href="#module-service.morphologyService">service.morphologyService module</a></li>
<li><a class="reference internal" href="#module-service.noiseBlurService">service.noiseBlurService module</a></li>
<li><a class="reference internal" href="#module-service">Module contents</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">DIPFA</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li>service package</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/service.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="service-package">
<h1>service package<a class="headerlink" href="#service-package" title="Permalink to this heading"></a></h1>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this heading"></a></h2>
</section>
<section id="module-service.affineService">
<span id="service-affineservice-module"></span><h2>service.affineService module<a class="headerlink" href="#module-service.affineService" title="Permalink to this heading"></a></h2>
<p>&#64;File : affineService.py
&#64;Author: csc
&#64;Date : 2022/7/19
仿射变换</p>
<dl class="py function">
<dt class="sig sig-object py" id="service.affineService.affine">
<span class="sig-prename descclassname"><span class="pre">service.affineService.</span></span><span class="sig-name descname"><span class="pre">affine</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.affineService.affine" title="Permalink to this definition"></a></dt>
<dd><p>仿射变换
post1: Array&lt;Tuple&lt;float, float&gt;&gt; | [[x1, y1], [x2, y2], [x3, y3]] 三个点
post2: Array&lt;Tuple&lt;float, float&gt;&gt; | [[x1, y1], [x2, y2], [x3, y3]] 三个点
:return: img</p>
</dd></dl>
</section>
<section id="module-service.augmentService">
<span id="service-augmentservice-module"></span><h2>service.augmentService module<a class="headerlink" href="#module-service.augmentService" title="Permalink to this heading"></a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.butterworth_hp_filter">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">butterworth_hp_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.butterworth_hp_filter" title="Permalink to this definition"></a></dt>
<dd><p>巴特沃斯高通滤波
d0: int | 截止频率
n: int | 阶数
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.butterworth_lp_filter">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">butterworth_lp_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.butterworth_lp_filter" title="Permalink to this definition"></a></dt>
<dd><p>巴特沃斯低通滤波
d0: int | 截止频率
n: int | 阶数
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.frequency_filter">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">frequency_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">image</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filtered</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.frequency_filter" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.gauss_hp_filter">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">gauss_hp_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.gauss_hp_filter" title="Permalink to this definition"></a></dt>
<dd><p>高斯高通滤波
d0: int | 截止频率
n: int | 阶数
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.gauss_lp_filter">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">gauss_lp_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.gauss_lp_filter" title="Permalink to this definition"></a></dt>
<dd><p>高斯低通滤波
d0: int | 截止频率
n: int | 阶数
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.hp_filter">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">hp_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.hp_filter" title="Permalink to this definition"></a></dt>
<dd><p>理想高通滤波
d0: int | 截止频率
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.laplacian_grad">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">laplacian_grad</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.laplacian_grad" title="Permalink to this definition"></a></dt>
<dd><p>Laplacian梯度算子</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.lp_filter">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">lp_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.lp_filter" title="Permalink to this definition"></a></dt>
<dd><p>理想低通滤波
d0: int | 截止频率
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.prewitt_grad">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">prewitt_grad</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.prewitt_grad" title="Permalink to this definition"></a></dt>
<dd><p>Prewitt梯度算子</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.roberts_grad">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">roberts_grad</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.roberts_grad" title="Permalink to this definition"></a></dt>
<dd><p>Roberts 梯度算子
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.augmentService.sobel_grad">
<span class="sig-prename descclassname"><span class="pre">service.augmentService.</span></span><span class="sig-name descname"><span class="pre">sobel_grad</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.augmentService.sobel_grad" title="Permalink to this definition"></a></dt>
<dd><p>Sobel 梯度算子</p>
</dd></dl>
</section>
<section id="module-service.colorSpaceService">
<span id="service-colorspaceservice-module"></span><h2>service.colorSpaceService module<a class="headerlink" href="#module-service.colorSpaceService" title="Permalink to this heading"></a></h2>
<p>&#64;File : colorSpaceService.py
&#64;Author: csc
&#64;Date : 2022/6/22
色彩空间</p>
<dl class="py function">
<dt class="sig sig-object py" id="service.colorSpaceService.getHSV">
<span class="sig-prename descclassname"><span class="pre">service.colorSpaceService.</span></span><span class="sig-name descname"><span class="pre">getHSV</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span></span></span><a class="headerlink" href="#service.colorSpaceService.getHSV" title="Permalink to this definition"></a></dt>
<dd><p>返回 HSV 三个通道对应的彩色图
:return: Tuple&lt;img, img, img&gt;</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.colorSpaceService.getRGB">
<span class="sig-prename descclassname"><span class="pre">service.colorSpaceService.</span></span><span class="sig-name descname"><span class="pre">getRGB</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span></span></span><a class="headerlink" href="#service.colorSpaceService.getRGB" title="Permalink to this definition"></a></dt>
<dd><p>返回 RGB 三个通道对应的彩色图
:return: Tuple&lt;img, img, img&gt;</p>
</dd></dl>
</section>
<section id="module-service.computeService">
<span id="service-computeservice-module"></span><h2>service.computeService module<a class="headerlink" href="#module-service.computeService" title="Permalink to this heading"></a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.add">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">add</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.add" title="Permalink to this definition"></a></dt>
<dd><p>加法运算
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.andOp">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">andOp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.andOp" title="Permalink to this definition"></a></dt>
<dd><p>与运算
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.divide">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">divide</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.divide" title="Permalink to this definition"></a></dt>
<dd><p>除法运算
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.multiply">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">multiply</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.multiply" title="Permalink to this definition"></a></dt>
<dd><p>乘法运算
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.notOp">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">notOp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.notOp" title="Permalink to this definition"></a></dt>
<dd><p>非运算
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.orOp">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">orOp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.orOp" title="Permalink to this definition"></a></dt>
<dd><p>或运算
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.rotate">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">rotate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.rotate" title="Permalink to this definition"></a></dt>
<dd><p>旋转
x, y: int, int | 旋转中心
deg: float | 旋转角度
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.scale">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">scale</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.scale" title="Permalink to this definition"></a></dt>
<dd><p>缩放
xArg, yArg: int, int | 目标大小
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.subtract">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">subtract</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.subtract" title="Permalink to this definition"></a></dt>
<dd><p>减法运算
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.computeService.translate">
<span class="sig-prename descclassname"><span class="pre">service.computeService.</span></span><span class="sig-name descname"><span class="pre">translate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.computeService.translate" title="Permalink to this definition"></a></dt>
<dd><p>平移
xArg, yArg: float, float | x, y 方向上的平移距离
:return: img</p>
</dd></dl>
</section>
<section id="module-service.edgeDetectionService">
<span id="service-edgedetectionservice-module"></span><h2>service.edgeDetectionService module<a class="headerlink" href="#module-service.edgeDetectionService" title="Permalink to this heading"></a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="service.edgeDetectionService.LoG">
<span class="sig-prename descclassname"><span class="pre">service.edgeDetectionService.</span></span><span class="sig-name descname"><span class="pre">LoG</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.edgeDetectionService.LoG" title="Permalink to this definition"></a></dt>
<dd><p>LoG 边缘算子
blurSize: int | 高斯模糊 kernel 大小
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.edgeDetectionService.canny">
<span class="sig-prename descclassname"><span class="pre">service.edgeDetectionService.</span></span><span class="sig-name descname"><span class="pre">canny</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.edgeDetectionService.canny" title="Permalink to this definition"></a></dt>
<dd><p>Canny 边缘检测
blurSize: int | 高斯模糊 kernel 大小
threshold1, threshold2: int, int | 低, 高阈值
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.edgeDetectionService.laplacian">
<span class="sig-prename descclassname"><span class="pre">service.edgeDetectionService.</span></span><span class="sig-name descname"><span class="pre">laplacian</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.edgeDetectionService.laplacian" title="Permalink to this definition"></a></dt>
<dd><p>Laplacian 算子
blurSize: int | 高斯模糊 kernel 大小
ksize: int | 算子大小
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.edgeDetectionService.roberts">
<span class="sig-prename descclassname"><span class="pre">service.edgeDetectionService.</span></span><span class="sig-name descname"><span class="pre">roberts</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.edgeDetectionService.roberts" title="Permalink to this definition"></a></dt>
<dd><p>Roberts 算子
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.edgeDetectionService.sobel">
<span class="sig-prename descclassname"><span class="pre">service.edgeDetectionService.</span></span><span class="sig-name descname"><span class="pre">sobel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.edgeDetectionService.sobel" title="Permalink to this definition"></a></dt>
<dd><p>Sobel 算子
:return: img</p>
</dd></dl>
</section>
<section id="module-service.flipService">
<span id="service-flipservice-module"></span><h2>service.flipService module<a class="headerlink" href="#module-service.flipService" title="Permalink to this heading"></a></h2>
<p>&#64;File : flipService.py
&#64;Author: csc
&#64;Date : 2022/7/17
图像翻转</p>
<dl class="py function">
<dt class="sig sig-object py" id="service.flipService.horizontalFlip">
<span class="sig-prename descclassname"><span class="pre">service.flipService.</span></span><span class="sig-name descname"><span class="pre">horizontalFlip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.flipService.horizontalFlip" title="Permalink to this definition"></a></dt>
<dd><p>水平翻转图像
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.flipService.verticalFlip">
<span class="sig-prename descclassname"><span class="pre">service.flipService.</span></span><span class="sig-name descname"><span class="pre">verticalFlip</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.flipService.verticalFlip" title="Permalink to this definition"></a></dt>
<dd><p>垂直翻转图像
:return: img</p>
</dd></dl>
</section>
<section id="module-service.histService">
<span id="service-histservice-module"></span><h2>service.histService module<a class="headerlink" href="#module-service.histService" title="Permalink to this heading"></a></h2>
<p>&#64;File : histService.py
&#64;Author: csc
&#64;Date : 2022/7/18
直方图</p>
<dl class="py function">
<dt class="sig sig-object py" id="service.histService.histCover">
<span class="sig-prename descclassname"><span class="pre">service.histService.</span></span><span class="sig-name descname"><span class="pre">histCover</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.histService.histCover" title="Permalink to this definition"></a></dt>
<dd><p>获取 img 的直方图
返回一张有三条折线的直方图
:return: img</p>
</dd></dl>
</section>
<section id="module-service.houghService">
<span id="service-houghservice-module"></span><h2>service.houghService module<a class="headerlink" href="#module-service.houghService" title="Permalink to this heading"></a></h2>
<p>&#64;File : houghService.py
&#64;Author: csc
&#64;Date : 2022/7/19
霍夫变换</p>
<dl class="py function">
<dt class="sig sig-object py" id="service.houghService.getEdges">
<span class="sig-prename descclassname"><span class="pre">service.houghService.</span></span><span class="sig-name descname"><span class="pre">getEdges</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">img</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bsize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">threshold1</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">50</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">threshold2</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">150</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.houghService.getEdges" title="Permalink to this definition"></a></dt>
<dd><p>获取图像边缘</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.houghService.hough">
<span class="sig-prename descclassname"><span class="pre">service.houghService.</span></span><span class="sig-name descname"><span class="pre">hough</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.houghService.hough" title="Permalink to this definition"></a></dt>
<dd><p>霍夫变换
blurSize: int | 高斯模糊 kernel 大小
cannyThreshold1, cannyThreshold2: int, int | canny 边缘检测阈值
houghThreshold: int | hough 变换阈值
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.houghService.houghP">
<span class="sig-prename descclassname"><span class="pre">service.houghService.</span></span><span class="sig-name descname"><span class="pre">houghP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.houghService.houghP" title="Permalink to this definition"></a></dt>
<dd><p>概率霍夫变换
blurSize: int | 高斯模糊 kernel 大小
cannyThreshold1, cannyThreshold2: int, int | canny 边缘检测阈值
houghThreshold: int | hough 变换阈值
minLineLength: int | (最小长度)可以组成一条直线的最小点数, 少于这个点数的直线被忽略
maxLineGap: int | (最大间隙)认为在同一直线上的两点之间的最大间隙
:return: img</p>
</dd></dl>
</section>
<section id="module-service.morphologyService">
<span id="service-morphologyservice-module"></span><h2>service.morphologyService module<a class="headerlink" href="#module-service.morphologyService" title="Permalink to this heading"></a></h2>
<p>&#64;File : morphologyService.py
&#64;Author: csc
&#64;Date : 2022/7/19
形态学操作</p>
<dl class="py function">
<dt class="sig sig-object py" id="service.morphologyService.dilate">
<span class="sig-prename descclassname"><span class="pre">service.morphologyService.</span></span><span class="sig-name descname"><span class="pre">dilate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.morphologyService.dilate" title="Permalink to this definition"></a></dt>
<dd><p>膨胀: 将与物体接触的所有背景点合并到物体中,使目标增大,可添补目标中的空洞
kernelType: int | 结构元类型 0: MORPH_RECT, 1: MORPH_CROSS, 2: MORPH_ELLIPSE
kernelSize: Tuple&lt;int, int&gt; | (x, y) 结构元大小</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.morphologyService.erode">
<span class="sig-prename descclassname"><span class="pre">service.morphologyService.</span></span><span class="sig-name descname"><span class="pre">erode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.morphologyService.erode" title="Permalink to this definition"></a></dt>
<dd><p>腐蚀: 消除物体边界点,使目标缩小,可以消除小于结构元素的噪声点
kernelType: int | 结构元类型 0: MORPH_RECT, 1: MORPH_CROSS, 2: MORPH_ELLIPSE
kernelX, kernelY: int, int | (x, y) 结构元大小</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.morphologyService.morphClose">
<span class="sig-prename descclassname"><span class="pre">service.morphologyService.</span></span><span class="sig-name descname"><span class="pre">morphClose</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.morphologyService.morphClose" title="Permalink to this definition"></a></dt>
<dd><p>闭运算: 先膨胀后腐蚀,填充物体内细小的空洞,并平滑物体边界
kernelType: int | 结构元类型 0: MORPH_RECT, 1: MORPH_CROSS, 2: MORPH_ELLIPSE
kernelSize: Tuple&lt;int, int&gt; | (x, y) 结构元大小</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.morphologyService.morphOpen">
<span class="sig-prename descclassname"><span class="pre">service.morphologyService.</span></span><span class="sig-name descname"><span class="pre">morphOpen</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.morphologyService.morphOpen" title="Permalink to this definition"></a></dt>
<dd><p>开运算: 先腐蚀后膨胀,消除图像上细小的噪声,并平滑物体边界
kernelType: int | 结构元类型 0: MORPH_RECT, 1: MORPH_CROSS, 2: MORPH_ELLIPSE
kernelSize: Tuple&lt;int, int&gt; | (x, y) 结构元大小</p>
</dd></dl>
</section>
<section id="module-service.noiseBlurService">
<span id="service-noiseblurservice-module"></span><h2>service.noiseBlurService module<a class="headerlink" href="#module-service.noiseBlurService" title="Permalink to this heading"></a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.avg_blur">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">avg_blur</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.avg_blur" title="Permalink to this definition"></a></dt>
<dd><p>算术均值滤波
x, y: int, int | 滤波器大小
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.band_pass_filter">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">band_pass_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.band_pass_filter" title="Permalink to this definition"></a></dt>
<dd><p>带通滤波
threshold1, threshold2: int, int | 低阈值, 高阈值
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.band_stop_filter">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">band_stop_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.band_stop_filter" title="Permalink to this definition"></a></dt>
<dd><p>带阻滤波
threshold1, threshold2: int, int | 低阈值, 高阈值
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.gaussian_blur">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">gaussian_blur</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.gaussian_blur" title="Permalink to this definition"></a></dt>
<dd><p>高斯滤波
x, y: int, int | 滤波器大小</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.gaussian_noise">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">gaussian_noise</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.gaussian_noise" title="Permalink to this definition"></a></dt>
<dd><p>添加高斯噪声
mean: float | 均值
sigma: float | 标准差
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.geometric_blur">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">geometric_blur</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.geometric_blur" title="Permalink to this definition"></a></dt>
<dd><p>几何均值滤波
ksize: int | 滤波器大小
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.harmonic_blur">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">harmonic_blur</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.harmonic_blur" title="Permalink to this definition"></a></dt>
<dd><p>谐波均值滤波
ksize: int | 滤波器大小
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.high_pass_filter">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">high_pass_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.high_pass_filter" title="Permalink to this definition"></a></dt>
<dd><p>高通滤波
threshold1: int | 阈值
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.low_pass_filter">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">low_pass_filter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.low_pass_filter" title="Permalink to this definition"></a></dt>
<dd><p>低通滤波
threshold2: int | 阈值
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.max_blur">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">max_blur</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.max_blur" title="Permalink to this definition"></a></dt>
<dd><p>最大值滤波
ksize: int | 滤波器大小
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.med_blur">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">med_blur</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.med_blur" title="Permalink to this definition"></a></dt>
<dd><p>中值滤波
ksize: 滤波器大小
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.min_blur">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">min_blur</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.min_blur" title="Permalink to this definition"></a></dt>
<dd><p>最小值滤波
ksize: int | 滤波器大小
:return: img</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="service.noiseBlurService.sp_noise">
<span class="sig-prename descclassname"><span class="pre">service.noiseBlurService.</span></span><span class="sig-name descname"><span class="pre">sp_noise</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">imgs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#service.noiseBlurService.sp_noise" title="Permalink to this definition"></a></dt>
<dd><p>添加椒盐噪声
svp: float | 盐噪声比例 0-1之间
amount: float | 噪声占比 0-1之间
:return: img</p>
</dd></dl>
</section>
<section id="module-service">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-service" title="Permalink to this heading"></a></h2>
</section>
</section>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022, csc &amp; wch.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

@ -0,0 +1,60 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('../'))
# -- Project information -----------------------------------------------------
project = 'DIPFA'
copyright = '2022, csc & wch'
author = 'csc & wch'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

@ -0,0 +1,20 @@
.. DIPFA documentation master file, created by
sphinx-quickstart on Thu Jul 21 00:06:59 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to DIPFA's documentation!
=================================
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

@ -0,0 +1,7 @@
service
=======
.. toctree::
:maxdepth: 4
service

@ -0,0 +1,93 @@
service package
===============
Submodules
----------
service.affineService module
----------------------------
.. automodule:: service.affineService
:members:
:undoc-members:
:show-inheritance:
service.augmentService module
-----------------------------
.. automodule:: service.augmentService
:members:
:undoc-members:
:show-inheritance:
service.colorSpaceService module
--------------------------------
.. automodule:: service.colorSpaceService
:members:
:undoc-members:
:show-inheritance:
service.computeService module
-----------------------------
.. automodule:: service.computeService
:members:
:undoc-members:
:show-inheritance:
service.edgeDetectionService module
-----------------------------------
.. automodule:: service.edgeDetectionService
:members:
:undoc-members:
:show-inheritance:
service.flipService module
--------------------------
.. automodule:: service.flipService
:members:
:undoc-members:
:show-inheritance:
service.histService module
--------------------------
.. automodule:: service.histService
:members:
:undoc-members:
:show-inheritance:
service.houghService module
---------------------------
.. automodule:: service.houghService
:members:
:undoc-members:
:show-inheritance:
service.morphologyService module
--------------------------------
.. automodule:: service.morphologyService
:members:
:undoc-members:
:show-inheritance:
service.noiseBlurService module
-------------------------------
.. automodule:: service.noiseBlurService
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: service
:members:
:undoc-members:
:show-inheritance:

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 KiB

@ -0,0 +1,2 @@
*
!.gitignore

@ -0,0 +1,236 @@
# -*- coding: utf-8 -*-
"""
@File : models.py
@Author: csc
@Date : 2022/6/23
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import torchvision.models as models
import numpy as np
from collections import defaultdict
from utils import *
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# device = 'cpu'
class VGG(nn.Module):
def __init__(self, features):
super(VGG, self).__init__()
self.features = features
self.layer_name_mapping = {
'3': "relu1_2",
'8': "relu2_2",
'15': "relu3_3",
'22': "relu4_3"
}
for p in self.parameters():
p.requires_grad = False
def forward(self, x):
outs = []
for name, module in self.features._modules.items():
x = module(x)
if name in self.layer_name_mapping:
outs.append(x)
return outs
class VGG19(nn.Module):
def __init__(self, features):
super(VGG19, self).__init__()
self.features = features
self.layer_name_mapping = {
'3': "relu1_2",
'8': "relu2_2",
'17': "relu3_4",
'26': "relu4_4"
}
for p in self.parameters():
p.requires_grad = False
def forward(self, x):
outs = []
for name, module in self.features._modules.items():
x = module(x)
if name in self.layer_name_mapping:
outs.append(x)
return outs
class MyConv2D(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, groups=1):
super(MyConv2D, self).__init__()
self.weight = torch.zeros((out_channels, in_channels, kernel_size, kernel_size)).to(device)
self.bias = torch.zeros(out_channels).to(device)
self.in_channels = in_channels
self.out_channels = out_channels
self.kernel_size = (kernel_size, kernel_size)
self.stride = (stride, stride)
self.groups = groups
def forward(self, x):
return F.conv2d(x, self.weight, self.bias, self.stride, groups=self.groups)
def extra_repr(self):
s = ('{in_channels}, {out_channels}, kernel_size={kernel_size}'
', stride={stride}')
return s.format(**self.__dict__)
class ResidualBlock(nn.Module):
def __init__(self, channels):
super(ResidualBlock, self).__init__()
self.conv = nn.Sequential(
*ConvLayer(channels, channels, kernel_size=3, stride=1),
*ConvLayer(channels, channels, kernel_size=3, stride=1, relu=False)
)
def forward(self, x):
return self.conv(x) + x
class ResNeXtBlock(nn.Module):
def __init__(self, in_channels, out_channels, identity_downsample=None, stride=1, cardinality=32, width_per_group=64):
super(ResNeXtBlock, self).__init__()
width = int(out_channels * (width_per_group / 64)) * cardinality # 转换通道数
# self.conv1 = nn.Conv2d(in_channels, width, kernel_size=1, stride=1, padding=0) # 不改变尺寸
self.conv1 = MyConv2D(in_channels, width, kernel_size=1, stride=1)
self.bn1 = nn.BatchNorm2d(width)
self.conv2 = nn.Conv2d(width, width, kernel_size=3, stride=stride, padding=1, groups=cardinality) # stride=2尺寸减半stride=1尺寸不变
# self.conv2 = MyConv2D(width, width, kernel_size=3, stride=stride, groups=cardinality)
self.bn2 = nn.BatchNorm2d(width)
# self.conv3 = nn.Conv2d(width, out_channels, kernel_size=1, stride=1, padding=0) # 不改变尺寸
self.conv3 = MyConv2D(width, out_channels, kernel_size=1, stride=1)
self.bn3 = nn.BatchNorm2d(out_channels)
self.relu = nn.ReLU()
self.identity_downsample = identity_downsample
def forward(self, x):
identity = x
x = self.conv1(x)
x = self.bn1(x)
x = self.relu(x)
x = self.conv2(x)
x = self.bn2(x)
x = self.relu(x)
x = self.conv3(x)
x = self.bn3(x)
if self.identity_downsample is not None:
identity = self.identity_downsample(identity)
# 残差连接
# print(x.shape)
# print(identity.shape)
x += identity
x = self.relu(x)
return x
def ConvLayer(in_channels, out_channels, kernel_size=3, stride=1,
upsample=None, instance_norm=True, relu=True, trainable=False):
layers = []
if upsample:
layers.append(nn.Upsample(mode='nearest', scale_factor=upsample))
layers.append(nn.ReflectionPad2d(kernel_size // 2))
if trainable:
layers.append(nn.Conv2d(in_channels, out_channels, kernel_size, stride))
else:
layers.append(MyConv2D(in_channels, out_channels, kernel_size, stride))
if instance_norm:
layers.append(nn.InstanceNorm2d(out_channels))
if relu:
layers.append(nn.ReLU())
return layers
class TransformNet(nn.Module):
def __init__(self, base=8, residuals='resnet'):
super(TransformNet, self).__init__()
self.base = base
self.weights = []
self.downsampling = nn.Sequential(
*ConvLayer(3, base, kernel_size=9, trainable=True),
*ConvLayer(base, base * 2, kernel_size=3, stride=2),
*ConvLayer(base * 2, base * 4, kernel_size=3, stride=2),
)
if residuals == 'resnet':
self.residuals = nn.Sequential(*[ResidualBlock(base * 4) for i in range(5)])
elif residuals == 'resnext':
self.residuals = nn.Sequential(ResNeXtBlock(base * 4, base * 4))
self.upsampling = nn.Sequential(
*ConvLayer(base * 4, base * 2, kernel_size=3, upsample=2),
*ConvLayer(base * 2, base, kernel_size=3, upsample=2),
*ConvLayer(base, 3, kernel_size=9, instance_norm=False, relu=False, trainable=True),
)
self.get_param_dict()
def forward(self, X):
y = self.downsampling(X)
y = self.residuals(y)
y = self.upsampling(y)
return y
def get_param_dict(self):
"""找出该网络所有 MyConv2D 层,计算它们需要的权值数量"""
param_dict = defaultdict(int)
def dfs(module, name):
for name2, layer in module.named_children():
dfs(layer, '%s.%s' % (name, name2) if name != '' else name2)
if module.__class__ == MyConv2D:
param_dict[name] += int(np.prod(module.weight.shape))
param_dict[name] += int(np.prod(module.bias.shape))
dfs(self, '')
return param_dict
def set_my_attr(self, name, value):
# 下面这个循环是一步步遍历类似 residuals.0.conv.1 的字符串,找到相应的权值
target = self
for x in name.split('.'):
if x.isnumeric():
target = target.__getitem__(int(x))
else:
target = getattr(target, x)
# 设置对应的权值
n_weight = np.prod(target.weight.shape)
target.weight = value[:n_weight].view(target.weight.shape)
target.bias = value[n_weight:].view(target.bias.shape)
def set_weights(self, weights, i=0):
"""输入权值字典,对该网络所有的 MyConv2D 层设置权值"""
for name, param in weights.items():
self.set_my_attr(name, weights[name][i])
class MetaNet(nn.Module):
def __init__(self, param_dict, backbone='vgg16'):
super(MetaNet, self).__init__()
self.param_num = len(param_dict)
if backbone == 'vgg16':
self.hidden = nn.Linear(1920, 128 * self.param_num)
elif backbone == 'vgg19':
self.hidden = nn.Linear(1920, 128 * self.param_num)
self.fc_dict = {}
for i, (name, params) in enumerate(param_dict.items()):
self.fc_dict[name] = i
setattr(self, 'fc{}'.format(i + 1), nn.Linear(128, params))
def forward(self, mean_std_features):
hidden = F.relu(self.hidden(mean_std_features))
filters = {}
for name, i in self.fc_dict.items():
fc = getattr(self, 'fc{}'.format(i + 1))
filters[name] = fc(hidden[:, i * 128:(i + 1) * 128])
return filters

@ -0,0 +1,4 @@
*.t7
*.exe
*.pth
COCO2014_1000/

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
"""
@File : genCOCO2014_1000.py
@Author: csc
@Date : 2022/7/24
"""
import os
import shutil
import numpy as np
def move_file(src, dst, num=None, type='move'):
path_main = src
filelist_main = os.listdir(src)
filelist_main = np.array(filelist_main)
if num is None:
num = len(filelist_main)
else:
np.random.seed(42)
np.random.shuffle(filelist_main)
path_receive = dst
for i in range(num):
file = filelist_main[i]
suffix = os.path.splitext(file)[1] # 读取文件后缀名
filename = os.path.splitext(file)[0] # 读取文件名
if suffix == '.jpg':
src_path = os.path.join(path_main, file)
dst_path = path_receive + '\\' + file
if type == 'move':
shutil.move(src_path, dst_path)
elif type == 'copy':
shutil.copy(src_path, dst_path)
if __name__ == '__main__':
src = "../../COCO2014/train2014"
content_path = "./COCO2014_1000/"
content_class = "train2014"
try:
shutil.rmtree(content_path + content_class)
except:
os.mkdir(content_path)
os.mkdir(content_path + content_class)
move_file(src, content_path + content_class, num=1000, type='copy')

@ -0,0 +1,3 @@
wget http://47.117.118.139:10000/download/style_transfer/COCO2014_1000.zip -O COCO2014_1000.zip
tar -xzvf COCO2014_1000.zip
del COCO2014_1000.zip

@ -0,0 +1 @@
wget http://47.117.118.139:10000/download/style_transfer/vgg19-dcbb9e9d.pth -O vgg19-dcbb9e9d.pth

@ -0,0 +1,11 @@
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/instance_norm/candy.t7" -O candy.t7
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/instance_norm/la_muse.t7" -O la_muse.t7
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/instance_norm/mosaic.t7" -O mosaic.t7
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/instance_norm/feathers.t7" -O feather.t7
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/instance_norm/the_scream.t7" -O the_scream.t7
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/instance_norm/udnie.t7" -O udnie.t7
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/eccv16/the_wave.t7" -O the_wave.t7
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/eccv16/starry_night.t7" -O starry_night.t7
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/eccv16/la_muse.t7" -O la_muse_eccv16.t7
wget "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/eccv16/composition_vii.t7" -O composition_vii.t7

@ -0,0 +1,3 @@
wget http://47.117.118.139:10000/download/style_transfer/models.zip -O models.zip
tar -xzvf models.zip
del models.zip

@ -0,0 +1,169 @@
# -*- coding: utf-8 -*-
"""
@File : myTransfer.py.py
@Author: csc
@Date : 2022/7/24
"""
import os
# os.environ['CUDA_VISIBLE_DEVICES'] = '5'
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
import torchvision.models as models
import random
import shutil
from glob import glob
from tqdm import tqdm
from PIL import Image
import imagehash
import copy
from utils import *
from models import *
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# device = 'cpu'
class MetaNet(nn.Module):
def __init__(self, param_dict):
super(MetaNet, self).__init__()
self.param_num = len(param_dict)
self.hidden = nn.Linear(1920, 128 * self.param_num)
self.fc_dict = {}
for i, (name, params) in enumerate(param_dict.items()):
self.fc_dict[name] = i
setattr(self, 'fc{}'.format(i + 1), nn.Linear(128, params))
# ONNX 要求输出 tensor 或者 list不能是 dict
def forward(self, mean_std_features):
hidden = F.relu(self.hidden(mean_std_features))
filters = {}
for name, i in self.fc_dict.items():
fc = getattr(self, 'fc{}'.format(i + 1))
filters[name] = fc(hidden[:, i * 128:(i + 1) * 128])
return list(filters.values())
def forward2(self, mean_std_features):
hidden = F.relu(self.hidden(mean_std_features))
filters = {}
for name, i in self.fc_dict.items():
fc = getattr(self, 'fc{}'.format(i + 1))
filters[name] = fc(hidden[:, i * 128:(i + 1) * 128])
return filters
backbone = models.vgg19(pretrained=True)
backbone = VGG19(backbone.features[:30]).to(device).eval()
base = 32
# 可视化
width = 256
data_transform = transforms.Compose([
transforms.RandomResizedCrop(width, scale=(256 / 480, 1), ratio=(1, 1)),
transforms.ToTensor(),
tensor_normalizer
])
style_weight = 3e5
content_weight = 1
tv_weight = 1e-6
batch_size = 8
content_dataset = torchvision.datasets.ImageFolder('./models/COCO2014_1000/', transform=data_transform)
content_data_loader = torch.utils.data.DataLoader(content_dataset, batch_size=batch_size, shuffle=True)
# style buffer
buffer = {}
def style_transfer(style_img, content_img):
transform_net = TransformNet(base, residuals='resnext').to(device)
metanet = MetaNet(transform_net.get_param_dict()).to(device)
# 每次都加载一次来实现类似深拷贝的效果
transform_net.load_state_dict(torch.load('./models/metanet_base32_style300000.0_tv1e-06_tagnohvd_transform_net.pth'))
metanet.load_state_dict(torch.load('./models/metanet_base32_style300000.0_tv1e-06_tagnohvd.pth'))
trainable_params = {}
trainable_param_shapes = {}
for model in [backbone, transform_net, metanet]:
for name, param in model.named_parameters():
if param.requires_grad:
trainable_params[name] = param
trainable_param_shapes[name] = param.shape
optimizer = optim.Adam(trainable_params.values(), 1e-3)
# hash
key = imagehash.phash(Image.fromarray(style_img), hash_size=8, highfreq_factor=4)
style_img = image_to_tensor(style_img, 256)
content_img = image_to_tensor(content_img, 256)
style_image = style_img.to(device)
content_image = content_img.to(device)
if key in buffer:
_transform_net = buffer[key]
transformed_images = _transform_net(content_image)
else:
style_features = backbone(style_image)
style_mean_std = mean_std(style_features)
n_batch = 20
with tqdm(enumerate(content_data_loader), total=n_batch) as pbar:
for batch, (content_images, _) in pbar:
x = content_images.cpu().numpy()
if (x.min(-1).min(-1) == x.max(-1).max(-1)).any():
continue
optimizer.zero_grad()
# 使用风格图像生成风格模型
weights = metanet.forward2(mean_std(style_features))
transform_net.set_weights(weights, 0)
# 使用风格模型预测风格迁移图像
content_images = content_images.to(device)
transformed_images = transform_net(content_images)
# 使用 vgg19 计算特征
content_features = backbone(content_images)
transformed_features = backbone(transformed_images)
transformed_mean_std = mean_std(transformed_features)
# content loss
content_loss = content_weight * F.mse_loss(transformed_features[2], content_features[2])
# style loss
style_loss = style_weight * F.mse_loss(transformed_mean_std,
style_mean_std.expand_as(transformed_mean_std))
# total variation loss
y = transformed_images
tv_loss = tv_weight * (torch.sum(torch.abs(y[:, :, :, :-1] - y[:, :, :, 1:])) +
torch.sum(torch.abs(y[:, :, :-1, :] - y[:, :, 1:, :])))
# 求和
loss = content_loss + style_loss + tv_loss
loss.backward()
optimizer.step()
if batch > n_batch:
break
buffer[key] = transform_net
transformed_images = transform_net(content_image)
transformed_images_vis = torch.cat([x for x in transformed_images], dim=-1)
return recover_image(transformed_images_vis)

Binary file not shown.

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
"""
@File : affineService.py
@Author: csc
@Date : 2022/7/19
仿射变换
"""
import cv2
import numpy as np
import utils
def affine(imgs, args):
"""
仿射变换
post1: Array<Tuple<float, float>> | [[x1, y1], [x2, y2], [x3, y3]] 三个点
post2: Array<Tuple<float, float>> | [[x1, y1], [x2, y2], [x3, y3]] 三个点
:return: img
"""
rows, cols, channel = imgs[0].shape
for point in args['post1'] + args['post2']:
if not utils.inArea(np.float32(point), ((0, 0), (rows, cols))):
raise Exception(f'affine: point {str(point)} lies outside the image.')
post1 = np.float32(args['post1'])
post2 = np.float32(args['post2'])
M = cv2.getAffineTransform(post1, post2)
res = cv2.warpAffine(imgs[0], M, (rows, cols))
return res

@ -0,0 +1,180 @@
import cv2
import numpy as np
import service.edgeDetectionService
def frequency_filter(image, filtered):
fftImg = np.fft.fft2(image) # 对图像进行傅里叶变换
fftImgShift = np.fft.fftshift(fftImg) # 傅里叶变换后坐标移动到图像中心
handle_fftImgShift1 = fftImgShift * filtered # 对傅里叶变换后的图像进行频域变换
handle_fftImgShift2 = np.fft.ifftshift(handle_fftImgShift1)
handle_fftImgShift3 = np.fft.ifft2(handle_fftImgShift2)
handle_fftImgShift4 = np.real(handle_fftImgShift3) # 傅里叶反变换后取频域
return np.uint8(handle_fftImgShift4)
# 低通滤波
def lp_filter(imgs, args):
"""
理想低通滤波
d0: int | 截止频率
:return: img
"""
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
d0 = int(args['d0'])
H = np.empty_like(image, dtype=float)
M, N = image.shape
mid_x = int(M / 2)
mid_y = int(N / 2)
for x in range(0, M):
for y in range(0, N):
d = np.sqrt((y - mid_x) ** 2 + (x - mid_y) ** 2)
if d <= d0:
H[x, y] = 1
return frequency_filter(image, H)
def butterworth_lp_filter(imgs, args):
"""
巴特沃斯低通滤波
d0: int | 截止频率
n: int | 阶数
:return: img
"""
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
d0 = int(args['d0'])
n = int(args['n'])
H = np.empty_like(image, float)
M, N = image.shape
mid_x = int(M / 2)
mid_y = int(N / 2)
for x in range(0, M):
for y in range(0, N):
d = np.sqrt((y - mid_x) ** 2 + (x - mid_y) ** 2)
H[x, y] = 1 / (1 + (d / d0) ** (2 * n))
return frequency_filter(image, H)
def gauss_lp_filter(imgs, args):
"""
高斯低通滤波
d0: int | 截止频率
n: int | 阶数
:return: img
"""
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
d0 = int(args['d0'])
n = int(args['n'])
H = np.empty_like(image, float)
M, N = image.shape
mid_x = M / 2
mid_y = N / 2
for x in range(0, M):
for y in range(0, N):
d = np.sqrt((x - mid_x) ** 2 + (y - mid_y) ** 2)
H[x, y] = np.exp(-d ** n / (2 * d0 ** n))
return frequency_filter(image, H)
# 高通滤波
def hp_filter(imgs, args):
"""
理想高通滤波
d0: int | 截止频率
:return: img
"""
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
d0 = int(args['d0'])
H = np.empty_like(image, dtype=float)
M, N = image.shape
mid_x = int(M / 2)
mid_y = int(N / 2)
for x in range(0, M):
for y in range(0, N):
d = np.sqrt((y - mid_x) ** 2 + (x - mid_y) ** 2)
if d >= d0:
H[x, y] = 1
return frequency_filter(image, H)
def butterworth_hp_filter(imgs, args):
"""
巴特沃斯高通滤波
d0: int | 截止频率
n: int | 阶数
:return: img
"""
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
d0 = int(args['d0'])
n = int(args['n'])
H = np.empty_like(image, float)
M, N = image.shape
mid_x = int(M / 2)
mid_y = int(N / 2)
for x in range(0, M):
for y in range(0, N):
d = np.sqrt((y - mid_x) ** 2 + (x - mid_y) ** 2)
H[x, y] = 1 / (1 + (d0 / d) ** n)
return frequency_filter(image, H)
def gauss_hp_filter(imgs, args):
"""
高斯高通滤波
d0: int | 截止频率
n: int | 阶数
:return: img
"""
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
d0 = int(args['d0'])
n = int(args['n'])
H = np.empty_like(image, float)
M, N = image.shape
mid_x = M / 2
mid_y = N / 2
for x in range(0, M):
for y in range(0, N):
d = np.sqrt((x - mid_x) ** 2 + (y - mid_y) ** 2)
H[x, y] = (1 - np.exp(-d ** n / (2 * d0 ** n)))
return frequency_filter(image, H)
def roberts_grad(imgs, args=None):
"""
Roberts 梯度算子
:return: img
"""
return service.edgeDetectionService.roberts(imgs, args)
def sobel_grad(imgs, args=None):
"""
Sobel 梯度算子
"""
return service.edgeDetectionService.sobel(imgs, args)
def prewitt_grad(imgs, args=None):
"""
Prewitt梯度算子
"""
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
preX = np.array([[1, 0, -1], [1, 0, -1], [1, 0, -1]])
preY = np.array([[1, 1, 1], [0, 0, 0], [-1, -1, -1]])
x = cv2.filter2D(image, cv2.CV_16S, preX)
y = cv2.filter2D(image, cv2.CV_16S, preY)
absX = cv2.convertScaleAbs(x)
absY = cv2.convertScaleAbs(y)
return cv2.addWeighted(absX, 0.5, absY, 0.5, 0)
def laplacian_grad(imgs, args=None):
"""
Laplacian梯度算子
"""
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
lap = np.array([[0, -1, 0], [-1, 4, -1], [0, -1, 0]])
return cv2.filter2D(image, ddepth=-1, kernel=lap)

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
"""
@File : colorSpaceService.py
@Author: csc
@Date : 2022/6/22
色彩空间
"""
import cv2
import numpy as np
def getRGB(imgs, args=None) -> tuple:
"""
返回 RGB 三个通道对应的彩色图
:return: Tuple<img, img, img>
"""
b, g, r = cv2.split(imgs[0])
zeros = np.zeros(imgs[0].shape[:2], dtype="uint8")
return cv2.merge([zeros, zeros, r]), cv2.merge([zeros, g, zeros]), cv2.merge([b, zeros, zeros])
def getHSV(imgs, args=None) -> tuple:
"""
返回 HSV 三个通道对应的彩色图
:return: Tuple<img, img, img>
"""
hsv = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2HSV)
h, s, v = cv2.split(hsv)
zeros = np.zeros(imgs[0].shape[:2], dtype="uint8")
# binary, full = cv2.threshold(zeros, -1, 255, cv2.THRESH_BINARY)
return cv2.merge([h, zeros, zeros]), cv2.merge([zeros, s, zeros]), cv2.merge([zeros, zeros, v])

@ -0,0 +1,90 @@
import cv2
import numpy as np
def andOp(imgs, args=None):
"""
与运算
:return: img
"""
return imgs[0] & imgs[1]
def orOp(imgs, args=None):
"""
或运算
:return: img
"""
return imgs[0] | imgs[1]
def notOp(imgs, args=None):
"""
非运算
:return: img
"""
return ~imgs[0]
def add(imgs, args=None):
"""
加法运算
:return: img
"""
return cv2.add(imgs[0], imgs[1])
def subtract(imgs, args=None):
"""
减法运算
:return: img
"""
return cv2.subtract(imgs[0], imgs[1])
def multiply(imgs, args=None):
"""
乘法运算
:return: img
"""
return cv2.multiply(imgs[0], imgs[1])
def divide(imgs, args=None):
"""
除法运算
:return: img
"""
return cv2.divide(imgs[0], imgs[1])
def scale(imgs, args):
"""
缩放
xArg, yArg: int, int | 目标大小
:return: img
"""
return cv2.resize(imgs[0], (int(args['xArg']), int(args['yArg'])), interpolation=cv2.INTER_LINEAR)
def translate(imgs, args):
"""
平移
xArg, yArg: float, float | x, y 方向上的平移距离
:return: img
"""
height, width, channel = imgs[0].shape
M = np.float32([[1, 0, float(args['xArg'])], [0, 1, float(args['yArg'])]])
return cv2.warpAffine(imgs[0], M, (width, height))
def rotate(imgs, args):
"""
旋转
x, y: int, int | 旋转中心
deg: float | 旋转角度
:return: img
"""
height, width, channel = imgs[0].shape
M = cv2.getRotationMatrix2D((int(args['x']), int(args['y'])), float(args['deg']), 1)
return cv2.warpAffine(imgs[0], M, (width, height))

@ -0,0 +1,80 @@
import cv2
import numpy as np
def roberts(imgs, args=None):
"""
Roberts 算子
:return: img
"""
img = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
kernelx = np.array([[-1, 0], [0, 1]], dtype=int)
kernely = np.array([[0, -1], [1, 0]], dtype=int)
x = cv2.filter2D(img, cv2.CV_16S, kernelx)
y = cv2.filter2D(img, cv2.CV_16S, kernely)
absX = cv2.convertScaleAbs(x)
absY = cv2.convertScaleAbs(y)
Roberts = cv2.addWeighted(absX, 0.5, absY, 0.5, 0)
Roberts.astype('uint8')
return Roberts
def sobel(imgs, args=None):
"""
Sobel 算子
:return: img
"""
img = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
x = cv2.Sobel(img, cv2.CV_16S, 1, 0)
y = cv2.Sobel(img, cv2.CV_16S, 0, 1)
absX = cv2.convertScaleAbs(x)
absY = cv2.convertScaleAbs(y)
Sobel = cv2.addWeighted(absX, 0.5, absY, 0.5, 0)
return Sobel
def laplacian(imgs, args):
"""
Laplacian 算子
blurSize: int | 高斯模糊 kernel 大小
ksize: int | 算子大小
:return: img
"""
img = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
img = cv2.GaussianBlur(img, (int(args['blurSize']), int(args['blurSize'])), 0)
Laplacian = cv2.convertScaleAbs(cv2.Laplacian(img, cv2.CV_16S, ksize=int(args['ksize'])))
return Laplacian
def LoG(imgs, args):
"""
LoG 边缘算子
blurSize: int | 高斯模糊 kernel 大小
:return: img
"""
bsize = int(args['blurSize'])
img = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2RGB)
img = cv2.copyMakeBorder(img, 2, 2, 2, 2, borderType=cv2.BORDER_REPLICATE)
img = cv2.GaussianBlur(img, (bsize, bsize), 0, 0)
m1 = np.array([[0, 0, -1, 0, 0],
[0, -1, -2, -1, 0],
[-1, -2, 16, -2, -1],
[0, -1, -2, -1, 0],
[0, 0, -1, 0, 0]])
return cv2.filter2D(img, -1, m1)
def canny(imgs, args):
"""
Canny 边缘检测
blurSize: int | 高斯模糊 kernel 大小
threshold1, threshold2: int, int | , 高阈值
:return: img
"""
bsize = int(args['blurSize'])
blur = cv2.GaussianBlur(imgs[0], (bsize, bsize), 0)
blur = cv2.cvtColor(blur, cv2.COLOR_BGR2GRAY)
gradx = cv2.Sobel(blur, cv2.CV_16SC1, 1, 0)
grady = cv2.Sobel(blur, cv2.CV_16SC1, 0, 1)
return cv2.Canny(gradx, grady, int(args['threshold1']), int(args['threshold2']))

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
@File : flipService.py
@Author: csc
@Date : 2022/7/17
图像翻转
"""
import cv2
HORIZONTAL = 1
VERTICAL = 0
def horizontalFlip(imgs, args=None):
"""
水平翻转图像
:return: img
"""
return cv2.flip(imgs[0], HORIZONTAL)
def verticalFlip(imgs, args=None):
"""
垂直翻转图像
:return: img
"""
return cv2.flip(imgs[0], VERTICAL)

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
"""
@File : histService.py
@Author: csc
@Date : 2022/7/18
直方图
"""
import cv2
import matplotlib.pyplot as plt
from utils import figure2ndarray
def histCover(imgs, args=None):
"""
获取 img 的直方图
返回一张有三条折线的直方图
:return: img
"""
color = ['r', 'g', 'b']
img = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2RGB)
fig = plt.figure()
for index, c in enumerate(color):
hist = cv2.calcHist([img], [index], None, [256], [0, 255])
plt.plot(hist, color=c)
plt.xlim([0, 255])
return figure2ndarray(fig)

@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
"""
@File : houghService.py
@Author: csc
@Date : 2022/7/19
霍夫变换
"""
import cv2
import numpy as np
def getEdges(img, bsize=3, threshold1=50, threshold2=150):
"""
获取图像边缘
"""
img = cv2.GaussianBlur(img, (bsize, bsize), 0)
edges = cv2.Canny(img, threshold1=threshold1, threshold2=threshold2, apertureSize=3)
return edges
def hough(imgs, args):
"""
霍夫变换
blurSize: int | 高斯模糊 kernel 大小
cannyThreshold1, cannyThreshold2: int, int | canny 边缘检测阈值
houghThreshold: int | hough 变换阈值
:return: img
"""
bsize = int(args['blurSize'])
edges = getEdges(imgs[0], bsize,
threshold1=int(args['cannyThreshold1']), threshold2=int(args['cannyThreshold2']))
lines = cv2.HoughLines(edges, rho=1, theta=np.pi / 2, threshold=int(args['houghThreshold']))
result = imgs[0].copy()
if lines is not None:
for i_line in lines:
for line in i_line:
rho = line[0]
theta = line[1]
if theta < (np.pi / 4.0) or theta > (3. * np.pi / 4.0): # 垂直直线
pt1 = (int(rho / np.cos(theta)), 0)
pt2 = (int((rho - result.shape[0] * np.sin(theta)) / np.cos(theta)), result.shape[0])
cv2.line(result, pt1, pt2, (0, 0, 255))
else:
pt1 = (0, int(rho / np.sin(theta)))
pt2 = (result.shape[1], int((rho - result.shape[1] * np.cos(theta)) / np.sin(theta)))
cv2.line(result, pt1, pt2, (0, 0, 255))
return result
def houghP(imgs, args):
"""
概率霍夫变换
blurSize: int | 高斯模糊 kernel 大小
cannyThreshold1, cannyThreshold2: int, int | canny 边缘检测阈值
houghThreshold: int | hough 变换阈值
minLineLength: int | (最小长度)可以组成一条直线的最小点数, 少于这个点数的直线被忽略
maxLineGap: int | (最大间隙)认为在同一直线上的两点之间的最大间隙
:return: img
"""
bsize = int(args['blurSize'])
edges = getEdges(imgs[0], bsize,
threshold1=int(args['cannyThreshold1']), threshold2=int(args['cannyThreshold2']))
linesP = cv2.HoughLinesP(edges, rho=1, theta=np.pi / 2, threshold=int(args['houghThreshold']),
minLineLength=int(args['minLineLength']), maxLineGap=int(args['maxLineGap']))
result_P = imgs[0].copy()
if linesP is not None:
for i_P in linesP:
for x1, y1, x2, y2 in i_P:
cv2.line(result_P, (x1, y1), (x2, y2), (0, 0, 255))
return result_P

@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
"""
@File : morphologyService.py
@Author: csc
@Date : 2022/7/19
形态学操作
"""
import cv2
import numpy as np
structure = [cv2.MORPH_RECT, cv2.MORPH_CROSS, cv2.MORPH_ELLIPSE]
def erode(imgs, args):
"""
腐蚀: 消除物体边界点使目标缩小可以消除小于结构元素的噪声点
kernelType: int | 结构元类型 0: MORPH_RECT, 1: MORPH_CROSS, 2: MORPH_ELLIPSE
kernelX, kernelY: int, int | (x, y) 结构元大小
"""
kernel = cv2.getStructuringElement(structure[args['kernelType']],
(int(args['kernelX']), int(args['kernelY'])))
res = cv2.erode(imgs[0], kernel)
return res
def dilate(imgs, args):
"""
膨胀: 将与物体接触的所有背景点合并到物体中使目标增大可添补目标中的空洞
kernelType: int | 结构元类型 0: MORPH_RECT, 1: MORPH_CROSS, 2: MORPH_ELLIPSE
kernelSize: Tuple<int, int> | (x, y) 结构元大小
"""
kernel = cv2.getStructuringElement(structure[int(args['kernelType'])],
(int(args['kernelX']), int(args['kernelY'])))
res = cv2.dilate(imgs[0], kernel)
return res
def morphOpen(imgs, args):
"""
开运算: 先腐蚀后膨胀消除图像上细小的噪声并平滑物体边界
kernelType: int | 结构元类型 0: MORPH_RECT, 1: MORPH_CROSS, 2: MORPH_ELLIPSE
kernelSize: Tuple<int, int> | (x, y) 结构元大小
"""
kernel = cv2.getStructuringElement(structure[int(args['kernelType'])],
(int(args['kernelX']), int(args['kernelY'])))
res = cv2.morphologyEx(imgs[0], cv2.MORPH_OPEN, kernel)
return res
def morphClose(imgs, args):
"""
闭运算: 先膨胀后腐蚀填充物体内细小的空洞并平滑物体边界
kernelType: int | 结构元类型 0: MORPH_RECT, 1: MORPH_CROSS, 2: MORPH_ELLIPSE
kernelSize: Tuple<int, int> | (x, y) 结构元大小
"""
kernel = cv2.getStructuringElement(structure[int(args['kernelType'])],
(int(args['kernelX']), int(args['kernelY'])))
res = cv2.morphologyEx(imgs[0], cv2.MORPH_CLOSE, kernel)
return res

@ -0,0 +1,253 @@
import cv2
import numpy as np
def sp_noise(imgs, args):
"""
添加椒盐噪声
svp: float | 盐噪声比例 0-1之间
amount: float | 噪声占比 0-1之间
:return: img
"""
image = imgs[0]
s_vs_p = float(args['svp'])
# 设置添加噪声图像像素的数目
amount = float(args['amount'])
noisy_img = np.copy(image)
# 添加salt噪声
num_salt = np.ceil(amount * image.size * s_vs_p)
# 设置添加噪声的坐标位置
coords = [np.random.randint(0, i - 1, int(num_salt)) for i in image.shape]
noisy_img[coords[0], coords[1], :] = [255, 255, 255]
# 添加pepper噪声
num_pepper = np.ceil(amount * image.size * (1. - s_vs_p))
# 设置添加噪声的坐标位置
coords = [np.random.randint(0, i - 1, int(num_pepper)) for i in image.shape]
noisy_img[coords[0], coords[1], :] = [0, 0, 0]
return noisy_img
def gaussian_noise(imgs, args):
"""
添加高斯噪声
mean: float | 均值
sigma: float | 标准差
:return: img
"""
image = imgs[0]
h, w, c = image.shape
mean = int(args['mean'])
sigma = int(args['sigma'])
gauss = np.random.normal(mean, sigma, (h, w, c))
noisy_img = image + gauss
return np.clip(noisy_img, a_min=0, a_max=255)
def avg_blur(imgs, args):
"""
算术均值滤波
x, y: int, int | 滤波器大小
:return: img
"""
return cv2.blur(imgs[0], (int(args['x']), int(args['y'])))
def max_blur(imgs, args):
"""
最大值滤波
ksize: int | 滤波器大小
:return: img
"""
image = imgs[0]
h, w, c = image.shape
output = np.zeros(image.shape, np.uint8)
ksize = int(args['ksize'])
k2 = int(ksize / 2)
for i in range(k2, h - k2):
for j in range(k2, w - k2):
for ch in range(c):
output[i, j, ch] = np.max(image[i - k2:i + k2 + 1, j - k2:j + k2 + 1, ch])
return output
def min_blur(imgs, args):
"""
最小值滤波
ksize: int | 滤波器大小
:return: img
"""
image = imgs[0]
h, w, c = image.shape
output = np.zeros(image.shape, np.uint8)
ksize = int(args['ksize'])
k2 = int(ksize / 2)
for i in range(k2, h - k2):
for j in range(k2, w - k2):
for ch in range(c):
output[i, j, ch] = np.min(image[i - k2:i + k2 + 1, j - k2:j + k2 + 1, ch])
return output
def med_blur(imgs, args):
"""
中值滤波
ksize: 滤波器大小
:return: img
"""
return cv2.medianBlur(imgs[0], int(args['ksize']))
def gaussian_blur(imgs, args):
"""
高斯滤波
x, y: int, int | 滤波器大小
"""
return cv2.GaussianBlur(imgs[0], (int(args['x']), int(args['y'])), 0)
def geometric_blur(imgs, args):
"""
几何均值滤波
ksize: int | 滤波器大小
:return: img
"""
kernel_size = int(args['ksize'])
res = []
for img in cv2.split(imgs[0]):
G_mean_img = np.ones(img.shape)
k = int((kernel_size - 1) / 2)
for i in range(img.shape[0]):
for j in range(img.shape[1]):
if i < k or i > (img.shape[0] - k - 1) or j < k or j > (img.shape[1] - k - 1):
G_mean_img[i][j] = img[i][j]
else:
for n in range(kernel_size):
for m in range(kernel_size):
G_mean_img[i][j] *= np.float(img[i - k + n][j - k + m])
G_mean_img[i][j] = pow(G_mean_img[i][j], 1 / (kernel_size * kernel_size))
G_mean_img = np.uint8(G_mean_img)
res.append(G_mean_img)
return cv2.merge(res)
def harmonic_blur(imgs, args):
"""
谐波均值滤波
ksize: int | 滤波器大小
:return: img
"""
kernel_size = int(args['ksize'])
res = []
for img in cv2.split(imgs[0]):
H_mean_img = np.zeros(img.shape)
k = int((kernel_size - 1) / 2)
for i in range(img.shape[0]):
for j in range(img.shape[1]):
if i < k or i > (img.shape[0] - k - 1) or j < k or j > (img.shape[1] - k - 1):
H_mean_img[i][j] = img[i][j]
else:
for n in range(kernel_size):
for m in range(kernel_size):
if img[i - k + n][j - k + m] == 0:
H_mean_img[i][j] = 0
break
else:
H_mean_img[i][j] += 1 / np.float(img[i - k + n][j - k + m])
else:
continue
break
if H_mean_img[i][j] != 0:
H_mean_img[i][j] = (kernel_size * kernel_size) / H_mean_img[i][j]
H_mean_img = np.uint8(H_mean_img)
res.append(H_mean_img)
return cv2.merge(res)
def low_pass_filter(imgs, args):
"""
低通滤波
threshold2: int | 阈值
:return: img
"""
threshold2 = int(args['threshold2'])
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
output = np.zeros(image.shape, np.uint8)
for i in range(image.shape[0]):
for j in range(image.shape[1]):
if threshold2 > image[i][j]:
output[i][j] = image[i][j]
else:
output[i][j] = 0
return output
def high_pass_filter(imgs, args):
"""
高通滤波
threshold1: int | 阈值
:return: img
"""
threshold1 = int(args['threshold1'])
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
output = np.zeros(image.shape, np.uint8)
for i in range(image.shape[0]):
for j in range(image.shape[1]):
if threshold1 < image[i][j]:
output[i][j] = image[i][j]
else:
output[i][j] = 0
return output
def band_pass_filter(imgs, args):
"""
带通滤波
threshold1, threshold2: int, int | 低阈值, 高阈值
:return: img
"""
threshold1 = int(args['threshold1'])
threshold2 = int(args['threshold2'])
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
output = np.zeros(image.shape, np.uint8)
for i in range(image.shape[0]):
for j in range(image.shape[1]):
if threshold1 < image[i][j] < threshold2:
output[i][j] = image[i][j]
else:
output[i][j] = 0
return output
def band_stop_filter(imgs, args):
"""
带阻滤波
threshold1, threshold2: int, int | 低阈值, 高阈值
:return: img
"""
threshold1 = int(args['threshold1'])
threshold2 = int(args['threshold2'])
image = cv2.cvtColor(imgs[0], cv2.COLOR_BGR2GRAY)
output = np.zeros(image.shape, np.uint8)
for i in range(image.shape[0]):
for j in range(image.shape[1]):
if threshold1 < image[i][j] < threshold2:
output[i][j] = 0
else:
output[i][j] = image[i][j]
return output

@ -0,0 +1,161 @@
.app{
width: 100%;
height: 100vh;
display: flex;
}
.aside-section{
height: 100%;
display: flex;
}
.aside-menu-vertical{
height: 100%;
}
.aside-collapse{
width: 300px;
height: 100%;
padding: 10px;
overflow-y: scroll;
}
.aside-collapse .el-button-group{
margin-bottom: 12px;
}
.geo-form .el-form-item{
margin: 5px 0;
}
.result-image{
width:100%;
height:500px;
position: relative;
object-fit: contain;
}
.display-section{
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.img-container{
width: 100%;
height: 100%;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.img-info-container{
position: absolute;
padding: 6px 10px;
background-color: rgba(0,0,0,.1);
border-radius: 5px;
left: 0;
top: 0;
}
.current-image{
max-width: 100%;
max-height: 100%;
}
.current-image.half-width{
max-width: 44%;
}
.img-action{
position: absolute;
bottom: 20px;
right: 20px;
}
.img-selector{
width: 200px;
height: 100%;
overflow-y: scroll;
padding: 10px;
border-left: 1px solid #888;
}
.img-selector-wrapper{
position: relative;
}
.img-selector-wrapper:hover .img-selector-float{
opacity: 1;
}
.img-selector-float{
position: absolute;
padding: 2px 4px 4px;
top: 0;
left: 0;
right: 0;
opacity: 0;
transition: .3s all cubic-bezier(0.075, 0.82, 0.165, 1);
background-image: linear-gradient(180deg,#bbb,hsla(0,0%,100%,0))
}
.img-tag{
width: 65%;
font-size: 14px;
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
vertical-align: text-top;
}
.img-selector-float .action{
cursor: pointer;
}
.img-selector-item{
width: 100%;
margin-bottom: 10px;
object-fit: fill;
cursor: pointer;
}
/* second uploader */
.second-uploader{
max-width: 44%;
max-height: 100%;
}
.second-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.second-uploader .el-upload:hover {
border-color: #409EFF;
}
.second-uploader .el-upload-dragger{
width: auto;
height: auto;
}
.second-uploader .second-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.second-uploader .second-image {
width: 100%;
height: 100%;
display: block;
}
.transfer-section .el-radio{
display: block;
margin: 2px 0;
}

@ -0,0 +1,64 @@
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.serif-sc{
font-family: "Noto Serif SC", sans-serif;
}
.serif-sc input{
font-family: "Noto Serif SC", sans-serif;
}
.pointer{
cursor: pointer;
}
button:focus,input:focus,textarea:focus{
outline: none;
}
*{
outline: none;
}
:root{
--text-color-lightest: #e7e9ec;
--text-color-darker: #2e2e2e;
--text-color-dark:#494949;
--text-color-gray:#8b8b8b;
--text-color-dark-gray:#727272;
--text-color-light-gray: #c6c6c6;
--backdrop-color: rgba(42, 42, 42, 0.69);
--primary-blue: #0a69aa;
--secondary-blue: #5699d2;
--tertiary-blue: #d8ebf9;
--dark-green: #2f841b;
--primary-green: #4996a2;
--secondary-green: #71c2cc;
--vscode-class: #4ec9b0;
--vscode-yellow: #DCD2A1;
--vscode-light-green: #b8d7a3;
--vscode-orange: #FFC66D;
--vscode-sky-blue: #67cdfe;
--vscode-annotation: #CC9393;
--vscode-string: #D69D85;
--vscode-purple: #9393CC;
--vscode-comment: #57a64a;
--vscode-keyword: #569cd6;
}
li {
list-style: none;
}
a{text-decoration:none;color: #666}
a:hover{text-decoration:none;}
a:visited{text-decoration:none;color:#666}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -0,0 +1,494 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DIPFA</title>
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/index.css">
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app" class="app">
<div class="aside-section">
<el-menu
default-active="0"
class="aside-menu-vertical"
@select="selectAsideCollapse">
<el-menu-item v-for="(menu,i) in asideMenu" :index="i+''" :key="i">
<i class="el-icon-menu"></i>
<span slot="title"><span>{{menu}}</span></span>
</el-menu-item>
</el-menu>
<div class="aside-collapse">
<el-collapse accordion v-model="currentCollapseName" @change="onCollapseChange">
<!-- 图像调整 -->
<template v-if="0 == selectedAsideMenu">
<el-collapse-item title="裁剪" name="adjust-01">
<el-button type="primary" @click="startCrop">裁剪</el-button>
<div>
宽度:<el-input v-model="displayCropperWidth" @change="setCropperSize"></el-input>
</div>
<div>
高度:<el-input v-model="displayCropperHeight" @change="setCropperSize"></el-input>
</div>
</el-collapse-item>
</template>
<!-- 基本计算 -->
<template v-if="1 == selectedAsideMenu">
<el-collapse-item title="逻辑运算" name="compute-01[mul]">
<el-button-group>
<el-button v-for="(op,i) in logicOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
<el-button type="primary" @click="confirmAction" size="medium">确 定</el-button>
</el-collapse-item>
<el-collapse-item title="算术运算" name="compute-02[mul]">
<el-button-group>
<el-button v-for="(op,i) in arthimaticOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-button type="primary" @click="confirmAction" size="medium">确 定</el-button>
</el-collapse-item>
<el-collapse-item title="几何变换运算" name="compute-03">
<el-button-group>
<el-button v-for="(op,i) in geometricOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="right" label-width="78px">
<template v-if="command==='rotate'">
<el-form-item label="旋转中心x">
<el-input v-model="geometricOpArgs.x" size="medium"></el-input>
</el-form-item>
<el-form-item label="旋转中心y">
<el-input v-model="geometricOpArgs.y" size="medium"></el-input>
</el-form-item>
</template>
<template v-if="command==='scale' || command==='translate'">
<el-form-item :label="command==='scale' ? '目标宽度' : 'x平移距离'">
<el-input v-model="geometricOpArgs.xArg" size="medium"></el-input>
</el-form-item>
<el-form-item :label="command==='scale' ? '目标高度' : 'y平移距离'">
<el-input v-model="geometricOpArgs.yArg" size="medium"></el-input>
</el-form-item>
</template>
<template v-if="command==='rotate'">
<el-form-item label="旋转角度">
<el-input v-model="geometricOpArgs.deg" size="medium"></el-input>
</el-form-item>
</template>
</el-form>
<el-button type="primary" @click="confirmAction(geometricOpArgs)" size="medium">确 定</el-button>
</el-collapse-item>
<el-collapse-item title="翻转" name="compute-04">
<el-button-group>
<el-button v-for="(op,i) in flipOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-button type="primary" @click="confirmAction" size="medium">确 定</el-button>
</el-collapse-item>
<el-collapse-item title="仿射变换" name="compute-05">
<el-button-group>
<el-button v-for="(op,i) in affineOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="top" label-width="50px">
<el-form-item label="pose1">
<div v-for="(pose, i) in affineArgs.post1" :key="i">
<span>x{{i+1}} </span><el-input style="width:40%" v-model="affineArgs.post1[i][0]" size="medium" :placeholder="'x'+(i+1)"></el-input>
<span> y{{i+1}} </span><el-input style="width:40%" v-model="affineArgs.post1[i][1]" size="medium" :placeholder="'y'+(i+1)"></el-input>
</div>
</el-form-item>
<el-form-item label="pose2">
<div v-for="(pose, i) in affineArgs.post2" :key="i">
<span>x{{i+1}} </span><el-input style="width:40%" v-model="affineArgs.post2[i][0]" size="medium" :placeholder="'x'+(i+1)"></el-input>
<span> y{{i+1}} </span><el-input style="width:40%" v-model="affineArgs.post2[i][1]" size="medium" :placeholder="'y'+(i+1)"></el-input>
</div>
</el-form-item>
</el-form>
<el-button type="primary" @click="confirmAction(affineArgs)" size="medium">确 定</el-button>
</el-collapse-item>
</template>
<!-- 边缘检测 -->
<template v-if="2 == selectedAsideMenu">
<el-collapse-item title="边缘检测" name="edge-01">
<el-button-group>
<el-button v-for="(op,i) in edgeOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="right" label-width="84px">
<template v-if="['laplacian','LoG','canny'].indexOf(command) >= 0">
<el-form-item label="滤波器大小">
<el-input v-model="edgeArgs.blurSize" size="medium"></el-input>
</el-form-item>
<el-form-item v-if="command === 'laplacian'" label="核大小">
<el-input v-model="edgeArgs.ksize" size="medium"></el-input>
</el-form-item>
<template v-if="command === 'canny'">
<el-form-item label="最低阈值">
<el-input v-model="edgeArgs.threshold1" size="medium"></el-input>
</el-form-item>
<el-form-item label="最高阈值">
<el-input v-model="edgeArgs.threshold2" size="medium"></el-input>
</el-form-item>
</template>
</template>
</el-form>
<el-button type="primary" @click="confirmAction(edgeArgs)" size="medium">确 定</el-button>
</el-collapse-item>
<el-collapse-item title="霍弗变换" name="edge-02">
<el-button-group>
<el-button v-for="(op,i) in houghOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="right" label-width="84px">
<el-form-item label="滤波器大小">
<el-input v-model="houghArgs.blurSize" size="medium"></el-input>
</el-form-item>
<el-form-item label="canny检测阈值1">
<el-input v-model="houghArgs.cannyThreshold1" size="medium"></el-input>
</el-form-item>
<el-form-item label="canny检测阈值2">
<el-input v-model="houghArgs.cannyThreshold2" size="medium"></el-input>
</el-form-item>
<el-form-item label="霍夫变换阈值">
<el-input v-model="houghArgs.houghThreshold" size="medium"></el-input>
</el-form-item>
<template v-if="command === 'houghP'">
<el-form-item label="组成一条直线最小点数">
<el-input v-model="houghArgs.minLineLength" size="medium"></el-input>
</el-form-item>
<el-form-item label="同一直线两点最大间隔">
<el-input v-model="houghArgs.maxLineGap" size="medium"></el-input>
</el-form-item>
</template>
</el-form>
<el-button type="primary" @click="confirmAction(houghArgs)" size="medium">确 定</el-button>
</el-collapse-item>
</template>
<!-- 图像增强操作 -->
<template v-if="3 == selectedAsideMenu">
<el-collapse-item title="频域的平滑/锐化" name="augment-01">
<el-button-group>
<el-button v-for="(op,i) in filterOp1"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="right" label-width="84px">
<el-form-item label="d0">
<el-input v-model="filterArgs1.d0" size="medium"></el-input>
</el-form-item>
<el-form-item label="n">
<el-input v-model="filterArgs1.n" size="medium"></el-input>
</el-form-item>
</el-form>
<el-button type="primary" @click="confirmAction(filterArgs1)" size="medium">确 定</el-button>
</el-collapse-item>
<el-collapse-item title="空域的平滑/锐化" name="augment-02">
<el-button-group>
<el-button v-for="(op,i) in filterOp2"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-button type="primary" @click="confirmAction" size="medium">确 定</el-button>
</el-collapse-item>
</template>
<!-- 形态学操作 -->
<template v-if="4 == selectedAsideMenu">
<el-collapse-item title="形态学操作" name="morph-01">
<el-button-group>
<el-button v-for="(op,i) in morphOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="right" label-width="84px">
<el-form-item label="结构体X大小">
<el-input v-model="morphArgs.kernelX" size="medium"></el-input>
</el-form-item>
<el-form-item label="结构体Y大小">
<el-input v-model="morphArgs.kernelY" size="medium"></el-input>
</el-form-item>
<el-form-item label="结构体类型">
<el-radio-group v-model="morphArgs.kernelType" size="medium">
<el-radio :label="0">矩形</el-radio>
<el-radio :label="1">交叉型</el-radio>
<el-radio :label="2">椭圆形</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<el-button type="primary" @click="confirmAction(morphArgs)" size="medium">确 定</el-button>
</el-collapse-item>
</template>
<!-- 噪声滤波 -->
<template v-if="5 == selectedAsideMenu">
<el-collapse-item title="噪声" name="noise-01">
<el-button-group>
<el-button v-for="(op,i) in noiseOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="right" label-width="100px">
<template v-if="command === 'spNoise'">
<el-form-item label="椒盐比">
<el-input v-model="noiseArgs.svp" size="medium"></el-input>
</el-form-item>
<el-form-item label="噪声数量比例">
<el-input v-model="noiseArgs.amount" size="medium"></el-input>
</el-form-item>
</template>
<template v-if="command === 'gaussianNoise'">
<el-form-item label="均值">
<el-input v-model="noiseArgs.mean" size="medium"></el-input>
</el-form-item>
<el-form-item label="标准差">
<el-input v-model="noiseArgs.sigma" size="medium"></el-input>
</el-form-item>
</template>
</el-form>
<el-button type="primary" @click="confirmAction(noiseArgs)" size="medium">确 定</el-button>
</el-collapse-item>
<el-collapse-item title="滤波" name="blur-01">
<el-button-group>
<el-button v-for="(op,i) in blurOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="right" label-width="90px">
<template v-if="['avgBlur','gaussianBlur'].indexOf(command) >= 0">
<el-form-item label="滤波器x大小">
<el-input v-model="blurArgs.x" size="medium"></el-input>
</el-form-item>
<el-form-item label="滤波器y大小">
<el-input v-model="blurArgs.y" size="medium"></el-input>
</el-form-item>
</template>
<el-form-item v-else label="滤波核大小">
<el-input v-model="blurArgs.ksize" size="medium"></el-input>
</el-form-item>
</el-form>
<el-button type="primary" @click="confirmAction(blurArgs)" size="medium">确 定</el-button>
</el-collapse-item>
<el-collapse-item title="选择性滤波" name="blur-02">
<el-button-group>
<el-button v-for="(op,i) in selectiveOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="right" label-width="72px">
<el-form-item v-if="command !== 'lowPass'" label="滤波下限">
<el-input v-model="selectiveArgs.threshold1" size="medium"></el-input>
</el-form-item>
<el-form-item v-if="command !== 'highPass'" label="滤波上限">
<el-input v-model="selectiveArgs.threshold2" size="medium"></el-input>
</el-form-item>
</el-form>
<el-button type="primary" @click="confirmAction(selectiveArgs)" size="medium">确 定</el-button>
</el-collapse-item>
</template>
<!-- 风格迁移 -->
<template v-if="6 == selectedAsideMenu">
<el-collapse-item class="transfer-section" title="固定风格任意内容" name="transfer-01">
<el-button-group>
<el-button v-for="(op,i) in transferOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-form class="geo-form" label-position="right" label-width="84px">
<el-form-item label="风格类型">
<el-radio-group v-model="transferArgs.model" size="medium">
<el-radio v-for="model in transferModels" :key="model" :label="model">{{model}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<el-button type="primary" @click="confirmAction(transferArgs)" size="medium">确 定</el-button>
</el-collapse-item>
<el-collapse-item class="transfer-section" title="任意风格任意内容" name="transfer-02[mul]">
<el-button-group>
<el-button v-for="(op,i) in myTransferOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</br>
<el-button type="primary" @click="confirmAction" size="medium">确 定</el-button>
</el-collapse-item>
</template>
<!-- 其他 -->
<template v-if="7 == selectedAsideMenu">
<el-collapse-item title="直方图/色域" name="pther-01">
<el-button-group>
<el-button v-for="(op,i) in otherOp"
:key="i"
@click="setCommand(op[0])"
:type="command===op[0] ? 'primary' : ''"
size="medium">{{op[1]}}</el-button>
</el-button-group>
</el-button-group>
<el-button type="primary" @click="confirmAction" size="medium">确 定</el-button>
</el-collapse-item>
</template>
</el-collapse>
</div>
</div>
<div class="display-section">
<div class="img-container">
<div class="img-info-container" v-if="currentImage !== null ">
<p v-if="images[currentImage].tag">标签: {{images[currentImage].tag}}</p>
<p>宽度: {{images[currentImage].width}}</p>
<p>高度: {{images[currentImage].height}}</p>
</div>
<div class="el-loading-mask" v-if="loading">
<div class="el-loading-spinner">
<svg viewBox="25 25 50 50" class="circular"><circle cx="50" cy="50" r="20" fill="none" class="path"></circle></svg>
<p class="el-loading-text">图片处理中</p>
<el-button size="medium" type="text" @click="cancelAction">取消</el-button>
</div>
</div>
<vue-cropper
v-if="inCrop"
ref="cropper"
class="img-cropper"
:img="currentImage === null ? '' : images[currentImage].data"
:output-size="1"
:auto-crop="true"
:auto-crop-width="cropper.width"
:auto-crop-height="cropper.height"
:center-box="true"
:info-true="true"
:fixed="false"
:fixed-box="false"
@real-time="onCropperMove"></vue-cropper>
<img v-else
class="current-image"
:class="multiInput ? 'half-width' : ''"
:src="currentImage === null ? '' : images[currentImage].data"
alt="">
<!-- second img uploader -->
<template v-if="currentImage!==null && multiInput">
<div style="margin: 0 10px;">+</div>
<el-upload
class="second-uploader"
action="#"
drag
:show-file-list="false"
:before-upload="uploadSecondImage">
<img v-if="secondImage" :src="secondImage" class="second-image">
<i v-else class="el-icon-plus second-uploader-icon"></i>
</el-upload>
</template>
<!-- action -->
<div class="img-action" v-if="inCrop">
<el-button type="primary" @click="confirmAction">确 定</el-button>
<el-button @click="cancelAction">取 消</el-button>
</div>
</div>
<div class="img-selector">
<div class="img-selector-wrapper" v-for="(img,i) in images" :key="i">
<div class="img-selector-float">
<span class="img-tag">{{img.tag}}</span>
<span style="float:right">
<!-- <i class="action el-icon-price-tag"></i> -->
<i class="action el-icon-delete" @click="deleteImage(i)"></i>
</span>
</div>
<img class="img-selector-item"
@click="switchImage(i)"
:src="img.data"
alt="">
</div>
<el-upload
class="img-uploader"
action="#"
:show-file-list="false"
:before-upload="uploadImage">
<el-button size="small" type="primary">添加图片</el-button>
</el-upload>
</div>
</div>
<el-dialog
title="提示"
:visible.sync="dialogVisible"
width="50%">
<div v-for="(img,i) in resultImage" :key="i">
<img class="result-image" :src="img" alt="">
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="replaceResultImage" :disabled="resultImage.length > 1">替换当前图像</el-button>
<el-button type="primary" @click="addResultImage">添加为新图像</el-button>
<el-button @click="dialogVisible = false">取 消</el-button>
</span>
</el-dialog>
</div>
</body>
<script src="/js/axios.js"></script>
<script src="/js/vue.js"></script>
<script src="/js/element.js"></script>
<script src="/js/cropper.js"></script>
<script src="/js/index.js"></script>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,382 @@
(function initAxios(){
axios.defaults.baseURL = 'http://127.0.0.1:5000';
axios.interceptors.response.use(
function(response) {
return Promise.resolve(response.data);
},
function(error) {
return Promise.reject(error);
}
);
})();
const app = new Vue({
el: '#app',
data: {
currentImage: null,
secondImage: null,
resultImage: [],
disableReplace: false,
images: [],
inCrop: false,
loading: false,
command: '',
// cropper
cropper:{
width: 200,
height: 200
},
displayCropperWidth: 200,
displayCropperHeight: 200,
// ui
asideMenu: [
'图像调整',
'基本计算',
'边缘检测',
'图像增强',
'形态学操作',
'噪声滤波',
'风格迁移',
'其他'
],
currentCollapseName: '',
selectedAsideMenu: 0,
// popup
dialogVisible: false,
// aside menu中具体项目
logicOp: [
['and', '与运算'],
['or', '或运算'],
['not', '非运算']
],
arthimaticOp: [
['add', '加运算'],
['subtract', '减运算'],
['multiply', '乘运算'],
['divide', '除运算']
],
geometricOp: [
['scale', '缩放'],
['translate', '平移'],
['rotate', '旋转'],
],
geometricOpArgs: {
x: 0,
y: 0,
xArg: 0,
yArg: 0,
deg: 0
},
flipOp: [
['flipHor', '水平翻转'],
['flipVer', '垂直翻转']
],
affineOp: [
['affine', '仿射变换']
],
affineArgs: {
post1: [[0,0],[0,0],[0,0]],
post2: [[0,0],[0,0],[0,0]],
},
// 边缘检测
edgeOp: [
['roberts', 'Roberts'],
['sobel', 'Sobel'],
['laplacian', 'Laplacian'],
['LoG', 'LoG'],
['canny', 'Canny']
],
edgeArgs: {
blurSize: 3,
ksize: 3,
threshold1: 50,
threshold2: 150
},
houghOp: [
['hough', '霍夫变换'],
['houghP', '概率霍夫变换']
],
houghArgs: {
blurSize: 3,
cannyThreshold1: 50,
cannyThreshold2: 150,
houghThreshold: 120,
minLineLength: 120,
maxLineGap: 15
},
// 噪声
noiseOp: [
['spNoise', '椒盐噪声'],
['gaussianNoise', '高斯噪声'],
],
noiseArgs: {
svp: 0.5,
amount: 0.04,
mean: 0,
sigma: 25
},
// 滤波01
blurOp: [
['maxBlur', '最大值滤波'],
['avgBlur', '均值滤波'],
['minBlur', '最小值滤波'],
['medBlur', '中值滤波'],
['gaussianBlur', '高斯滤波'],
['geometricBlur', '几何均值滤波'],
['harmonicBlur', '谐波均值滤波']
],
blurArgs: {
x: 3,
y: 3,
ksize: 3
},
// 滤波02
selectiveOp: [
['lowPass', '低通滤波'],
['highPass', '高通滤波'],
['bandPass', '带通滤波'],
['bandStop', '带阻滤波'],
],
selectiveArgs: {
threshold1: 0,
threshold2: 255
},
// 形态学操作
morphOp: [
['morphOpen', '开操作'],
['morphClose', '闭操作'],
['morphErode', '腐蚀'],
['morphDilate', '膨胀'],
],
morphArgs: {
kernelX: 5,
kernelY: 5,
kernelType: 0
},
// 频域的平滑/频域的锐化
filterOp1: [
['lpFilter', '理想低通滤波'],
['hpFilter', '理想高通滤波'],
['blpFilter', '巴特沃兹低通滤波'],
['bhpFilter', '巴特沃兹高通滤波'],
['glpFilter', '高斯低通滤波'],
['ghpFilter', '高斯高通滤波'],
],
filterArgs1: {
d0: 50,
n: 2
},
// 空域的平滑
filterOp2: [
['robertsGrad', 'Roberts算子'],
['sobelGrad', 'Sobel算子'],
['prewittGrad', 'Prewitt算子'],
['laplacianGrad', 'Laplacian算子'],
],
// 其他
otherOp: [
['hist', '直方图统计'],
['getRGB', 'RGB'],
['getHSV', 'HSV']
],
// 风格迁移
transferOp: [
['transfer', '风格迁移']
],
transferModels: [
'candy', 'composition_vii', 'feather', 'la_muse', 'la_muse_eccv16',
'mosaic', 'starry_night', 'the_scream', 'the_wave', 'udnie'
],
transferArgs: {
model: ''
},
// 任意风格任意内容
myTransferOp: [
['myTransfer', '风格迁移']
]
},
methods: {
selectAsideCollapse(index){
this.selectedAsideMenu = index;
this.command = ''; // clear command
},
switchImage(index){
this.inCrop = false;
this.currentImage = index;
},
setCommand(command){
this.command = command;
},
replaceResultImage(){
this.getImageInfo(this.resultImage[0]).then(info => {
this.images[this.currentImage] = info
})
this.dialogVisible = false;
},
addResultImage(){
this.resultImage.forEach(e => {
this.addImage(e)
})
this.dialogVisible = false;
},
//---crop---
startCrop(){
if(this.currentImage !== null){
this.inCrop = true;
}
},
cancelCrop(){
this.inCrop = false;
},
endCrop(){
const cropper = this.$refs.cropper;
this.$refs.cropper.getCropData(data => {
this.images[this.currentImage].data = data;
this.images[this.currentImage].width = cropper.cropW
this.images[this.currentImage].height = cropper.cropH
this.inCrop = false;
})
},
onCropperMove(preview){
const cropper = this.$refs.cropper;
this.displayCropperHeight = Math.round(cropper.cropH)
this.displayCropperWidth = Math.round(cropper.cropW)
},
setCropperSize(){
this.cropper.width = this.displayCropperWidth;
this.cropper.height = this.displayCropperHeight;
},
//---command---
cancelAction(){
if(this.inCrop){
this.cancelCrop();
return;
}
// cancel request
this.controller.abort();
},
confirmAction(args){
if(this.loading){
this.$message.warning('正在进行其他处理操作')
return;
}
if(this.inCrop){
this.endCrop();
return;
}
if(!this.command){
this.$message.warning('未选择操作');
return;
}
if(this.currentImage === null){
this.$message.warning('未选择图片');
return;
}
const files = [this.images[this.currentImage].data];
if(this.multiInput){
if(!this.secondImage){
this.$message.warning('未选择第二张图片')
return;
}
files.push(this.secondImage)
}
this.process(files, this.command, args);
},
//---collapse---
onCollapseChange(newCollapse){
if(newCollapse !== '' && newCollapse !== 'adjust-01'){
this.cancelCrop();
}
},
//---api---
process(base64Images, command, args={}){
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], {
type: mime
});
}
this.loading = true;
this.controller = new AbortController();
const param = new FormData();
base64Images.forEach((img,i) => {
param.append('files', dataURLtoBlob(img),new Date().getTime() + '' + i);
})
param.append('command', command);
param.append('args', JSON.stringify(args));
return axios.post('/process', param, {
'Content-Type': 'multipart/form-data',
signal: this.controller.signal
}).then(data => {
this.resultImage = data.data.map(e => 'data:image/jpeg;base64,' + e);
this.dialogVisible = true;
}).catch(e => {
console.error(e);
if(e.response){
const msg = e.response.data.message;
this.$message.error(msg);
}
}).finally(() => {
this.loading = false;
});
},
uploadImage(file, onload){
const reader = new FileReader();
reader.onload = onload || (e => {
this.addImage(e.target.result);
});
reader.readAsDataURL(file);
return false;
},
uploadSecondImage(file){
this.uploadImage(file, e => {
this.secondImage = e.target.result;
})
return false;
},
getImageInfo(data){
return new Promise((resolve, reject) => {
const img = new Image();
img.src = data;
img.onload = () => {
resolve({
width: img.width,
height: img.height,
data: data,
tag: ''
})
}
})
},
addImage(data, tag=''){
this.getImageInfo(data).then(info => {
info.tag = tag;
this.images.push(info);
if(this.currentImage === null){
this.currentImage = 0;
}
})
},
deleteImage(index){
this.images.splice(index, 1);
if(this.currentImage >= index){
this.currentImage = this.images.length === 0 ? null : Math.max(this.currentImage-1, 0);
}
}
},
computed: {
multiInput(){
return this.currentCollapseName.indexOf('[mul]') >= 0 && this.command !== 'not';
},
}
});

File diff suppressed because it is too large Load Diff

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
"""
@File : affineTest.py
@Author: csc
@Date : 2022/7/19
"""
import pytest
import cv2
import service.affineService as affineService
from main import display
img = cv2.imread('./img.jpg')
args = {
'post1': [[50, 50], [200, 50], [50, 200]],
'post2': [[10, 100], [200, 50], [100, 250]]
}
def test_Affine():
res = affineService.affine([img], args)
display('affine', res)

@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
"""
@File : augmentTest.py
@Author: csc
@Date : 2022/7/20
"""
import cv2
import service.augmentService as augmentService
from main import display
img = cv2.imread('./img.jpg')
def test_lp_filter():
res = augmentService.lp_filter([img], {'d0': 20, 'n': 2})
display('lp_filter', res)
def test_butterworth_lp_filter():
res = augmentService.butterworth_lp_filter([img], {'d0': 20, 'n': 2})
display('butterworth_lp_filter', res)
def test_gauss_lp_filter():
res = augmentService.gauss_lp_filter([img], {'d0': 20, 'n': 4})
display('gauss_lp_filter', res)
def test_hp_filter():
res = augmentService.hp_filter([img], {'d0': 40, 'n': 2})
display('hp_filter', res)
def test_butterworth_hp_filter():
res = augmentService.butterworth_hp_filter([img], {'d0': 40, 'n': 2})
display('butterworth_hp_filter', res)
def test_gauss_hp_filter():
res = augmentService.gauss_hp_filter([img], {'d0': 40, 'n': 2})
display('gauss_hp_filter', res)
def test_roberts_grad():
res = augmentService.roberts_grad([img])
display('roberts_grad', res)
def test_sobel_grad():
res = augmentService.sobel_grad([img])
display('sobel_grad', res)
def test_prewitt_grad():
res = augmentService.prewitt_grad([img])
display('prewitt_grad', res)
def test_laplacian_grad():
res = augmentService.laplacian_grad([img])
display('laplacian_grad', res)

@ -0,0 +1,20 @@
import cv2
import service.colorSpaceService as colorSpaceService
img = cv2.imread('./img.jpg')
def test_getRGB():
r, g, b = colorSpaceService.getRGB([img])
_, _, _r = cv2.split(r)
_, _g, _ = cv2.split(g)
_b, _, _ = cv2.split(b)
assert (img == cv2.merge([_b, _g, _r])).all()
def test_getHSV():
h, s, v = colorSpaceService.getHSV([img])
_h, _, _ = cv2.split(h)
_, _s, _ = cv2.split(s)
_, _, _v = cv2.split(v)
assert (cv2.cvtColor(img, cv2.COLOR_BGR2HSV) == cv2.merge([_h, _s, _v])).all()

@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
"""
@File : computeTest.py
@Author: csc
@Date : 2022/7/20
"""
import cv2
import numpy as np
from service.computeService import *
from main import display
img = cv2.imread('./img.jpg')
img0 = np.zeros_like(img)
img255 = np.full_like(img, 255)
img100 = np.full_like(img, 100)
img200 = np.full_like(img, 200)
def test_addOp():
assert (img0 == andOp([img, img0])).all()
assert (img == andOp([img, img255])).all()
def test_orOp():
assert (img == orOp([img, img0])).all()
assert (img255 == orOp([img, img255])).all()
def test_notOp():
assert (img0 == notOp([notOp([img0])])).all()
def test_add():
assert (img200 == add([img100, img100])).all()
assert (img255 == add([img100, img200])).all()
def test_subtract():
assert (img100 == subtract([img200, img100])).all()
def test_multiply():
assert (img0 == multiply([img0, img])).all()
def test_divide():
assert (img0 == divide([img0, img])).all()
def test_scale():
height, width, channel = img.shape
res = scale([img], {'xArg': int(width / 2), 'yArg': int(height / 2)})
display('scale', res)
def test_translate():
res = translate([img], {'xArg': 10, 'yArg': 10})
display('translate', res)
def test_rotate():
height, width, channel = img.shape
res = rotate([img], {'x': height / 2, 'y': width / 2, 'deg': 90})
display('rotate', res)

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
"""
@File : edgeDetectionTest.py
@Author: csc
@Date : 2022/7/20
"""
import cv2
import service.edgeDetectionService as edgeDetectionService
from main import display
img = cv2.imread('./img.jpg')
def test_roberts():
res = edgeDetectionService.roberts([img])
display('Roberts', res)
def test_sobel():
res = edgeDetectionService.sobel([img])
display('Sobel', res)
def test_laplacian():
res = edgeDetectionService.laplacian([img], {'blurSize': 3, 'ksize': 3})
display('LoG', res)
def test_LoG():
res = edgeDetectionService.LoG([img], {'blurSize': 3})
display('LoG', res)
def test_canny():
res = edgeDetectionService.canny([img], {'blurSize': 3, 'threshold1': 50, 'threshold2': 150})
display('canny', res)

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
"""
@File : flipTest.py
@Author: csc
@Date : 2022/7/18
"""
import cv2
import service.flipService as flipService
img = cv2.imread('./img.jpg')
def test_horizontalFlip():
tmp = flipService.horizontalFlip([img])
tmp = flipService.horizontalFlip([tmp])
assert (img == tmp).all()
def test_verticalFlip():
tmp = flipService.verticalFlip([img])
tmp = flipService.verticalFlip([tmp])
assert (img == tmp).all()

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
"""
@File : histTest.py
@Author: csc
@Date : 2022/7/18
"""
import cv2
import service.histService as histService
from main import display
img = cv2.imread('./img.jpg')
def test_histCover():
histogram = histService.histCover([img])
display('hist', histogram)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save