简体   繁体   English

如何使用skimage.segmentation.felzenszwalb获取围绕轮廓的框?

[英]How to get box around contour using skimage.segmentation.felzenszwalb?

I'm trying to get a box around a segmented object on the edge of the image, that is, there is no contour around the segmentation because the object is only partially inside the image region. 我正在尝试在图像边缘上的分割对象周围创建一个框,也就是说,由于对象仅部分位于图像区域内,因此分割周围没有轮廓。

I use skimage.segmentation , find_boundaries , clear_border , and regioprops . 我使用skimage.segmentationfind_boundariesclear_borderregioprops However, regionprops does not provide those edge cases 但是, regionprops不提供这些regionprops情况

segments_fz = felzenszwalb(cv2.cvtColor(image, cv2.COLOR_BGR2RGB), scale=300, sigma=0.5, min_size=50)
cleared = clear_border(segments_fz)
label_image = label(cleared)
regionprops(label_image)

A box around segmented object near the limit of the image region. 靠近图像区域限制的分割对象周围的方框。

You shouldn't use clear_border . 您不应该使用clear_border Then the objects on the border will be treated like any other. 然后,边框上的对象将被视为其他对象。 The bbox property should give you a bounding box for your object of interest, while find_boundaries and mark_boundaries will let you get or visualise the boundaries between segments. bbox属性应该为您感兴趣的对象提供一个边界框,而find_boundariesmark_boundaries将使您可以获取或可视化段之间的边界。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM