3 from __future__
import absolute_import
4 from __future__
import division
5 from __future__
import print_function
10 from jsk_topic_tools
import ConnectionBasedTransport
12 from sensor_msgs.msg
import Image
18 super(self.__class__, self).
__init__()
19 self.
pub = self.advertise(
'~output', Image, queue_size=1)
28 if msg.height * msg.width == 0:
30 bridge = cv_bridge.CvBridge()
31 img_16uc1 = bridge.imgmsg_to_cv2(msg, desired_encoding=
'16UC1')
32 img_32fc1 = (img_16uc1.astype(np.float64) / (2**16)).astype(np.float32)
33 out_msg = bridge.cv2_to_imgmsg(img_32fc1,
'32FC1')
34 out_msg.header = msg.header
35 self.pub.publish(out_msg)
38 if __name__ ==
'__main__':
39 rospy.init_node(
'image_16uc1_to_32fc1')