5 from jsk_recognition_msgs.msg
import ClusterPointIndices
6 from jsk_topic_tools
import ConnectionBasedTransport
9 from sensor_msgs.msg
import Image
14 super(ImageClusterIndicesDecomposer, self).
__init__()
15 self.
_pub = self.advertise(
'~output', Image, queue_size=1)
21 use_async = rospy.get_param(
'~approximate_sync',
False)
22 queue_size = rospy.get_param(
'~queue_size', 100)
25 slop = rospy.get_param(
'~slop', 0.1)
26 sync = message_filters.ApproximateTimeSynchronizer(
27 subs, queue_size, slop)
33 self._sub.unregister()
34 self._sub_cpi.unregister()
37 bridge = cv_bridge.CvBridge()
38 img = bridge.imgmsg_to_cv2(imgmsg, desired_encoding=
'rgb8')
40 from jsk_recognition_utils
import colorize_cluster_indices
41 cluster_indices = [list(i_msg.indices)
42 for i_msg
in cpi_msg.cluster_indices]
43 out = colorize_cluster_indices(img, cluster_indices)
45 out_msg = bridge.cv2_to_imgmsg(out, encoding=
'rgb8')
46 out_msg.header = imgmsg.header
47 self._pub.publish(out_msg)
50 if __name__ ==
'__main__':
51 rospy.init_node(
'image_cluster_indices_decomposer')
def _decompose(self, imgmsg, cpi_msg)