本文整理汇总了Python中track.Track.update方法的典型用法代码示例。如果您正苦于以下问题:Python Track.update方法的具体用法?Python Track.update怎么用?Python Track.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类track.Track
的用法示例。
在下文中一共展示了Track.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createNewTracks
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import update [as 别名]
def createNewTracks(self, detections, unmatchedDetections):
for detectionIndex in unmatchedDetections:
detection = detections[detectionIndex]
array_detection = np.array(detection, np.float32)
# TODO: Create Kalman filter object
kf = cv2.KalmanFilter(4, 2)
kf.measurementMatrix = MEASUREMENT_MATRIX
kf.transitionMatrix = TRANSITION_MATRIX
# kf.processNoiseCov = PROCESS_NOISE_COV
# Create the new track
newTrack = Track(self.nextTrackID, kf)
newTrack.update(array_detection)
newTrack.locationHistory.append(detection)
self.tracks.append(newTrack)
self.nextTrackID += 1
示例2: Race
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import update [as 别名]
class Race(object):
def __init__(self, window, track_num, characters, laps=3):
self.window = window
self.track = Track(window, self, track_num)
self.racers = []
self.laps = laps
self.time = 0. # current time in the race (will be set to 0 when the first racer starts)
# the time counter
self.time_label = pyglet.text.Label(color=(230, 230, 230, 255), bold=True, batch=window.batch)
self.time_label.x = 10
self.time_label.y = self.window.height - 30
for i, char in enumerate(characters):
self.racers.append(Racer(self, i, char))
self.player1 = self.racers[0]
if len(self.racers) >= 2:
self.player2 = self.racers[1]
else:
self.player2 = None
self.particles = [] # list of moving objects other than cars
def update(self, dt):
self.racers.sort() # sort racers according to progression
self.time += dt
int_time = int(self.time * 100)
minutes = int_time / 6000
seconds = (int_time / 100) % 60
hundredths = int_time % 100
self.time_label.text = "Time: %02d' %02d\" %02d" % (minutes, seconds, hundredths)
for p in self.particles:
p.update(dt)
for r in self.racers:
r.update(dt)
self.track.update(dt)
self.window.ui.update()