plot_classification_pickle.py
Go to the documentation of this file.
00001 import roslib; roslib.load_manifest('hai_sandbox')
00002 import rospy
00003 
00004 import hai_sandbox.recognize_3d as r3d
00005 import hrl_lib.util as ut
00006 import cv
00007 import sys
00008 
00009 fname = sys.argv[1]
00010 pkl = ut.load_pickle(fname)
00011 image_name = pkl['image']
00012 img = cv.LoadImageM(image_name)
00013 
00014 #Draw the center
00015 r3d.draw_points(img, pkl['center'], [255, 0, 0], 6, 2)
00016 
00017 if pkl.has_key('pos'):
00018     pos_exp = pkl['pos']
00019     neg_exp = pkl['neg']
00020     #Draw points tried
00021     r3d.draw_points(img, pos_exp, [50, 255, 0], 9, 1)
00022     r3d.draw_points(img, neg_exp, [50, 0, 255], 9, 1)
00023 
00024 if pkl.has_key('pos_pred'):
00025     pos_pred = pkl['pos_pred']
00026     neg_pred = pkl['neg_pred']
00027     #Draw prediction 
00028     r3d.draw_points(img, pos_pred, [255, 204, 51], 3, -1)
00029     r3d.draw_points(img, neg_pred, [51, 204, 255], 3, -1)
00030 
00031 
00032 #Draw what we're selecting
00033 tried_point, label = pkl['tried']
00034 if label == r3d.POSITIVE:
00035     color = [0,255,0]
00036 else:
00037     color = [0,0,255]
00038 r3d.draw_points(img, tried_point, color, 8, -1)
00039 
00040 cv.NamedWindow('task relevant learner display', cv.CV_WINDOW_AUTOSIZE)
00041 cv.ShowImage('task relevant learner display', img)
00042 while True:
00043     cv.WaitKey(33)


hai_sandbox
Author(s): Hai Nguyen
autogenerated on Wed Nov 27 2013 11:46:56