Ask Your Question

Revision history [back]

How to get more than one bounding box value from a single segmented-image for a given value?

I am trying to fetch all the bounnding boxes values for a given segmented-image for a particular value.

For example: I have a single semantic-segmented image which contains pedestrians, van, car, traffic light etc. The class value for traffic light is 81 in that image. But the challenging is that in that image there are nearly 6 traffic light and I want to extract all the 6 bounding box values for that image.

What i have tried so far, I used regionprops from skimage and filtered the labels values equal to 81 and retrieved the bbox (bounding box) value for that image. But i could retrieve only 1 bounding box value.

I want to retrieve all the 6 bounding box value for a single image.

I am writing in python language. It would be very great if anyone can help or suggest me here..

update: (minimal code)

img = io.imread("170927_071756318_Camera_5_bin.png")
for region in regionprops(img):
    if(region.label == 81):
        bboxes = region.bbox
        print(bboxes)