生成边界从海拔映射盒/分水岭

问题描述 投票:0回答:1

我使用scikit,图像上的一些图片我已经执行图像分割,我指的是本教程(https://scikit-image.org/docs/dev/user_guide/tutorial_segmentation.html

我使用的描述海拔地图方法,虽然我不能够应用分水岭算法后能得到正确的结果,海拔地图本身似乎对我来说已经足够了。

我得到这个输出,当我绘制海拔地图:

enter image description here

现在我想的坐标为这个对象的边界框。如何实现这一目标?我看着http://scikit-image.org/docs/dev/auto_examples/edges/plot_contours.html但我无法弄清楚我该如何选择find_contours第二个参数?

image-processing scikit-image
1个回答
1
投票

这是否为您工作?

from skimage import filters
from scipy import ndimage as ndi

threshold = filters.threshold_otsu(elevation_map)
binary = (elevation_map > threshold).astype(int)
bounding_box = ndi.find_objects(binary)[0]
© www.soinside.com 2019 - 2024. All rights reserved.