This commit is contained in:
xixu-me committed 2024-04-22 22:37:42 +08:00
1 parent b15e6b19ce
commit 48f6ee13a7
12 files changed
+18 -70

No files matched your search

-3
View File
@@ -1,3 +0,0 @@
{
"python.analysis.autoImportCompletions": true
}
+10 -59
View File
@@ -2,51 +2,27 @@
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hellohellohello\n"
]
}
],
"outputs": [],
"source": [
"print(\"hello\" * 3)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"x = 2, y = 3.000000\n"
]
}
],
"outputs": [],
"source": [
"print(\"x = %d, y = %f\" % (2, 3.0))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(2-3j)\n"
]
}
],
"outputs": [],
"source": [
"x = 3 + 2j\n",
"y = -1j\n",
@@ -55,26 +31,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"abcdefg\n",
"bc\n",
"bcdefg\n",
"abc\n",
"abcdef\n",
"ef\n",
"efg\n",
"abcdefg\n",
"aceg\n",
"gfedcba\n"
]
}
],
"outputs": [],
"source": [
"strs = \"abcdefg\"\n",
"print(strs[0:7:1])\n",
@@ -91,17 +50,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"较小值为: 5.7\n"
]
}
],
"outputs": [],
"source": [
"def minimal(x, y):\n",
" if x > y:\n",
+2 -2
View File
@@ -1,9 +1,9 @@
import cv2
lenna = cv2.imread(r"img\Lenna.png")
lenna = cv2.imread(r"src.jpg")
print(type(lenna))
cv2.namedWindow("Lena", cv2.WINDOW_AUTOSIZE)
cv2.imshow("Lena", lenna)
cv2.waitKey(0)
cv2.destroyWindow("Lena")
cv2.imwrite(r"img\test_imwrite.png", lenna, (cv2.IMWRITE_PNG_COMPRESSION, 5))
cv2.imwrite(r"1\imwrite.png", lenna, (cv2.IMWRITE_PNG_COMPRESSION, 5))
+1 -1
View File
@@ -3,7 +3,7 @@ import matplotlib.pyplot as plt
plt.rcParams["font.family"] = ["SimHei"]
plt.rcParams["axes.unicode_minus"] = False
img_BGR = cv2.imread(r"img\iris.jpg")
img_BGR = cv2.imread(r"src.jpg")
img_RGB = cv2.cvtColor(img_BGR, cv2.COLOR_BGR2RGB)
plt.imshow(img_RGB)
plt.show()
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

+1 -1
View File
@@ -21,7 +21,7 @@ def histogram_equalization(im):
if __name__ == "__main__":
im = cv.imread(r"E:\OneDrive\Code\Python\2\iris.jpg", cv.IMREAD_GRAYSCALE)
im = cv.imread(r"src.jpg", cv.IMREAD_GRAYSCALE)
im1 = global_linear_transmation(im, 0, 150)
im2 = global_linear_transmation(im, 100)
im3 = global_linear_transmation(im, 50, 150)
+1 -1
View File
@@ -10,7 +10,7 @@ def gamma_trans(img, gamma=1.0):
if __name__ == "__main__":
im = cv.imread(r"E:\OneDrive\Code\Python\2\iris.jpg", cv.IMREAD_GRAYSCALE)
im = cv.imread(r"src.jpg", cv.IMREAD_GRAYSCALE)
im1 = gamma_trans(im, 0.5)
im2 = gamma_trans(im, 1.5)
plt.figure()
+1 -1
View File
@@ -2,7 +2,7 @@ import cv2 as cv
from matplotlib import pyplot as plt
import numpy as np
img = cv.imread(r"E:\OneDrive\Code\Python\2\iris.jpg", 0)
img = cv.imread(r"src.jpg", 0)
fil1 = 1 / 16 * np.array([[1, 2, 1], [2, 4, 2], [1, 2, 1]])
fil2 = 1 / 9 * np.array([[1, 1, 1], [1, 1, 1], [1, 1, 1]])
fil3 = 1 / 10 * np.array([[1, 1, 1], [1, 2, 1], [1, 1, 1]])
+1 -1
View File
@@ -33,7 +33,7 @@ def addGaussianNoise(src, means, sigma):
if __name__ == "__main__":
im = cv.imread(r"E:\OneDrive\Code\Python\2\iris.jpg", cv.IMREAD_GRAYSCALE)
im = cv.imread(r"src.jpg", cv.IMREAD_GRAYSCALE)
im1 = addSaltAndPepper(im, 0.1)
im11 = cv.blur(im1, (3, 3))
im12 = cv.medianBlur(im1, 3)
+1 -1
View File
@@ -2,7 +2,7 @@ import cv2 as cv
from matplotlib import pyplot as plt
import numpy as np
img = cv.imread(r"E:\OneDrive\Code\Python\2\iris.jpg", 0)
img = cv.imread(r"src.jpg", 0)
lplc = np.array([[0, -1, 0], [-1, 4, -1], [0, -1, 0]])
lplcEnhance = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])
ImgLplc = cv.filter2D(img, -1, lplc, borderType=cv.BORDER_DEFAULT)
View File
File renamed without changes.