0

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. However, regionprops does not provide those edge cases

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.

craigcaulfield
  • 3,381
  • 10
  • 32
  • 40

1 Answers1

0

You shouldn't use 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.

Juan
  • 5,433
  • 21
  • 23