【发布时间】:2021-04-05 22:27:10
【问题描述】:
想在显微镜图像上使用边缘检测来使背景变白。 这是我目前的代码,这有用吗?
代码:
import cv2
import numpy as np
import matplotlib.pyplot as plt
def simple_edge_detection(image):
edges_detected = cv2.Canny(image , 100, 200)
images = [image , edges_detected]
location = [121, 122]
for loc, edge_image in zip(location, images):
plt.subplot(loc)
plt.imshow(edge_image, cmap='gray')
cv2.imwrite('edge_detected.png', edges_detected)
plt.savefig('edge_plot.png')
plt.show()
img = cv2.imread('gay2.0.jpg', 0)
simple_edge_detection(img)
【问题讨论】:
标签: python image background edge-detection