master
徐岩 2 years ago
parent 398ae29792
commit 623440b987

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="FacetManager">
<facet type="django" name="Django">
<configuration>
<option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="djangoProject/settings.py" />
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
<option name="environment" value="&lt;map/&gt;" />
<option name="doNotUseTestRunner" value="false" />
<option name="trackFilePattern" value="migrations" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7 (数字图像处理小功能)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/../djangoProject\templates" />
</list>
</option>
</component>
</module>

@ -0,0 +1,12 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
</list>
</option>
</inspection_tool>
</profile>
</component>

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (数字图像处理小功能)" project-jdk-type="Python SDK" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/djangoProject.iml" filepath="$PROJECT_DIR$/.idea/djangoProject.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PySciProjectComponent">
<option name="PY_SCI_VIEW_SUGGESTED" value="true" />
</component>
</project>

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

@ -0,0 +1,6 @@
from django.apps import AppConfig
class App01Config(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'APP01'

@ -0,0 +1,22 @@
# Generated by Django 3.2.13 on 2022-07-27 07:26
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='IMG',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('img', models.ImageField(upload_to='img')),
('name', models.CharField(max_length=20)),
],
),
]

@ -0,0 +1,18 @@
from django.db import models
from django.db.models.signals import pre_delete
from django.dispatch import receiver
# Create your models here.
class IMG(models.Model):
img = models.ImageField(upload_to='img') # 地址
name = models.CharField(max_length=20)
# 删除方法重载
@receiver(pre_delete, sender=IMG)
def file_delete(instance, **kwargs):
instance.img.delete(False)
# print("delete", instance.img)

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

@ -0,0 +1,179 @@
from django.http import HttpResponse
from django.shortcuts import render
from APP01.models import IMG
from APP01.models import file_delete
import funs
# Create your views here.
def saveIMG(request):
if request.method == 'POST':
new_img = IMG(
img=request.FILES.get('img'),
name=request.FILES.get('img').name
)
new_img.save()
def test(request):
return render(request, "test.html")
def index(request):
img = IMG.objects.all()
for i in img:
file_delete(instance=i)
i.delete()
IMG.objects.all().delete()
# 每次返回主页清理数据库和本地缓存的文件
return render(request, "index.html")
def RGB(request):
saveIMG(request)
img = IMG.objects.all().last()
content = {
'img': img,
}
img1 = IMG.objects.all()
for i in img1:
print(i.img.path)
funs.Rgb(i.img.path)
return render(request, 'rgb.html', content)
def HSV(request):
saveIMG(request)
img = IMG.objects.all().last()
content = {
'img': img,
}
img1 = IMG.objects.all()
for i in img1:
print(i.img.path)
funs.Hsv(i.img.path)
return render(request, 'hsv.html', content)
def UN(request):
saveIMG(request)
img = IMG.objects.all().last()
content = {
'img': img,
}
img1 = IMG.objects.all()
for i in img1:
print(i.img.path)
funs.Un(i.img.path)
return render(request, 'un.html', content)
def ADD(request):
saveIMG(request)
img = IMG.objects.all()
content = {
'img': img,
}
if len(img) > 1:
paths = []
for i in range(len(img)):
print(img[i].img.path)
paths.append(img[i].img.path)
funs.Add(paths)
return render(request, 'add.html', content)
def SUBTRACT(request):
saveIMG(request)
img = IMG.objects.all()
content = {
'img': img,
}
if len(img) > 1:
paths = []
for i in range(len(img)):
print(img[i].img.path)
paths.append(img[i].img.path)
funs.Subtract(paths)
return render(request, 'subtract.html', content)
def OPANDCL(request):
saveIMG(request)
img = IMG.objects.all().last()
content = {
'img': img,
}
img1 = IMG.objects.all()
for i in img1:
print(i.img.path)
funs.OpenAndClose(i.img.path)
return render(request, 'opandcl.html', content)
def SHARP(request):
saveIMG(request)
img = IMG.objects.all().last()
content = {
'img': img,
}
img1 = IMG.objects.all()
for i in img1:
print(i.img.path)
funs.Sharp(i.img.path)
return render(request, 'sharp.html', content)
def TURN(request):
saveIMG(request)
img = IMG.objects.all().last()
content = {
'img': img,
}
img1 = IMG.objects.all()
for i in img1:
print(i.img.path)
funs.Turn(i.img.path)
return render(request, 'turn.html', content)
def EROSION(request):
saveIMG(request)
img = IMG.objects.all().last()
content = {
'img': img,
}
img1 = IMG.objects.all()
for i in img1:
print(i.img.path)
funs.Erosion(i.img.path)
return render(request, 'erosion.html', content)
def DILATION(request):
saveIMG(request)
img = IMG.objects.all().last()
content = {
'img': img,
}
img1 = IMG.objects.all()
for i in img1:
print(i.img.path)
funs.Dilation(i.img.path)
return render(request, 'dilation.html', content)
def NOISE(request):
saveIMG(request)
img = IMG.objects.all().last()
content = {
'img': img,
}
img1 = IMG.objects.all()
for i in img1:
print(i.img.path)
funs.Noise(i.img.path)
return render(request, 'noise.html', content)

