You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When collecting demo, i can get the one-channel mask image. It seems like each mask value corresponding to a specific object. But how I can I find the correspondence map, like 145 corresponding to the pencil?
The text was updated successfully, but these errors were encountered:
hanyangyu1021
changed the title
How to get Mask value of a object
How to get Mask value of an object
Jan 14, 2025
def get_mask(sensor: VisionSensor, mask_fn):
mask = None
if sensor is not None:
sensor.handle_explicitly()
mask = mask_fn(sensor.capture_rgb())
return mask
def rgb_handles_to_mask(rgb_coded_handles):
# rgb_coded_handles should be (w, h, c)
# Handle encoded as : handle = R + G * 256 + B * 256 * 256
# If reading from a PIL image, the values will already be on the
# range [0, 255] and uint8. However, if rgb_coded_handles is read directly from
# a sensor, it will be on the range [0, 1].
if rgb_coded_handles.dtype != np.uint8:
rgb_coded_handles *= 255 # takes rgb range to 0 -> 255
rgb_coded_handles.astype(int)
return (rgb_coded_handles[:, :, 0] +
rgb_coded_handles[:, :, 1] * 256 +
rgb_coded_handles[:, :, 2] * 256 * 256)
When collecting demo, i can get the one-channel mask image. It seems like each mask value corresponding to a specific object. But how I can I find the correspondence map, like 145 corresponding to the pencil?
The text was updated successfully, but these errors were encountered: