Hi,
May I ask that why I have an error message “Traceback (most recent call last):
File “RSrosMethod2V1.py”, line 81, in
depthCentre = init.showDepth_analysis()
File “RSrosMethod2V1.py”, line 39, in showDepth_analysis
depth_image = bridge.imgmsg_to_cv2(self.showDepth, “passthrough”)
File “/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py”, line 163, in imgmsg_to_cv2
dtype, n_channels = self.encoding_to_dtype_with_channels(img_msg.encoding)
AttributeError: ‘NoneType’ object has no attribute ‘encoding’”
The code related is:
class MyDistance:
def init(self):
self.showDepth = None
self.depthImage_sub = rospy.Subscriber("/camera/aligned_depth_to_color/image_raw",Image, self.showDepth_callback, queue_size=1, buff_size=2**24)
def showDepth_callback(self,data):
self.showDepth = data
def showDepth_analysis(self): depth_image = bridge.imgmsg_to_cv2(self.showDepth, “passthrough”)
Thank you for reading this post, and I really unable to identify the mistake in the program, any help is appreciated