diff --git a/2/1.py b/2/1.py index 2041350..655ab34 100644 --- a/2/1.py +++ b/2/1.py @@ -1,6 +1,6 @@ -import numpy as np import cv2 as cv import matplotlib.pyplot as plt +import numpy as np def global_linear_transmation(im, c=0, d=255): diff --git a/2/2.py b/2/2.py index d9075a4..65d90db 100644 --- a/2/2.py +++ b/2/2.py @@ -1,6 +1,6 @@ -import numpy as np import cv2 as cv import matplotlib.pyplot as plt +import numpy as np def gamma_trans(img, gamma=1.0): diff --git a/2/4.py b/2/4.py index cbf6fcb..f5b37d8 100644 --- a/2/4.py +++ b/2/4.py @@ -1,7 +1,8 @@ import random as rd -import numpy as np + import cv2 as cv import matplotlib.pyplot as plt +import numpy as np def addSaltAndPepper(src, percentage): diff --git a/2/5.py b/2/5.py index 8717712..eb6c0b9 100644 --- a/2/5.py +++ b/2/5.py @@ -1,6 +1,6 @@ import cv2 as cv -from matplotlib import pyplot as plt import numpy as np +from matplotlib import pyplot as plt if __name__ == "__main__": img = cv.imread(r"img\iris.jpg", 0) diff --git a/3/2.py b/3/2.py index 0651d50..dc2008f 100644 --- a/3/2.py +++ b/3/2.py @@ -1,8 +1,9 @@ -import cv2 as cv -import numpy as np -from math import * # type: ignore import random +from math import * # type: ignore + +import cv2 as cv import matplotlib.pyplot as plt +import numpy as np plt.rcParams["font.sans-serif"] = ["SimSun"] plt.rcParams["axes.unicode_minus"] = False diff --git a/3/3.py b/3/3.py index fe77795..59e0d04 100644 --- a/3/3.py +++ b/3/3.py @@ -1,8 +1,9 @@ -import cv2 as cv -import numpy as np -from math import * # type: ignore import random +from math import * # type: ignore + +import cv2 as cv import matplotlib.pyplot as plt +import numpy as np plt.rcParams["font.sans-serif"] = ["SimSun"] plt.rcParams["axes.unicode_minus"] = False diff --git a/3/4.py b/3/4.py index 15de8bb..972e693 100644 --- a/3/4.py +++ b/3/4.py @@ -1,6 +1,6 @@ import cv2 as cv -import numpy as np import matplotlib.pyplot as plt +import numpy as np img = cv.imread(r"img\peppers.bmp", 0) m, n = img.shape diff --git a/7/1.py b/7/1.py index bd6a5ee..c1ea7b7 100644 --- a/7/1.py +++ b/7/1.py @@ -1,6 +1,6 @@ import cv2 as cv -import numpy as np import matplotlib.pyplot as plt +import numpy as np plt.rcParams["font.sans-serif"] = ["SimSun"] diff --git a/7/2.py b/7/2.py index 839809b..b7285eb 100644 --- a/7/2.py +++ b/7/2.py @@ -1,6 +1,6 @@ import cv2 as cv -import numpy as np import matplotlib.pyplot as plt +import numpy as np plt.rcParams["font.sans-serif"] = ["SimSun"] diff --git a/8/1.py b/8/1.py index 84b15ee..c7d72cf 100644 --- a/8/1.py +++ b/8/1.py @@ -1,9 +1,12 @@ -from sklearn import datasets -from skimage.feature import hog -from sklearn.svm import LinearSVC -import numpy as np -import os, math, cv2, struct +import math +import os +import struct + import matplotlib.pyplot as plt +import numpy as np +from skimage.feature import hog +from sklearn import datasets +from sklearn.svm import LinearSVC plt.rcParams["font.sans-serif"] = ["Times New Roman"] plt.rcParams["axes.unicode_minus"] = False @@ -394,8 +397,8 @@ print(metrics.classification_report(testlabels, test_est)) print(testlabels.shape) -from sklearn.svm import LinearSVC from sklearn.ensemble import RandomForestClassifier +from sklearn.svm import LinearSVC rf_model = RandomForestClassifier() rf_model.fit(hog_features, labels) diff --git a/8/2/main.py b/8/2/main.py index 6d4a27f..823877f 100644 --- a/8/2/main.py +++ b/8/2/main.py @@ -1,30 +1,31 @@ # -*- coding: UTF-8 -*- -from globalObject import * +import os +import time import tkinter -from tkinter.simpledialog import askinteger, askfloat, askstring from tkinter.filedialog import ( + askdirectory, askopenfilename, askopenfilenames, asksaveasfilename, - askdirectory, ) -from tkinter.messagebox import showinfo, showwarning, showerror, askyesno -from PIL import Image, ImageTk -import os -import time -from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg -import PointProcessing -import Histogram -import SpatialFilter +from tkinter.messagebox import askyesno, showerror, showinfo, showwarning +from tkinter.simpledialog import askfloat, askinteger, askstring + +import carLicense.predict as predict +import description import Fourier import geometric -import spatialRestore -import Restore -import morphology -import segmentation -import description -import carLicense.predict as predict +import Histogram import matplotlib.pyplot as plt +import morphology +import PointProcessing +import Restore +import segmentation +import SpatialFilter +import spatialRestore +from globalObject import * +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg +from PIL import Image, ImageTk plt.rcParams["font.sans-serif"] = ["SimHei"] # 用来正常显示中文标签 plt.rcParams["axes.unicode_minus"] = False # 用来正常显示负