ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Okay so here it goes! I followed the solution by @E1000ii given here and it worked
I am copy-pasting my changed code, based on the solution provided above:
28 def callbackDepth(self, data):
29 print "all is well"
30 try:
31 NewImg = self.CvImg.imgmsg_to_cv2(data,"passthrough")
32 depth_array = np.array(NewImg, dtype=np.float32)
33 cv2.normalize(depth_array, depth_array, 0, 1, cv2.NORM_MINMAX)
34 print data.encoding
35 print
36 cv2.imwrite("depth.png", depth_array*255)
37 except CvBridgeError as e:
38 print(e)
2 | No.2 Revision |
Okay so here it goes! I followed the solution by @E1000ii given here and it worked
I am copy-pasting my changed code, based on the solution provided above:
28 def callbackDepth(self, data):
29 print "all is well"
30 try:
31 NewImg = self.CvImg.imgmsg_to_cv2(data,"passthrough")
32 self.CvImg.imgmsg_to_cv2(data, "passthrough")
depth_array = np.array(NewImg, dtype=np.float32)
33 cv2.normalize(depth_array, depth_array, 0, 1, cv2.NORM_MINMAX)
34 print data.encoding
35 print
36 cv2.imwrite("depth.png", depth_array*255)
37 depth_array*255)
except CvBridgeError as e:
38 print(e)