0
$\begingroup$

Rosanswers logo

I need to process the data from a webcam (i used USB_CAM Package).

Initially I created a listener that from the topic "/usb_cam/image_raw" extrapolates the array uint8 [] data ... but ...

Here's the python code:

# / usr / bin / env python
import roslib; roslib.load_manifest ('webcam_image')

import rospy
Image import from sensor_msgs.msg

def callback (date):
     print "I heard% s"% str (Image.data)
       
def listener ():
     rospy.init_node ('read_data', anonymous = True)

     rospy.Subscriber ("usb_cam / image_raw", Image, callback)

     rospy.spin ()
        
if __ name__ == '__main__':
     listener ()

And there the output on the shell when I start:

I heard < member'data' of'Image' objects>

If i write:

rostopic echo /usb_cam/image_raw

appears correctly:

header:
  seq: 491
  stamp:
    secs: 1372323952
    nsecs: 364679466
  frame_id: usb_cam
height: 4
width: 4
encoding: rgb8
is_bigendian: 0
step: 12
data: [103, 111, 98, 104, 112, 99, 102, 110, 104, 103, 111, 105, 100, 112, 100, 101, 113, 101, 103, 109, 107, 102, 108, 106, 101, 108, 108, 102, 109, 109, 102, 109, 109, 102, 109, 109, 103, 110, 102, 102, 109, 101, 105, 113, 100, 100, 108, 95]

What could be wrong?


Originally posted by MarcoTe6 on ROS Answers with karma: 1 on 2013-06-26

Post score: 0


Original comments

Comment by MarcoTe6 on 2013-06-28:
I've to send image data to LabVIEW via Rosbridge and Clearpath Toolkit. The problem is that the image is not well understood in the passage, so i'm trying to process the image data to transform the array in a string, and send it by a specific topic. But first i'm to extract data from Image.msg

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

What is the problem exactly? ROS uses an imagetransport method for images, not a regular topic. Images can be viewed using rosrun image_view image_view image:=/usb_cam/image_raw


Originally posted by davinci with karma: 2573 on 2013-06-26

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.