This commit is contained in:
xixu-me committed 2024-04-27 22:48:30 +08:00
1 parent 86fc71835d
commit c59622aec4
7 files changed
+67 -63

No files matched your search

+1 -1
View File
@@ -83,7 +83,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.12.3"
}
},
"nbformat": 4,
+8 -7
View File
@@ -1,9 +1,10 @@
import cv2
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))
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))
+7 -6
View File
@@ -1,9 +1,10 @@
import cv2
import matplotlib.pyplot as plt
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()
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()
+10 -9
View File
@@ -25,12 +25,13 @@ def histogram(image):
return hist
image0 = createBox()
plt.figure()
plt.subplot(1, 2, 1)
plt.imshow(image0, vmin=0, vmax=255, cmap=plt.cm.gray)
plt.title("idel image")
image_hist0 = histogram(image0)
plt.subplot(1, 2, 2)
plt.bar(range(256), image_hist0)
plt.show()
if __name__ == "__main__":
image0 = createBox()
plt.figure()
plt.subplot(1, 2, 1)
plt.imshow(image0, vmin=0, vmax=255, cmap=plt.cm.gray)
plt.title("idel image")
image_hist0 = histogram(image0)
plt.subplot(1, 2, 2)
plt.bar(range(256), image_hist0)
plt.show()