add folder img
No files matched your search
@@ -1,10 +1,9 @@
|
||||
import cv2
|
||||
import cv2 as cv
|
||||
|
||||
if __name__ == "__main__":
|
||||
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"1\imwrite.png", lenna, (cv2.IMWRITE_PNG_COMPRESSION, 5))
|
||||
lenna = cv.imread(r"img\iris.jpg")
|
||||
print(type(lenna))
|
||||
cv.namedWindow("Lena", cv.WINDOW_AUTOSIZE)
|
||||
cv.imshow("Lena", lenna)
|
||||
cv.waitKey(0)
|
||||
cv.destroyWindow("Lena")
|
||||
cv.imwrite(r"1\imwrite.png", lenna, (cv.IMWRITE_PNG_COMPRESSION, 5))
|
||||
@@ -1,10 +1,9 @@
|
||||
import cv2
|
||||
import cv2 as cv
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
if __name__ == "__main__":
|
||||
plt.rcParams["font.family"] = ["SimHei"]
|
||||
plt.rcParams["axes.unicode_minus"] = False
|
||||
img_BGR = cv2.imread(r"src.jpg")
|
||||
img_RGB = cv2.cvtColor(img_BGR, cv2.COLOR_BGR2RGB)
|
||||
plt.imshow(img_RGB)
|
||||
plt.show()
|
||||
plt.rcParams["font.family"] = ["SimHei"]
|
||||
plt.rcParams["axes.unicode_minus"] = False
|
||||
img_BGR = cv.imread(r"img\iris.jpg")
|
||||
img_RGB = cv.cvtColor(img_BGR, cv.COLOR_BGR2RGB)
|
||||
plt.imshow(img_RGB)
|
||||
plt.show()
|
||||
@@ -1,6 +1,5 @@
|
||||
import cv2
|
||||
import cv2 as cv
|
||||
import matplotlib.pyplot as plt
|
||||
import math
|
||||
import numpy as np
|
||||
|
||||
|
||||
@@ -8,7 +7,7 @@ def createBox():
|
||||
box = np.zeros((100, 100), np.uint8) + 255
|
||||
print(type(box))
|
||||
shape = box.shape
|
||||
box = cv2.circle(box, (30, 50), 25, 0, -1)
|
||||
box = cv.circle(box, (30, 50), 25, 0, -1) # type: ignore
|
||||
for i in range(shape[0]):
|
||||
for j in range(shape[1]):
|
||||
if j in range(45, 95) and i in range(25, 75):
|
||||
@@ -29,7 +28,7 @@ if __name__ == "__main__":
|
||||
image0 = createBox()
|
||||
plt.figure()
|
||||
plt.subplot(1, 2, 1)
|
||||
plt.imshow(image0, vmin=0, vmax=255, cmap=plt.cm.gray)
|
||||
plt.imshow(image0, vmin=0, vmax=255, cmap=plt.cm.gray) # type: ignore
|
||||
plt.title("idel image")
|
||||
image_hist0 = histogram(image0)
|
||||
plt.subplot(1, 2, 2)
|
||||
|
||||
@@ -20,7 +20,7 @@ def histogram_equalization(im):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
im = cv.imread(r"src.jpg", cv.IMREAD_GRAYSCALE)
|
||||
im = cv.imread(r"img\iris.jpg", cv.IMREAD_GRAYSCALE)
|
||||
im1 = global_linear_transmation(im, 0, 150)
|
||||
im2 = global_linear_transmation(im, 100)
|
||||
im3 = global_linear_transmation(im, 50, 150)
|
||||
@@ -39,11 +39,11 @@ if __name__ == "__main__":
|
||||
plt.imshow(im4, cmap="gray")
|
||||
plt.title("equalized")
|
||||
plt.subplot(245)
|
||||
plt.hist(im1.flatten(), 256, [0, 256])
|
||||
plt.hist(im1.flatten(), 256, [0, 256]) # type: ignore
|
||||
plt.subplot(246)
|
||||
plt.hist(im2.flatten(), 256, [0, 256])
|
||||
plt.hist(im2.flatten(), 256, [0, 256]) # type: ignore
|
||||
plt.subplot(247)
|
||||
plt.hist(im3.flatten(), 256, [0, 256])
|
||||
plt.hist(im3.flatten(), 256, [0, 256]) # type: ignore
|
||||
plt.subplot(248)
|
||||
plt.hist(im4.flatten(), 256, [0, 256])
|
||||
plt.hist(im4.flatten(), 256, [0, 256]) # type: ignore
|
||||
plt.show()
|
||||
@@ -10,7 +10,7 @@ def gamma_trans(img, gamma=1.0):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
im = cv.imread(r"src.jpg", cv.IMREAD_GRAYSCALE)
|
||||
im = cv.imread(r"img\iris.jpg", cv.IMREAD_GRAYSCALE)
|
||||
im1 = gamma_trans(im, 0.5)
|
||||
im2 = gamma_trans(im, 1.5)
|
||||
plt.figure()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import cv2 as cv
|
||||
from matplotlib import pyplot as plt
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
if __name__ == "__main__":
|
||||
img = cv.imread(r"src.jpg", 0)
|
||||
img = cv.imread(r"img\iris.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]])
|
||||
@@ -12,7 +12,6 @@ if __name__ == "__main__":
|
||||
ImgSmoothed2 = cv.filter2D(img, -1, fil2, borderType=cv.BORDER_DEFAULT)
|
||||
ImgSmoothed3 = cv.filter2D(img, -1, fil3, borderType=cv.BORDER_DEFAULT)
|
||||
ImgSharp = cv.filter2D(img, -1, fil4, borderType=cv.BORDER_DEFAULT)
|
||||
|
||||
plt.figure()
|
||||
plt.subplot(221)
|
||||
plt.imshow(ImgSmoothed1, cmap="gray")
|
||||
|
||||
@@ -33,15 +33,15 @@ def addGaussianNoise(src, means, sigma):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
im = cv.imread(r"src.jpg", cv.IMREAD_GRAYSCALE)
|
||||
im = cv.imread(r"img\iris.jpg", cv.IMREAD_GRAYSCALE)
|
||||
im1 = addSaltAndPepper(im, 0.1)
|
||||
im11 = cv.blur(im1, (3, 3))
|
||||
im12 = cv.medianBlur(im1, 3)
|
||||
im13 = cv.GaussianBlur(im1, (3, 3), 1)
|
||||
im2 = addGaussianNoise(im, 0, 0.1)
|
||||
im21 = cv.blur(im2, (3, 3))
|
||||
im22 = cv.medianBlur(im2, 3)
|
||||
im23 = cv.GaussianBlur(im2, (3, 3), 1)
|
||||
im21 = cv.blur(im2, (3, 3)) # type: ignore
|
||||
im22 = cv.medianBlur(im2, 3) # type: ignore
|
||||
im23 = cv.GaussianBlur(im2, (3, 3), 1) # type: ignore
|
||||
plt.figure()
|
||||
plt.subplot(241)
|
||||
plt.imshow(im1, cmap="gray")
|
||||
|
||||
@@ -3,12 +3,11 @@ from matplotlib import pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
if __name__ == "__main__":
|
||||
img = cv.imread(r"src.jpg", 0)
|
||||
img = cv.imread(r"img\iris.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)
|
||||
ImgLplcEnhance = cv.filter2D(img, -1, lplcEnhance, borderType=cv.BORDER_DEFAULT)
|
||||
|
||||
plt.figure()
|
||||
plt.subplot(131)
|
||||
plt.imshow(img, cmap="gray")
|
||||
|
||||
|
After Width: | Height: | Size: 307 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 126 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 477 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 339 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 15 MiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 151 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 3.4 MiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 281 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 5.1 KiB |