Python dlib 模块,correlation_tracker() 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用dlib.correlation_tracker()

项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def correlation_tracker(self):
        flag = time.time()
        for track in self.tracks:
            if track.source == 'tracking':
                if track.updated:
                                        print '===!!!==='
                                        print 'Track updated!!!'
                    # use .start_tracking method
                    track.tracker.start_track(self.img, \
                        dlib.rectangle(*track.updatebox))
                    track.updated = False
                else:
                    # use .update method
                    track.tracker.update(self.img)

                        rect = track.tracker.get_position()
                        track.bbox = [int(rect.left()),\
                              int(rect.top()), \
                              int(rect.right()),\
                              int(rect.bottom())]

                                print 'Track one frame', time.time()-flag
                        else:
                # do nothing
                pass
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def timer(self):
        """docstring for timer"""
        if self.RUN:
            # print 'New Frame', self.idx
            flag = time.time()

            self.readIMG() # read new frame
            self.correlation_tracker() # update correlation_tracker(s)
            # self.display() # display img and boxes

            self.checkState()
            self.singleLog()
            # self.log()
            time_consumed = time.time() - flag
            if time_consumed > 0.04:
                print 'Time > 40 ms!'
                Timer(0, self.timer).start() # excuted instantly
            else:
                Timer(0.04 - time_consumed, self.timer).start() # excute this function every 40 ms

        return
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def correlation_tracker(self):
        """docstring for correlation_tracker"""
        for track in self.tracks:
            if track.USE_CT:
                assert self.img != None
                assert self.img_old != None
                track.CT_run(self.img, self.img_old, self.img_last) # update tracks

        return
项目:video_labeler    作者:hahnyuan    | 项目源码 | 文件源码
def __init__(self):
        self.t=dlib.correlation_tracker()
项目:experimenting-with-sort    作者:ZidanMusk    | 项目源码 | 文件源码
def __init__(self,bbox,img):
    self.tracker = correlation_tracker()
    self.tracker.start_track(img,rectangle(long(bbox[0]),long(bbox[1]),long(bbox[2]),long(bbox[3])))
    self.confidence = 0. # measures how confident the tracker is! (a.k.a. correlation score)

    self.time_since_update = 0
    self.id = CorrelationTracker.count
    CorrelationTracker.count += 1
    self.hits = 0
    self.hit_streak = 0
    self.age = 0
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def initTracker(self):
        return dlib.correlation_tracker()
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def timer(self):
            if self.idx < 100:
                self.idx += 1
                self.oldimg = self.img
                        # print imdb_path+'/%04d'%self.idx
                self.img = cv2.imread(imdb_path+'/%04d.jpg'%self.idx)
                        assert self.img != None
                        # print self.idx
                        self.correlation_tracker()
                Timer(0.04, self.timer).start()
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def createNewTracks(self, unassignedDetections, detection):
        global tracker_id
                print detection
                print unassignedDetections
        bboxes = detection[unassignedDetections,:]
        n = bboxes.shape[0]

        for i in xrange(n):
            bbox = bboxes[i,:].tolist()
            track = Track(tracker_id, bbox, dlib.correlation_tracker())
            tracker_id += 1
            self.tracks.append(track)

                        # delete below!!!
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def _CT_init(self):
        CT = dlib.correlation_tracker()
        return CT
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def correlation_tracker(self):
        """docstring for correlation_tracker"""
        for track in self.tracks:
            if track.USE_CT:
                assert self.img != None
                assert self.img_old != None
                track.CT_run(self.img, self.img_old) # update tracks

        return
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def _CT_init(self):
        CT = dlib.correlation_tracker()
        return CT
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def correlation_tracker(self):
        """docstring for correlation_tracker"""
        for track in self.tracks:
            if track.USE_CT:
                assert self.img != None
                assert self.img_old != None
                track.CT_run(self.img, self.img_old) # update tracks

        return
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def _CT_init(self):
        CT = dlib.correlation_tracker()
        return CT
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def correlation_tracker(self):
        """docstring for correlation_tracker"""
        for track in self.tracks:
            if track.USE_CT:
                assert self.img != None
                assert self.img_old != None
                track.CT_run(self.img, self.img_old) # update tracks

        return
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def _CT_init(self):
        CT = dlib.correlation_tracker()
        return CT
项目:CTT    作者:ZhouYzzz    | 项目源码 | 文件源码
def timer(self):
        """docstring for timer"""
        if self.RUN:
            # print 'New Frame', self.idx
            flag = time.time()

            self.readIMG() # read new frame
            self.correlation_tracker() # update correlation_tracker(s)
            # self.display() # display img and boxes

            self.checkState()
            self.singleLog()
            # self.log()
            time_consumed = time.time() - flag
            if time_consumed > 0.04:
                print 'Time > 40 ms!'
                Timer(0, self.timer).start() # excuted instantly
            else:
                Timer(0.04 - time_consumed, self.timer).start() # excute this function every 40 ms

        return

    # def buildLogPath(self):
    #     if not os.path.exists(self.logPath):
    #         os.makedirs(self.logPath)
            # print 'Path Build', self.logPath