本文整理汇总了Python中tracker.Tracker方法的典型用法代码示例。如果您正苦于以下问题:Python tracker.Tracker方法的具体用法?Python tracker.Tracker怎么用?Python tracker.Tracker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracker
的用法示例。
在下文中一共展示了tracker.Tracker方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tracker [as 别名]
# 或者: from tracker import Tracker [as 别名]
def __init__(self, dht_addr, state_path, routing_m_mod, lookup_m_mod, private_dht_name):
message.private_dht_name = private_dht_name
self.state_filename = os.path.join(state_path, STATE_FILENAME)
self.load_state()
if not self._my_id:
self._my_id = identifier.RandomId()
self._my_node = Node(dht_addr, self._my_id)
self._tracker = tracker.Tracker()
self._token_m = token_manager.TokenManager()
self._reactor = ThreadedReactor()
self._reactor.listen_udp(self._my_node.addr[1], self._on_datagram_received)
self._querier = Querier(self._my_id)
bootstrap_nodes = self.loaded_nodes or BOOTSTRAP_NODES
del self.loaded_nodes
self._routing_m = routing_m_mod.RoutingManager(self._my_node, bootstrap_nodes)
self._lookup_m = lookup_m_mod.LookupManager(self._my_id)
current_time = time.time()
self._next_maintenance_ts = current_time
self._next_save_state_ts = current_time + SAVE_STATE_DELAY
self._running = False
示例2: trackerInstance
# 需要导入模块: import tracker [as 别名]
# 或者: from tracker import Tracker [as 别名]
def trackerInstance(url):
item = Tracker(url)
data = ItemData(url)
style.use("fivethirtyeight")
item.graph()
if item.compare_prices() == 'below':
print(f'{item.price()} < ${item.target_price}\n')
comms = Communication(item.title().strip(), url, item.price(), '$' + item.target_price)
comms.sendEmail()
comms.sendText()
data.delFile()
elif item.compare_prices() == 'above':
print(f'{item.price()} > ${item.target_price}\n')
elif item.compare_prices() == 'out-of-stock':
print(f'{item.price()} > ${item.target_price} - Item is out of stock\n')
示例3: __init__
# 需要导入模块: import tracker [as 别名]
# 或者: from tracker import Tracker [as 别名]
def __init__(self):
self.prev_flight_data = None
self.record = False
self.tracking = False
self.keydown = False
self.date_fmt = '%Y-%m-%d_%H%M%S'
self.speed = 50
self.drone = tellopy.Tello()
self.init_drone()
self.init_controls()
# container for processing the packets into frames
self.container = av.open(self.drone.get_video_stream())
self.vid_stream = self.container.streams.video[0]
self.out_file = None
self.out_stream = None
self.out_name = None
self.start_time = time.time()
# tracking a color
green_lower = (30, 50, 50)
green_upper = (80, 255, 255)
#red_lower = (0, 50, 50)
# red_upper = (20, 255, 255)
# blue_lower = (110, 50, 50)
# upper_blue = (130, 255, 255)
self.track_cmd = ""
self.tracker = Tracker(self.vid_stream.height,
self.vid_stream.width,
green_lower, green_upper)
示例4: main
# 需要导入模块: import tracker [as 别名]
# 或者: from tracker import Tracker [as 别名]
def main():
data = np.array(np.load('Detections.npy'))[0:10,0:150,0:150]
tracker = Tracker(150, 30, 5)
skip_frame_count = 0
track_colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0),
(127, 127, 255), (255, 0, 255), (255, 127, 255),
(127, 0, 255), (127, 0, 127),(127, 10, 255), (0,255, 127)]
for i in range(data.shape[1]):
centers = data[:,i,:]
frame = createimage(512,512)
if (len(centers) > 0):
tracker.update(centers)
for j in range(len(tracker.tracks)):
if (len(tracker.tracks[j].trace) > 1):
x = int(tracker.tracks[j].trace[-1][0,0])
y = int(tracker.tracks[j].trace[-1][0,1])
tl = (x-10,y-10)
br = (x+10,y+10)
cv2.rectangle(frame,tl,br,track_colors[j],1)
cv2.putText(frame,str(tracker.tracks[j].trackId), (x-10,y-20),0, 0.5, track_colors[j],2)
for k in range(len(tracker.tracks[j].trace)):
x = int(tracker.tracks[j].trace[k][0,0])
y = int(tracker.tracks[j].trace[k][0,1])
cv2.circle(frame,(x,y), 3, track_colors[j],-1)
cv2.circle(frame,(x,y), 6, track_colors[j],-1)
cv2.circle(frame,(int(data[j,i,0]),int(data[j,i,1])), 6, (0,0,0),-1)
cv2.imshow('image',frame)
# cv2.imwrite("image"+str(i)+".jpg", frame)
# images.append(imageio.imread("image"+str(i)+".jpg"))
time.sleep(0.1)
if cv2.waitKey(1) & 0xFF == ord('q'):
cv2.destroyAllWindows()
break
# imageio.mimsave('Multi-Object-Tracking.gif', images, duration=0.08)
示例5: addItem
# 需要导入模块: import tracker [as 别名]
# 或者: from tracker import Tracker [as 别名]
def addItem():
url = input('Item URL: ')
item = Tracker(url)
if ItemData(url).save() == 'already_exists':
print('Item is already being tracked!')
else:
print(f'\n{item.title().strip()} has been added to the tracking list!')
示例6: mainLoop
# 需要导入模块: import tracker [as 别名]
# 或者: from tracker import Tracker [as 别名]
def mainLoop():
while True:
option = input("""
--------------------------------------------
| Amazon Price Tracker v3.2 by Dennis Pham |
| |
| 1. Run tracker |
| 2. Add new item |
| 3. Delete an item |
| 4. List items |
| 5. Exit |
| |
--------------------------------------------
Option: """)
if option == '1':
trackerLoop()
elif option == '2':
addItem()
elif option == '3':
delItem()
elif option == '4':
print()
for item, link in listItems().items():
print(f'{item}: {link}')
elif option == '5':
exit()
else:
print('\nThis is not an option!')