我使用scikit,图像上的一些图片我已经执行图像分割,我指的是本教程(https://scikit-image.org/docs/dev/user_guide/tutorial_segmentation.html)
我使用的描述海拔地图方法,虽然我不能够应用分水岭算法后能得到正确的结果,海拔地图本身似乎对我来说已经足够了。
我得到这个输出,当我绘制海拔地图:
现在我想的坐标为这个对象的边界框。如何实现这一目标?我看着http://scikit-image.org/docs/dev/auto_examples/edges/plot_contours.html但我无法弄清楚我该如何选择find_contours
第二个参数?
这是否为您工作?
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]