Example #1
0
    def __init__(self, cfg=None):
        # Track Stack
        self.tracks = []
        self.trackerID = 0
        # Image
        self.img = None
        self.img_old = None
        self.idx = 1
        self.idx_old = 1
        # Status
        self.RUN = True
        from readGroundTruth import readGT
        self.GT = readGT(imdb_name)
        # Constants
        self.costOfNonAssignment = 70
        self.time = time.strftime('%Y-%m-%d-%H:%M:%S', time.gmtime())
        self.logPath = this_file_path + '/log/' + self.time

        self.logArray = np.zeros([0, 5])
        self.groundTruth = self.readGroundTruth()
Example #2
0
    def __init__(self, cfg=None):
        # Track Stack
        self.tracks = []
        self.trackerID = 0
        # Image
        self.img = None
        self.img_old = None
        self.idx = 1
        self.idx_old = 1
        # Status
        self.RUN = True
        from readGroundTruth import readGT
        self.GT = readGT(imdb_name)
        # Constants
        self.costOfNonAssignment = 70
        self.time = time.strftime('%Y-%m-%d-%H:%M:%S', time.gmtime())
        self.logPath = this_file_path+'/log/'+self.time

        self.logArray = np.zeros([0,5])
        self.groundTruth = self.readGroundTruth()
# imdb_name = 'car'
imdb_path = os.path.join(this_file_path, '../vot2014', imdb_name)

print 'IMG path:', imdb_path
assert os.path.exists(imdb_path)
_, _, files = os.walk(imdb_path).next()
img_count = len(files) - 7
print 'IMG count:', img_count

import numpy as np
all_gt = np.loadtxt(imdb_path+'/groundtruth.txt',delimiter=',')
gt = all_gt[0].astype(np.int)
initbox = [gt[2],gt[3],gt[6],gt[7]]
print initbox

GT = readGT(imdb_name)

for idx in xrange(0,img_count):
    # print 'Frame', idx + 1
    img = cv2.imread(imdb_path+'/%08d.jpg'%(idx+1))
    # print img.shape
    assert img != None
    try:
        tracker
    except NameError:
        tracker = dlib.correlation_tracker()
        tracker.start_track(img, dlib.rectangle(*initbox))

    tracker.update(img)

    rect = tracker.get_position()