diff --git a/djangoProject/.idea/.gitignore b/djangoProject/.idea/.gitignore
new file mode 100644
index 0000000..35410ca
--- /dev/null
+++ b/djangoProject/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/djangoProject/.idea/djangoProject.iml b/djangoProject/.idea/djangoProject.iml
new file mode 100644
index 0000000..fa3c579
--- /dev/null
+++ b/djangoProject/.idea/djangoProject.iml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/.idea/inspectionProfiles/Project_Default.xml b/djangoProject/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..06bb031
--- /dev/null
+++ b/djangoProject/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/.idea/inspectionProfiles/profiles_settings.xml b/djangoProject/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/djangoProject/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/.idea/misc.xml b/djangoProject/.idea/misc.xml
new file mode 100644
index 0000000..241b051
--- /dev/null
+++ b/djangoProject/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/.idea/modules.xml b/djangoProject/.idea/modules.xml
new file mode 100644
index 0000000..5abfc21
--- /dev/null
+++ b/djangoProject/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/.idea/other.xml b/djangoProject/.idea/other.xml
new file mode 100644
index 0000000..a708ec7
--- /dev/null
+++ b/djangoProject/.idea/other.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/APP01/__init__.py b/djangoProject/APP01/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/djangoProject/APP01/__pycache__/__init__.cpython-37.pyc b/djangoProject/APP01/__pycache__/__init__.cpython-37.pyc
new file mode 100644
index 0000000..8726508
Binary files /dev/null and b/djangoProject/APP01/__pycache__/__init__.cpython-37.pyc differ
diff --git a/djangoProject/APP01/__pycache__/__init__.cpython-38.pyc b/djangoProject/APP01/__pycache__/__init__.cpython-38.pyc
new file mode 100644
index 0000000..6cabd89
Binary files /dev/null and b/djangoProject/APP01/__pycache__/__init__.cpython-38.pyc differ
diff --git a/djangoProject/APP01/__pycache__/admin.cpython-37.pyc b/djangoProject/APP01/__pycache__/admin.cpython-37.pyc
new file mode 100644
index 0000000..dae2087
Binary files /dev/null and b/djangoProject/APP01/__pycache__/admin.cpython-37.pyc differ
diff --git a/djangoProject/APP01/__pycache__/admin.cpython-38.pyc b/djangoProject/APP01/__pycache__/admin.cpython-38.pyc
new file mode 100644
index 0000000..05543ef
Binary files /dev/null and b/djangoProject/APP01/__pycache__/admin.cpython-38.pyc differ
diff --git a/djangoProject/APP01/__pycache__/apps.cpython-37.pyc b/djangoProject/APP01/__pycache__/apps.cpython-37.pyc
new file mode 100644
index 0000000..35175ef
Binary files /dev/null and b/djangoProject/APP01/__pycache__/apps.cpython-37.pyc differ
diff --git a/djangoProject/APP01/__pycache__/apps.cpython-38.pyc b/djangoProject/APP01/__pycache__/apps.cpython-38.pyc
new file mode 100644
index 0000000..c1cbbe0
Binary files /dev/null and b/djangoProject/APP01/__pycache__/apps.cpython-38.pyc differ
diff --git a/djangoProject/APP01/__pycache__/models.cpython-37.pyc b/djangoProject/APP01/__pycache__/models.cpython-37.pyc
new file mode 100644
index 0000000..4e9e6a2
Binary files /dev/null and b/djangoProject/APP01/__pycache__/models.cpython-37.pyc differ
diff --git a/djangoProject/APP01/__pycache__/models.cpython-38.pyc b/djangoProject/APP01/__pycache__/models.cpython-38.pyc
new file mode 100644
index 0000000..b1c4e0e
Binary files /dev/null and b/djangoProject/APP01/__pycache__/models.cpython-38.pyc differ
diff --git a/djangoProject/APP01/__pycache__/views.cpython-37.pyc b/djangoProject/APP01/__pycache__/views.cpython-37.pyc
new file mode 100644
index 0000000..49ea5f2
Binary files /dev/null and b/djangoProject/APP01/__pycache__/views.cpython-37.pyc differ
diff --git a/djangoProject/APP01/__pycache__/views.cpython-38.pyc b/djangoProject/APP01/__pycache__/views.cpython-38.pyc
new file mode 100644
index 0000000..0de6b67
Binary files /dev/null and b/djangoProject/APP01/__pycache__/views.cpython-38.pyc differ
diff --git a/djangoProject/APP01/admin.py b/djangoProject/APP01/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/djangoProject/APP01/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/djangoProject/APP01/apps.py b/djangoProject/APP01/apps.py
new file mode 100644
index 0000000..c1d5274
--- /dev/null
+++ b/djangoProject/APP01/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class App01Config(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'APP01'
diff --git a/djangoProject/APP01/migrations/0001_initial.py b/djangoProject/APP01/migrations/0001_initial.py
new file mode 100644
index 0000000..a198e10
--- /dev/null
+++ b/djangoProject/APP01/migrations/0001_initial.py
@@ -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)),
+ ],
+ ),
+ ]
diff --git a/djangoProject/APP01/migrations/__init__.py b/djangoProject/APP01/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/djangoProject/APP01/migrations/__pycache__/0001_initial.cpython-37.pyc b/djangoProject/APP01/migrations/__pycache__/0001_initial.cpython-37.pyc
new file mode 100644
index 0000000..7546c40
Binary files /dev/null and b/djangoProject/APP01/migrations/__pycache__/0001_initial.cpython-37.pyc differ
diff --git a/djangoProject/APP01/migrations/__pycache__/0001_initial.cpython-38.pyc b/djangoProject/APP01/migrations/__pycache__/0001_initial.cpython-38.pyc
new file mode 100644
index 0000000..9fcecd3
Binary files /dev/null and b/djangoProject/APP01/migrations/__pycache__/0001_initial.cpython-38.pyc differ
diff --git a/djangoProject/APP01/migrations/__pycache__/__init__.cpython-37.pyc b/djangoProject/APP01/migrations/__pycache__/__init__.cpython-37.pyc
new file mode 100644
index 0000000..a8057dc
Binary files /dev/null and b/djangoProject/APP01/migrations/__pycache__/__init__.cpython-37.pyc differ
diff --git a/djangoProject/APP01/migrations/__pycache__/__init__.cpython-38.pyc b/djangoProject/APP01/migrations/__pycache__/__init__.cpython-38.pyc
new file mode 100644
index 0000000..8f48779
Binary files /dev/null and b/djangoProject/APP01/migrations/__pycache__/__init__.cpython-38.pyc differ
diff --git a/djangoProject/APP01/models.py b/djangoProject/APP01/models.py
new file mode 100644
index 0000000..61d28d8
--- /dev/null
+++ b/djangoProject/APP01/models.py
@@ -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)
diff --git a/djangoProject/APP01/tests.py b/djangoProject/APP01/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/djangoProject/APP01/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/djangoProject/APP01/views.py b/djangoProject/APP01/views.py
new file mode 100644
index 0000000..7133534
--- /dev/null
+++ b/djangoProject/APP01/views.py
@@ -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)
+
diff --git a/djangoProject/__pycache__/funs.cpython-37.pyc b/djangoProject/__pycache__/funs.cpython-37.pyc
new file mode 100644
index 0000000..4bd384d
Binary files /dev/null and b/djangoProject/__pycache__/funs.cpython-37.pyc differ
diff --git a/djangoProject/__pycache__/manage.cpython-37.pyc b/djangoProject/__pycache__/manage.cpython-37.pyc
new file mode 100644
index 0000000..025aa71
Binary files /dev/null and b/djangoProject/__pycache__/manage.cpython-37.pyc differ
diff --git a/djangoProject/__pycache__/manage.cpython-38.pyc b/djangoProject/__pycache__/manage.cpython-38.pyc
new file mode 100644
index 0000000..63f58f4
Binary files /dev/null and b/djangoProject/__pycache__/manage.cpython-38.pyc differ
diff --git a/djangoProject/db.sqlite3 b/djangoProject/db.sqlite3
new file mode 100644
index 0000000..b911d6d
Binary files /dev/null and b/djangoProject/db.sqlite3 differ
diff --git a/djangoProject/djangoProject/__init__.py b/djangoProject/djangoProject/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/djangoProject/djangoProject/__pycache__/__init__.cpython-37.pyc b/djangoProject/djangoProject/__pycache__/__init__.cpython-37.pyc
new file mode 100644
index 0000000..fdd5ea9
Binary files /dev/null and b/djangoProject/djangoProject/__pycache__/__init__.cpython-37.pyc differ
diff --git a/djangoProject/djangoProject/__pycache__/__init__.cpython-38.pyc b/djangoProject/djangoProject/__pycache__/__init__.cpython-38.pyc
new file mode 100644
index 0000000..9c1c045
Binary files /dev/null and b/djangoProject/djangoProject/__pycache__/__init__.cpython-38.pyc differ
diff --git a/djangoProject/djangoProject/__pycache__/settings.cpython-37.pyc b/djangoProject/djangoProject/__pycache__/settings.cpython-37.pyc
new file mode 100644
index 0000000..8c75af7
Binary files /dev/null and b/djangoProject/djangoProject/__pycache__/settings.cpython-37.pyc differ
diff --git a/djangoProject/djangoProject/__pycache__/settings.cpython-38.pyc b/djangoProject/djangoProject/__pycache__/settings.cpython-38.pyc
new file mode 100644
index 0000000..0d6dafd
Binary files /dev/null and b/djangoProject/djangoProject/__pycache__/settings.cpython-38.pyc differ
diff --git a/djangoProject/djangoProject/__pycache__/urls.cpython-37.pyc b/djangoProject/djangoProject/__pycache__/urls.cpython-37.pyc
new file mode 100644
index 0000000..83abbce
Binary files /dev/null and b/djangoProject/djangoProject/__pycache__/urls.cpython-37.pyc differ
diff --git a/djangoProject/djangoProject/__pycache__/urls.cpython-38.pyc b/djangoProject/djangoProject/__pycache__/urls.cpython-38.pyc
new file mode 100644
index 0000000..18d25f8
Binary files /dev/null and b/djangoProject/djangoProject/__pycache__/urls.cpython-38.pyc differ
diff --git a/djangoProject/djangoProject/__pycache__/wsgi.cpython-37.pyc b/djangoProject/djangoProject/__pycache__/wsgi.cpython-37.pyc
new file mode 100644
index 0000000..94d549d
Binary files /dev/null and b/djangoProject/djangoProject/__pycache__/wsgi.cpython-37.pyc differ
diff --git a/djangoProject/djangoProject/__pycache__/wsgi.cpython-38.pyc b/djangoProject/djangoProject/__pycache__/wsgi.cpython-38.pyc
new file mode 100644
index 0000000..5790d5b
Binary files /dev/null and b/djangoProject/djangoProject/__pycache__/wsgi.cpython-38.pyc differ
diff --git a/djangoProject/djangoProject/asgi.py b/djangoProject/djangoProject/asgi.py
new file mode 100644
index 0000000..60757c4
--- /dev/null
+++ b/djangoProject/djangoProject/asgi.py
@@ -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()
diff --git a/djangoProject/djangoProject/settings.py b/djangoProject/djangoProject/settings.py
new file mode 100644
index 0000000..d4df02e
--- /dev/null
+++ b/djangoProject/djangoProject/settings.py
@@ -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'
diff --git a/djangoProject/djangoProject/urls.py b/djangoProject/djangoProject/urls.py
new file mode 100644
index 0000000..75bd9f9
--- /dev/null
+++ b/djangoProject/djangoProject/urls.py
@@ -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)
diff --git a/djangoProject/djangoProject/wsgi.py b/djangoProject/djangoProject/wsgi.py
new file mode 100644
index 0000000..cf736fe
--- /dev/null
+++ b/djangoProject/djangoProject/wsgi.py
@@ -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()
diff --git a/djangoProject/funs.py b/djangoProject/funs.py
new file mode 100644
index 0000000..5868faf
--- /dev/null
+++ b/djangoProject/funs.py
@@ -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)
diff --git a/djangoProject/manage.py b/djangoProject/manage.py
new file mode 100644
index 0000000..503f50e
--- /dev/null
+++ b/djangoProject/manage.py
@@ -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()
diff --git a/djangoProject/templates/add.html b/djangoProject/templates/add.html
new file mode 100644
index 0000000..92f224d
--- /dev/null
+++ b/djangoProject/templates/add.html
@@ -0,0 +1,27 @@
+
+
+
+
+ ADD
+
+
+
+
+ 原图
+
+ {% for i in img %}
+
+ {% endfor %}
+{# #}
+
+ 叠加后
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/dilation.html b/djangoProject/templates/dilation.html
new file mode 100644
index 0000000..5ae8cde
--- /dev/null
+++ b/djangoProject/templates/dilation.html
@@ -0,0 +1,29 @@
+
+
+
+
+ 图像膨胀
+
+
+
+
+ 原图
+
+{# {% for img in imgs %}#}
+{# #}
+{# {% endfor %}#}
+
+
+
+ 膨胀后
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/erosion.html b/djangoProject/templates/erosion.html
new file mode 100644
index 0000000..4b98fbf
--- /dev/null
+++ b/djangoProject/templates/erosion.html
@@ -0,0 +1,29 @@
+
+
+
+
+ 图像腐蚀
+
+
+
+
+ 原图
+
+{# {% for img in imgs %}#}
+{# #}
+{# {% endfor %}#}
+
+
+
+ 腐蚀后
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/hsv.html b/djangoProject/templates/hsv.html
new file mode 100644
index 0000000..86132cb
--- /dev/null
+++ b/djangoProject/templates/hsv.html
@@ -0,0 +1,35 @@
+
+
+
+
+ HSV
+
+
+
+
+ 原图
+
+{# {% for img in imgs %}#}
+{# #}
+{# {% endfor %}#}
+
+
+
+ H
+
+
+
+ S
+
+
+
+ V
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/index.html b/djangoProject/templates/index.html
new file mode 100644
index 0000000..d25467a
--- /dev/null
+++ b/djangoProject/templates/index.html
@@ -0,0 +1,22 @@
+
+
+
+
+ 数字图像处理demo
+
+
+
+ RGB三通道显示
+ HSV三通道显示
+ 二值图像取反
+ 图像叠加
+ 图像相减
+ 形态学操作(开运算与闭运算)
+ 边缘检测
+ 镜像翻转
+ 图像腐蚀
+ 图像膨胀
+ 噪声与滤波
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/noise.html b/djangoProject/templates/noise.html
new file mode 100644
index 0000000..66b60a1
--- /dev/null
+++ b/djangoProject/templates/noise.html
@@ -0,0 +1,33 @@
+
+
+
+
+ 噪声与滤波
+
+
+
+
+ 原图
+
+{# {% for img in imgs %}#}
+{# #}
+{# {% endfor %}#}
+
+
+
+ 噪声
+
+
+
+ 滤波
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/opandcl.html b/djangoProject/templates/opandcl.html
new file mode 100644
index 0000000..2914555
--- /dev/null
+++ b/djangoProject/templates/opandcl.html
@@ -0,0 +1,33 @@
+
+
+
+
+ OPEN AND CLOSE
+
+
+
+
+ 原图
+
+{# {% for img in imgs %}#}
+{# #}
+{# {% endfor %}#}
+
+
+
+ open
+
+
+
+ close
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/rgb.html b/djangoProject/templates/rgb.html
new file mode 100644
index 0000000..629a2c5
--- /dev/null
+++ b/djangoProject/templates/rgb.html
@@ -0,0 +1,35 @@
+
+
+
+
+ RGB
+
+
+
+
+ 原图
+
+{# {% for img in imgs %}#}
+{# #}
+{# {% endfor %}#}
+
+
+
+ B
+
+
+
+ G
+
+
+
+ R
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/sharp.html b/djangoProject/templates/sharp.html
new file mode 100644
index 0000000..7063577
--- /dev/null
+++ b/djangoProject/templates/sharp.html
@@ -0,0 +1,33 @@
+
+
+
+
+ 边缘检测与增强
+
+
+
+
+ 原图
+
+{# {% for img in imgs %}#}
+{# #}
+{# {% endfor %}#}
+
+
+
+ gradient
+
+
+
+ sharp
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/subtract.html b/djangoProject/templates/subtract.html
new file mode 100644
index 0000000..7d1bcd2
--- /dev/null
+++ b/djangoProject/templates/subtract.html
@@ -0,0 +1,29 @@
+
+
+
+
+ ADD
+
+
+
+
+ 注意:相减图像需尺寸一致
+
+ 原图
+
+ {% for i in img %}
+
+ {% endfor %}
+{# #}
+
+ 相减后
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/test.html b/djangoProject/templates/test.html
new file mode 100644
index 0000000..e69de29
diff --git a/djangoProject/templates/turn.html b/djangoProject/templates/turn.html
new file mode 100644
index 0000000..ae270c2
--- /dev/null
+++ b/djangoProject/templates/turn.html
@@ -0,0 +1,37 @@
+
+
+
+
+ 镜像翻转
+
+
+
+
+ 原图
+
+{# {% for img in imgs %}#}
+{# #}
+{# {% endfor %}#}
+
+
+
+ 水平镜像
+
+
+
+ 垂直镜像
+
+
+
+ 对角镜像
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djangoProject/templates/un.html b/djangoProject/templates/un.html
new file mode 100644
index 0000000..965e7c8
--- /dev/null
+++ b/djangoProject/templates/un.html
@@ -0,0 +1,27 @@
+
+
+
+
+ 非运算
+
+
+
+
+ 原图
+
+{# {% for img in imgs %}#}
+{# #}
+{# {% endfor %}#}
+
+
+
+ 取非后
+
+
+
+
+
\ No newline at end of file