问题描述
想要在显微镜图像上使用边缘检测使背景变白。 这是我到目前为止的代码,这有用吗?
代码:
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)