Example #1
0
    def draw_and_send(self):
        self.classify()
        img = cv.CloneMat(self.feature_extractor.image_cv)
        #draw classified points.
        colors = {r3d.POSITIVE: [0,255,0], r3d.NEGATIVE: [0,0,255]}
        r3d.draw_labeled_points(img, self.classified_dataset)

        #draw labeled data. 
        r3d.draw_labeled_points(img, self.dataset, colors[r3d.POSITIVE], colors[r3d.NEGATIVE])

        #draw latest addition and its label. 
        r3d.draw_points(img, self.last_added['pt'], colors[self.last_added['l']], 4)

        self.image_pub.publish(img, self.feature_extractor.calibration_obj)
Example #2
0
    def draw_and_send(self):
        self.classify()
        img = cv.CloneMat(self.feature_extractor.image_cv)
        #draw classified points.
        colors = {r3d.POSITIVE: [0, 255, 0], r3d.NEGATIVE: [0, 0, 255]}
        r3d.draw_labeled_points(img, self.classified_dataset)

        #draw labeled data.
        r3d.draw_labeled_points(img, self.dataset, colors[r3d.POSITIVE],
                                colors[r3d.NEGATIVE])

        #draw latest addition and its label.
        r3d.draw_points(img, self.last_added['pt'],
                        colors[self.last_added['l']], 4)

        self.image_pub.publish(img, self.feature_extractor.calibration_obj)
roslib.load_manifest("hai_sandbox")
import rospy

import hai_sandbox.recognize_3d as r3d
import hrl_lib.util as ut
import cv
import sys

fname = sys.argv[1]
pkl = ut.load_pickle(fname)
image_name = pkl["image"]
img = cv.LoadImageM(image_name)

# Draw the center
r3d.draw_points(img, pkl["center"], [255, 0, 0], 6, 2)

if pkl.has_key("pos"):
    pos_exp = pkl["pos"]
    neg_exp = pkl["neg"]
    # Draw points tried
    r3d.draw_points(img, pos_exp, [50, 255, 0], 9, 1)
    r3d.draw_points(img, neg_exp, [50, 0, 255], 9, 1)

if pkl.has_key("pos_pred"):
    pos_pred = pkl["pos_pred"]
    neg_pred = pkl["neg_pred"]
    # Draw prediction
    r3d.draw_points(img, pos_pred, [255, 204, 51], 3, -1)
    r3d.draw_points(img, neg_pred, [51, 204, 255], 3, -1)