Matlib Image
unknown
plain_text
a year ago
621 B
7
Indexable
import cv2
import matplotlib.pyplot as plt
import os
image_path = r'D:\Superhero\Script\python\matlab\download.jpg'
if not os.path.isfile(image_path):
print("Image file does not exist at the specified path:", image_path)
exit()
img = cv2.imread(image_path)
if img is None:
print("Unable to read the image at the specified path:", image_path)
exit()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray, 100, 200)
plt.figure()
plt.title('download')
plt.imsave('download-result.png', edges, cmap='gray', format='png')
plt.imshow(edges, cmap='gray')
plt.show()
Editor is loading...
Leave a Comment