AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

How can I get labeled images in segmentation?

Open sunilhoho opened this issue 3 years ago • 1 comments

Question

What's your question?

Hi. I'm trying to get labeled images in segmentation, but it doesn't work.

Include context on what you are trying to achieve

I used simSetSegmentationObjectID(name + r"[\w]*", id, True) to merge( e.x) ground_1, ground_2, ground_3 -> ground) and set it to same object id.

And then I did response = airsim.ImageRequest("0", airsim.ImageType.Segmentation, False, False) img1d = np.fromstring(response.image_data_uint8, dtype=np.uint8) img_rgb = img1d.reshape(128, 256, 3) cv2.imwrite(os.path.normpath(filename + '.png'), img_rgb) to save my image as png form.

To check each pixel's labels in image, img_l = Image.open(filename + '.png').convert('L') print(np.array(img_l)[64])

But the result is different from what I set. I think it should be matched with object id.

My segmentation model uses the cityscapes dataset which is an 'L' type image. So I want to convert it as an 'L' type image.

Thanks

Context details

Include details of what you already did to find answers

sunilhoho avatar Aug 10 '21 05:08 sunilhoho

@sunilhoho any update regarding this?

sandilyasg avatar Feb 08 '24 17:02 sandilyasg