Problem Listener with [closed]
Good morning people
I did a listener for the camera/image_raw node republish (camera/image_test, but the following error appears: Client [/ QR_Listener_5598_1492006578702] wants topic /camera/image_test to have datatype/md5sum [std_msgs /String/992ce8a1687cec8c8bd883ec73ca41d1], but our version has [sensor_msgs/Image/060021388200f6f0f447d0fcd9c64743]. Dropping connection.
Follow the listener code:
#!/usr/bin/env python
import rospy
import cv2
import zbar
from std_msgs.msg import String
from PIL import Image
def callback(data):
scanner = zbar.ImageScanner()
scanner.parse_config('enable')
while not rospy.is_shutdown():
ret, output = data.read()
if not ret:
continue
gray = cv2.cvtColor(output, cv2.COLOR_BGR2GRAY, dstCn=0)
pil = Image.fromarray(gray)
width, height = pil.size
raw = pil.tobytes()
image = zbar.Image(width, height, 'Y800', raw)
scanner.scan(image)
qrc = None
for symbol in image:
print '"%s"' % symbol.data
qrc = symbol.data
qrc
cv2.imshow("#Qr Code", output)
if qrc != None:
rospy.loginfo(rospy.get_caller_id() + "Qr Code %s:", data.data)
def listener():
rospy.init_node('QR_Listener', anonymous=True)
rospy.Subscriber("/camera/image_test", String, callback)
rospy.spin()
if __name__ == '__main__':
try:
listener()
except rospy.ROSInterruptException:
pass