Binary file not shown.

@ -0,0 +1,16 @@
"""
ASGI config for djangoProject project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings')
application = get_asgi_application()

@ -0,0 +1,126 @@
"""
Django settings for djangoProject project.
Generated by 'django-admin startproject' using Django 3.2.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-d*0iib=r5f!*gg#1r^_c!-ujdfs3q&az%@8ny3&cj%t)ar8_#m'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'APP01.apps.App01Config',
'django_extensions', # 清理缓存
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'djangoProject.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates']
,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'djangoProject.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
import os
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media').replace('\\', '/') # 设置静态文件路径为主目录下的media文件夹
MEDIA_URL = '/media/' # url映射
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

@ -0,0 +1,42 @@
"""djangoProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf.urls.static import static
from APP01 import views
from djangoProject import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('test/', views.test),
# APP01
path('', views.index),
path('rgb/', views.RGB),
path('hsv/', views.HSV),
path('un/', views.UN), # 取反、非运算
path('add/', views.ADD),
path('subtract/', views.SUBTRACT),
path('opandcl/', views.OPANDCL),
path('sharp/', views.SHARP),
path('turn/', views.TURN),
path('erosion/', views.EROSION),
path('dilation/', views.DILATION),
path('noise/', views.NOISE),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

@ -0,0 +1,16 @@
"""
WSGI config for djangoProject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings')
application = get_wsgi_application()

