diff --git a/jsk_perception/launch/classification.launch b/jsk_perception/launch/classification.launch index 7b8852ac78..fbf14fae0e 100644 --- a/jsk_perception/launch/classification.launch +++ b/jsk_perception/launch/classification.launch @@ -5,6 +5,7 @@ + @@ -14,6 +15,7 @@ host: $(arg host) port: $(arg port) + image_transport: $(arg image_transport) diff --git a/jsk_perception/launch/vqa.launch b/jsk_perception/launch/vqa.launch index a1e1ccfc69..32b3988b4b 100644 --- a/jsk_perception/launch/vqa.launch +++ b/jsk_perception/launch/vqa.launch @@ -5,6 +5,7 @@ + @@ -14,6 +15,7 @@ host: $(arg host) port: $(arg port) + image_transport: $(arg image_transport) diff --git a/jsk_perception/src/jsk_perception/vil_inference_client.py b/jsk_perception/src/jsk_perception/vil_inference_client.py index 212334f1b3..02026af4ff 100644 --- a/jsk_perception/src/jsk_perception/vil_inference_client.py +++ b/jsk_perception/src/jsk_perception/vil_inference_client.py @@ -39,13 +39,27 @@ def __init__(self, action, # default inference image self.default_img = None # ROS - self.image_sub = rospy.Subscriber("~image", Image, - callback=self.topic_cb, - queue_size=1, - buff_size=2**26) + self.transport_hint = rospy.get_param('~image_transport', 'raw') + if self.transport_hint == 'compressed': + self.image_sub = rospy.Subscriber( + "{}/compressed".format(rospy.resolve_name('~image')), + CompressedImage, + callback=self.topic_cb, + queue_size=1, + buff_size=2**26 + ) + + else: + self.image_sub = rospy.Subscriber("~image", Image, + callback=self.topic_cb, + queue_size=1, + buff_size=2**26) self.result_topic_type = result_topic self.result_pub = rospy.Publisher("~result", result_topic, queue_size=1) - self.image_pub = rospy.Publisher("~result/image", Image, queue_size=1) + if self.transport_hint == 'compressed': + self.image_pub = rospy.Publisher("~result/image/compressed", CompressedImage, queue_size=1) + else: + self.image_pub = rospy.Publisher("~result/image", Image, queue_size=1) self.vis_pub = rospy.Publisher("~visualize", String, queue_size=1) self.action_server = actionlib.SimpleActionServer("~inference_server", action,