show_image.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 # Aug 9: This won't work any more with the db changes
00004 
00005 import roslib
00006 roslib.load_manifest('semanticmodel')
00007 
00008 import rospy
00009 import sys
00010 import mongo_ros as mr
00011 import sensor_msgs.msg as sm
00012 
00013 rospy.init_node('show_image')
00014 pub = rospy.Publisher('image', sm.Image, latch=True)
00015 
00016 db = 'world_model' if len(sys.argv)<3 else sys.argv[2]
00017 c = mr.MessageCollection(db, 'images', sm.Image)
00018 
00019 print("Blob ids are {0}".
00020     format(sorted([m['cluster_id'] for m in c.query({}, metadata_only=True)])))
00021 if len(sys.argv)>1:
00022     print("Publishing blob {0}".format(sys.argv[1]))
00023     img = next(c.query({'cluster_id': int(sys.argv[1])}))[0]
00024     pub.publish(img)
00025     rospy.sleep(2.0)
00026 else:
00027     print "Usage: {0} BLOB_ID".format(sys.argv[0])
00028 


semanticmodel
Author(s): Julian ("Mac") Mason
autogenerated on Thu Dec 12 2013 12:39:10