@ -0,0 +1,176 @@
import cv2
import numpy as np
import math
# RGB色彩空间
def Rgb(path):
img = cv2.imread(path, 1)
b = img[:, :, 0]
g = img[:, :, 1]
r = img[:, :, 2]
cv2.imwrite('./media/RGB/b.jpg', b)
cv2.imwrite('./media/RGB/g.jpg', g)
cv2.imwrite('./media/RGB/r.jpg', r)
# HSV色彩空间
def Hsv(path):
img = cv2.imread(path, 1)
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
h = hsv[:, :, 0]
s = hsv[:, :, 1]
v = hsv[:, :, 2]
cv2.imwrite("./media/HSV/h.jpg", h)
cv2.imwrite("./media/HSV/s.jpg", s)
cv2.imwrite("./media/HSV/v.jpg", v)
def Un(path):
img = cv2.imread(path, 0)
result = ~img
cv2.imwrite("./media/UN/un.jpg", result)
def Add(paths):
# 只做了两个图像叠加,多个怎么做
img1 = cv2.imread(paths[0], 1)
img2 = cv2.imread(paths[1], 1)
img = cv2.add(img1, img2)
cv2.imwrite("./media/ADD/add.jpg", img)
def Subtract(paths):
img1 = cv2.imread(paths[0], 1)
img2 = cv2.imread(paths[1], 1)
img = cv2.subtract(img1, img2)
cv2.imwrite("./media/SUBTRACT/subtract.jpg", img)
# 形态学操作
def OpenAndClose(path):
# 二值转换
img = cv2.imread(path, 1)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
retval, src = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)
# 定义十字形结构元素
kernel = cv2.getStructuringElement(cv2.MORPH_CROSS, (10, 10), (-1, -1))
# 对二值图进行开运算和闭运算操作
im_op = cv2.morphologyEx(src, cv2.MORPH_OPEN, kernel)
im_cl = cv2.morphologyEx(src, cv2.MORPH_CLOSE, kernel)
cv2.imwrite('./media/OPANDCL/op.png', im_op)
cv2.imwrite('./media/OPANDCL/cl.png', im_cl)
# 边缘检测和图像增强
def Sharp(path):
CRH = cv2.imread(path, 1)
gradient = np.zeros_like(CRH)
CRH = CRH.astype('float')
h, w = CRH.shape[:2]
for x in range(h - 1):
for y in range(w - 1):
gx = abs(CRH[x + 1, y] - CRH[x, y])
gy = abs(CRH[x, y + 1] - CRH[x, y])
gradient[x, y] = gx + gy
sharp = CRH + gradient
sharp = np.where(sharp > 255, 255, sharp)
sharp = np.where(sharp < 0, 0, sharp)
gradient = gradient.astype('uint8')
sharp = sharp.astype('uint8')
cv2.imwrite('./media/SHARP/gradient.png', gradient)
cv2.imwrite('./media/SHARP/sharp.png', sharp)
# 镜像
def Turn(path):
img = cv2.imread(path)
# 水平镜像
horizontal = cv2.flip(img, 1, dst=None)
# 垂直镜像
vertical = cv2.flip(img, 0, dst=None)
# 对角镜像
cross = cv2.flip(img, -1, dst=None)
cv2.imwrite("./media/TURN/horizontal.jpg", horizontal)
cv2.imwrite("./media/TURN/vertical.jpg", vertical)
cv2.imwrite("./media/TURN/cross.jpg", cross)
# 腐蚀
def Erosion(path):
src = cv2.imread(path, cv2.IMREAD_UNCHANGED)
# 10x10的交叉型结构元
kernel = cv2.getStructuringElement(cv2.MORPH_CROSS, (10, 10), (-1, -1))
erosion = cv2.erode(src, kernel)
cv2.imwrite("./media/EROSION/erosion.jpg", erosion)
# 膨胀
def Dilation(path):
src = cv2.imread(path, cv2.IMREAD_UNCHANGED)
# 10x10的交叉结构元
kernel = cv2.getStructuringElement(cv2.MORPH_CROSS, (10, 10), (-1, -1))
dilation = cv2.dilate(src, kernel)
cv2.imwrite("./media/DILATION/dilation.png", dilation)
# 噪声及滤波
def Noise(path):
image = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
output = np.zeros(image.shape, np.uint8)
output2 = np.zeros(image.shape, np.uint8)
# 叠加噪声
for i in range(image.shape[0]):
for j in range(image.shape[1]):
if image[i][j] < 40:
# 添加食盐噪声
output[i][j] = 255
elif image[i][j] > 200:
# 添加胡椒噪声
output[i][j] = 0
# 不添加噪声
else:
output[i][j] = image[i][j]
# 均值滤波
for i in range(output.shape[0]):
for j in range(output.shape[1]):
ji = 1.0
for n in range(-1, 2):
if 0 <= i < output.shape[0] and 0 <= j + n < output.shape[1]:
ji = ji * output[i][j + n]
output2[i][j] = int(ji ** (1 / 3))
cv2.imwrite("./media/NOISE/noise.jpg", output)
cv2.imwrite("./media/NOISE/meanFilter.jpg", output2)
# # 扩展平移缩放
# def moveandchange(path):
# img = cv2.imread(path, 1)
# l, w, h = img.shape
# # 扩展,使用双线性插值法
# img = cv2.resize(img, (0, 0), fx=2, fy=2, interpolation=cv2.INTER_LINEAR)
# height, width, channel = img.shape
# # 移动
# M = np.float32([[1, 0, 30], [0, 1, 60]])
# img = cv2.warpAffine(img, M, (width, height))
# # 旋转
# rows, cols, depth = img.shape
# M = cv2.getRotationMatrix2D((cols / 2, rows / 2), 45, 1)
# dst = cv2.warpAffine(img, M, (width, height))
#
# cv2.imwrite('./media/CHANGE/out.png', dst)
# # 仿射变换
# def affine(path):
# img = cv2.imread(path)
# rows, cols = img.shape[: 2]
# # 设置图像仿射变化矩阵
# post1 = np.float32([[50, 50], [200, 50], [50, 200]])
# post2 = np.float32([[10, 100], [200, 50], [100, 250]])
# M = cv2.getAffineTransform(post1, post2)
# # 图像仿射变换
# result = cv2.warpAffine(img, M, (rows, cols))
# cv2.imwrite("./media/AFFINE/affine.jpg", result)

@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>ADD</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{% for i in img %}
<img src="{{ i.img.url }}" />
{% endfor %}
{# <img src="{{ img.img.url }}" alt=""/>#}
<br>
<p1>叠加后</p1>
<br>
<img src="/media/ADD/add.jpg" alt="add.jpg"/>
<br>
</body>
</html>

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>图像膨胀</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{# {% for img in imgs %}#}
{# <img src="{{ img.img.url }}" />#}
{# {% endfor %}#}
<img src="{{ img.img.url }}" alt=""/>
<br>
<p1>膨胀后</p1>
<br>
<img src="/media/DILATION/dilation.png" alt="dilation.png"/>
<br>
</body>
</html>

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>图像腐蚀</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{# {% for img in imgs %}#}
{# <img src="{{ img.img.url }}" />#}
{# {% endfor %}#}
<img src="{{ img.img.url }}" alt=""/>
<br>
<p1>腐蚀后</p1>
<br>
<img src="/media/EROSION/erosion.jpg" alt="erosion.jpg"/>
<br>
</body>
</html>

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>HSV</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{# {% for img in imgs %}#}
{# <img src="{{ img.img.url }}" />#}
{# {% endfor %}#}
<img src="{{ img.img.url }}" alt=""/>
<br>
<p1>H</p1>
<br>
<img src="/media/HSV/h.jpg" alt="H"/>
<br>
<p1>S</p1>
<br>
<img src="/media/HSV/s.jpg" alt="S"/>
<br>
<p1>V</p1>
<br>
<img src="/media/HSV/v.jpg" alt="V"/>
</body>
</html>

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>数字图像处理demo</title>
</head>
<body>
<a href="/rgb">RGB三通道显示</a>
<a href="/hsv">HSV三通道显示</a>
<a href="/un">二值图像取反</a>
<a href="/add">图像叠加</a>
<a href="/subtract">图像相减</a>
<a href="/opandcl">形态学操作(开运算与闭运算)</a>
<a href="/sharp">边缘检测</a>
<a href="/turn">镜像翻转</a>
<a href="/erosion">图像腐蚀</a>
<a href="/dilation">图像膨胀</a>
<a href="/noise">噪声与滤波</a>
</body>
</html>

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>噪声与滤波</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{# {% for img in imgs %}#}
{# <img src="{{ img.img.url }}" />#}
{# {% endfor %}#}
<img src="{{ img.img.url }}" alt=""/>
<br>
<p1>噪声</p1>
<br>
<img src="/media/NOISE/noise.jpg" alt="noise.jpg"/>
<br>
<p1>滤波</p1>
<br>
<img src="/media/NOISE/meanFilter.jpg" alt="meanFilter.jpg"/>
<br>
</body>
</html>

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>OPEN AND CLOSE</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{# {% for img in imgs %}#}
{# <img src="{{ img.img.url }}" />#}
{# {% endfor %}#}
<img src="{{ img.img.url }}" alt=""/>
<br>
<p1>open</p1>
<br>
<img src="/media/OPANDCL/op.png" alt="op.png"/>
<br>
<p1>close</p1>
<br>
<img src="/media/OPANDCL/cl.png" alt="cl.png"/>
<br>
</body>
</html>

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>RGB</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{# {% for img in imgs %}#}
{# <img src="{{ img.img.url }}" />#}
{# {% endfor %}#}
<img src="{{ img.img.url }}" alt=""/>
<br>
<p1>B</p1>
<br>
<img src="/media/RGB/b.jpg" alt="B"/>
<br>
<p1>G</p1>
<br>
<img src="/media/RGB/g.jpg" alt="G"/>
<br>
<p1>R</p1>
<br>
<img src="/media/RGB/r.jpg" alt="R"/>
</body>
</html>

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>边缘检测与增强</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{# {% for img in imgs %}#}
{# <img src="{{ img.img.url }}" />#}
{# {% endfor %}#}
<img src="{{ img.img.url }}" alt=""/>
<br>
<p1>gradient</p1>
<br>
<img src="/media/SHARP/gradient.png" alt="gradient.png"/>
<br>
<p1>sharp</p1>
<br>
<img src="/media/SHARP/sharp.png" alt="sharp.png"/>
<br>
</body>
</html>

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>ADD</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>注意:相减图像需尺寸一致</p1>
<p1>原图</p1>
<br>
{% for i in img %}
<img src="{{ i.img.url }}" />
{% endfor %}
{# <img src="{{ img.img.url }}" alt=""/>#}
<br>
<p1>相减后</p1>
<br>
<img src="/media/SUBTRACT/subtract.jpg" alt="subtract.jpg"/>
<br>
</body>
</html>

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>镜像翻转</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{# {% for img in imgs %}#}
{# <img src="{{ img.img.url }}" />#}
{# {% endfor %}#}
<img src="{{ img.img.url }}" alt=""/>
<br>
<p1>水平镜像</p1>
<br>
<img src="/media/SHARP/horizontal.jpg" alt="horizontal.jpg"/>
<br>
<p1>垂直镜像</p1>
<br>
<img src="/media/SHARP/vertical.jpg" alt="vertical.jpg"/>
<br>
<p1>对角镜像</p1>
<br>
<img src="/media/SHARP/cross.jpg" alt="cross.jpg"/>
<br>
</body>
</html>

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>非运算</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="img">
<button type="submit">上传</button>
</form>
<p1>原图</p1>
<br>
{# {% for img in imgs %}#}
{# <img src="{{ img.img.url }}" />#}
{# {% endfor %}#}
<img src="{{ img.img.url }}" alt=""/>
<br>
<p1>取非后</p1>
<br>
<img src="/media/UN/un.jpg" alt="un"/>
</body>
</html>
Loading…
Cancel
Save