我正在尝试使用 python 中的 skimage 库重建我的灰度图像。我曾将标记图像用作灰度图像,将侵蚀图像用作蒙版图像,但是当我应用膨胀时,我的输出图像是完全白色的。任何人都可以告诉我如何创建用于重建图像的 4 个连接的结构元素。
我已经提供了我编写的部分代码。对于图像的侵蚀,我使用了圆盘形 3 的结构元素
from skimage.morphology.greyreconstruct import reconstruction
import numpy as np
import cv2
from skimage.morphology import disk,erosion
import matplotlib.pyplot as plt
%matplotlib inline
element = disk(3)
eroded = erosion(gray,element)
reconst= reconstruction(eroded,gray,'dilation')
cv2.imshow("reconst",reconst)
cv2.waitKey(0)
cv2.destroyAllWindows()
我想获得图像的边缘,但我重建的图像是完全白色的