ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your lines is a numpy array of x,y coordinates for the lines the hough transform found and not an image. You cannot visualise that using

cv2.imshow("image",lines)

try

cv2.imshow("image",cv_image)

which is what you draw the lines on anyway with

cv2.line(cv_image,(x1,y1),(x2,y2),(0,255,0),2)

Your lines is a numpy array of x,y coordinates for the lines the hough transform found and not an image. You cannot visualise that using

cv2.imshow("image",lines)

try

cv2.imshow("image",cv_image)

which is what you draw the lines on anyway with

cv2.line(cv_image,(x1,y1),(x2,y2),(0,255,0),2)

EDIT:

Also if you want real-time, you want to add a queue_size=1 to your subscriber to prevent the lag and get real-time results. Otherwise the image you produce will always be lagging behind the input image.

self.image_sub = rospy.Subscriber("/camera/rgb/image_color", Image, self.callback, queue_size=1)