Skip to content

Instantly share code, notes, and snippets.

@marjinal1st
Created April 26, 2015 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marjinal1st/d8a4d31777ec3ddad643 to your computer and use it in GitHub Desktop.
Save marjinal1st/d8a4d31777ec3ddad643 to your computer and use it in GitHub Desktop.
ROS Camera Test
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
import cv2
from sensor_msgs.msg import Image
from cv_bridge import *
def callback(msg):
bridge = CvBridge()
image = bridge.imgmsg_to_cv2(msg, "bgr8")
cv2.imshow("test", image)
cv2.waitKey(1)
def main():
rospy.init_node("camera_test")
camera = rospy.Subscriber("/rrbot/camera1/image_raw",
Image,
callback,
queue_size=10)
rospy.spin()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment