#检测mask图像边界
def roberts_detect(img):
image = cv2.copyMakeBorder(img, 1, 0, 1, 0, cv2.BORDER_DEFAULT)
for i in range(1, image.shape[0]):
for j in range(1, image.shape[1]):
image[i, j] = RobertsOperator(image[i - 1:i + 2, j - 1:j + 2])
return image[1:image.shape[0], 1:image.shape[1]]
# 将三维图像抽壳
def border_mask_3d(mask):
thickness, width, length = mask.shape
border_3d = np.zeros((thickness, width, length))
for i in range(thickness):
temp_border = filters.roberts(mask[i])
border_3d[i] = temp_border
return border_3d
robert算子检测边界
最新推荐文章于 2024-08-10 20:16:20 发布