In the meanwhile and just for showing the segmentation in rviz or rqt, you can use the script attached in the next post:
Use the following callback (32SC1 to 16UC1) if you have more than 256 instances
def republish_image(image):
global min_value, max_value
array = np.frombuffer(image.data, dtype=np.float32).reshape(image.height, image.width, -1)
min_value = min(np.min(array).item(), min_value) if UPDATE_MIN else min_value
max_value = max(np.max(array).item(), max_value) if UPDATE_MAX else max_value
array = np.clip((array - min_value) / (max_value - min_value + sys.float_info.min) * 65535, 0, 65535)
image.data = array.astype(np.uint16).tobytes()
image.encoding = "mono16"
pub.publish(image)