根据边缘略过作物图像

2024-10-05 14:29:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试根据图像的边缘裁剪图像 我有类似的东西:

imggrey = io.imread(self.input_file, as_grey=True)
edges = canny(imggrey, sigma=self.sigma)
h, a, d = hough_line(edges)
_, ap, _ = hough_line_peaks(h, a, d, num_peaks=4)
cropped = imggrey[ap[0]:ap[1],ap[2]:ap[3]]
plt.imshow(cropped)
plt.show()

但很明显我遗漏了一些东西,因为裁剪后的图像无法生成

有人能帮我指点方向吗?在


Tags: io图像selfinputlinepltsigma边缘