Пример #1
0
    new_frames = []
    for frame in frames:
        tmp_frame = (((frame+fs)/float(2*fs))*255).astype(np.uint8)
        new_frames.append(tmp_frame)

    rgb_frames = []
    height = new_frames[0].shape[0]
    width = new_frames[0].shape[1]
    for frame in new_frames:
        temp_frame = np.zeros((height, width, 3))
        temp_frame[:, :, 0] = frame
        temp_frame[:, :, 1] = frame
        temp_frame[:, :, 2] = frame
        rgb_frames.append(temp_frame)
    new_frames = gui.draw_poly_box_sequence(rgb_frames, gt,
                                            color=[0, 0, 255])

    for i in xrange(len(new_frames)):
        img_name = join(seq_save_path, "%08d" % (i+1,)+".png")
        cv2.imwrite(img_name, new_frames[i])

    print("Sequence %s is saved at %s" % (vidseq, seq_save_path))
elif option == "vot-figure":
    vot_path = os.path.join(data_path, "vot2015")
    vot_stats_path = os.path.join(stats_path, "vot_stats.pkl")

    # load vot stats
    f = file(vot_stats_path, mode="r")
    vot_stats = pickle.load(f)
    f.close()
    vot_list = vot_stats['vot_list']
Пример #2
0
                                                          yaddr, pol,
                                                          window=1000)

frames, fs, _ = dvsproc.gen_dvs_frames(timestamps, xaddr, yaddr,
                                       pol, num_frames, fs=3)

print len(frames)

shift = helpers.cal_img_shift(origin_frame.shape, frames[0].shape)
ratio = helpers.cal_bound_box_ratio(gt, origin_frame.shape[0],
                                    origin_frame.shape[1])
new_pts = helpers.cal_bound_box_position(ratio,
                                         frames[0].shape[0]-shift[1],
                                         frames[0].shape[1]-shift[0])

new_pts[:, :, 0] += shift[0]/2.
new_pts[:, :, 1] += shift[1]/2.

new_frames = gui.draw_poly_box_sequence(frames, new_pts, color=[0, 255, 0])

# for i in xrange(len(new_frames)):
#     new_frames[i] = np.array(new_frames[i]/float(fs)*255., dtype=np.uint8)
#
# tools.create_image_sequence(new_frames, image_save_path, scg, form=".png")

for frame in new_frames:
    cv2.imshow("frame", (frame)/float(fs))
    key = cv2.waitKey(delay=0)

cv2.destroyAllWindows()
Пример #3
0
    pol = db[vidseq]["pol"][()]
    bounding_box = db[vidseq]["bounding_box"][()]
    gt = bounding_box[:, 1:]
    gt = np.reshape(gt, (gt.shape[0], 4, 2))
    (timestamps, x_pos,
     y_pos, pol) = dvsproc.clean_up_events(timestamps, x_pos,
                                           y_pos, pol, window=1000)

    frames, fs, _ = dvsproc.gen_dvs_frames(timestamps, x_pos, y_pos,
                                           pol, num_frames, fs=5)

    new_frames = []
    for frame in frames:
        new_frames.append(frame+fs)

    new_frames = gui.draw_poly_box_sequence(new_frames, gt,
                                            color=[0, 255, 0])

    for frame in new_frames:
        cv2.imshow("frame", (frame)/float(2*fs))
        key = cv2.waitKey(delay=30)

cv2.destroyAllWindows()


# For Tracking Dataset

# # paths
# db_name = "TrackingDataset"
# save_path = "./data"
# tracking_path = "./data/tracking_recordings_30fps/"
# tracking_stats_path = "./data/tracking_stats.pkl"
Пример #4
0
    new_frames = []
    for frame in frames:
        tmp_frame = (((frame + fs) / float(2 * fs)) * 255).astype(np.uint8)
        new_frames.append(tmp_frame)

    rgb_frames = []
    height = new_frames[0].shape[0]
    width = new_frames[0].shape[1]
    for frame in new_frames:
        temp_frame = np.zeros((height, width, 3))
        temp_frame[:, :, 0] = frame
        temp_frame[:, :, 1] = frame
        temp_frame[:, :, 2] = frame
        rgb_frames.append(temp_frame)
    new_frames = gui.draw_poly_box_sequence(rgb_frames, gt, color=[0, 0, 255])

    for i in xrange(len(new_frames)):
        img_name = join(seq_save_path, "%08d" % (i + 1, ) + ".png")
        cv2.imwrite(img_name, new_frames[i])

    print("Sequence %s is saved at %s" % (vidseq, seq_save_path))
elif option == "vot-figure":
    vot_path = os.path.join(data_path, "vot2015")
    vot_stats_path = os.path.join(stats_path, "vot_stats.pkl")

    # load vot stats
    f = file(vot_stats_path, mode="r")
    vot_stats = pickle.load(f)
    f.close()
    vot_list = vot_stats['vot_list']
Пример #5
0
                                                          yaddr, pol,
                                                          window=1000)

frames, fs, _ = dvsproc.gen_dvs_frames(timestamps, xaddr, yaddr,
                                       pol, num_frames, fs=3)

print len(frames)

shift = helpers.cal_img_shift(origin_frame.shape, frames[0].shape)
ratio = helpers.cal_bound_box_ratio(gt, origin_frame.shape[0],
                                    origin_frame.shape[1])
new_pts = helpers.cal_bound_box_position(ratio,
                                         frames[0].shape[0]-shift[1],
                                         frames[0].shape[1]-shift[0])

new_pts[:, :, 0] += shift[0]/2.
new_pts[:, :, 1] += shift[1]/2.

new_frames = gui.draw_poly_box_sequence(frames, new_pts, color=[0, 255, 0])

# for i in xrange(len(new_frames)):
#     new_frames[i] = np.array(new_frames[i]/float(fs)*255., dtype=np.uint8)
#
# tools.create_image_sequence(new_frames, image_save_path, scg, form=".png")

for frame in new_frames:
    cv2.imshow("frame", (frame)/float(fs))
    key = cv2.waitKey(delay=0)

cv2.destroyAllWindows()