本文整理汇总了Python中tracker.Tracker.track方法的典型用法代码示例。如果您正苦于以下问题:Python Tracker.track方法的具体用法?Python Tracker.track怎么用?Python Tracker.track使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracker.Tracker
的用法示例。
在下文中一共展示了Tracker.track方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ObjectTracker
# 需要导入模块: from tracker import Tracker [as 别名]
# 或者: from tracker.Tracker import track [as 别名]
class ObjectTracker(OpenCVVideoFilter):
__gstmetadata__ = (
"Object tracker plugin",
"newelement",
"Description",
"Contact")
def __init__(self):
super(ObjectTracker, self).__init__()
self.tracker = Tracker([self.h, self.w])
self.api = GstVideo.VideoRegionOfInterestMeta.get_info()
def do_transform(self, b, outbuffer):
img = self.gst_to_cv(b)
ts = time.time()
self.tracker.track(ts, img)
tag_list = Gst.TagList.new_empty()
for t in self.tracker.to_log():
blob = t.bestblob()
info = Gst.Structure.new_empty('roi')
info.set_value('id', t.id)
info.set_value('ts', ts)
info.set_value('bbox', blob.bbox )
sample = Gst.Sample.new(b, None, None, info)
logging.debug('new tag with object track info for track %s',str(t.id))
tag_list.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_APPLICATION_DATA, sample)
if tag_list.n_tags()>0:
outbuffer.add_meta(self.api, tag_list)
self.post_message(Gst.Message.new_tag(self, tag_list))
return Gst.FlowReturn.OK
示例2: __init__
# 需要导入模块: from tracker import Tracker [as 别名]
# 或者: from tracker.Tracker import track [as 别名]
class Main:
def __init__(self, trackerUrl, trackerPass):
self.tracker = Tracker(trackerUrl, trackerPass)
def packetHandler(self, aprsString):
print 'APRS String: %s' % aprsString
packet = APRSPacket()
if packet.parse(aprsString):
print '%s -> %s' % (packet.source, packet.dest)
print 'Report type: %s' % packet.reportType
if packet.hasLocation:
print 'Time: %sZ' % packet.time
print 'Coordinates: %f, %f, Altitude: %d ft' % (packet.latitude, packet.longitude, packet.altitude)
print 'Course: %d, Speed: %d kn, Bearing: %d' % (packet.course, packet.speed, packet.bearing)
print 'Comment: %s' % packet.comment
print 'Uploading to tracker'
self.tracker.track(packet)
print ''
示例3: RuntimeError
# 需要导入模块: from tracker import Tracker [as 别名]
# 或者: from tracker.Tracker import track [as 别名]
"-c",
"--config",
action="store",
dest="config",
type="str",
help="Config file, default %default",
default="./config.ini")
options, args = parser.parse_args()
if not os.path.isfile(options.config):
raise RuntimeError('Given config file was not found')
config = Config()
config.read(options.config)
logger = build_logger(config.fetch('logs_dir'), logging.DEBUG)
app = Tracker(config, logger)
app.track()
except KeyboardInterrupt as e:
if logger is not None:
logger.info('Tracker stopped by user. PID: {0}'.format(os.getpid()))
else:
print 'Tracker stopped by user. PID: {0}'.format(os.getpid())
except Exception as e:
if logger is not None:
logger.critical(e.message, exc_info=True)
else:
print traceback.format_exc()
示例4: subtractor
# 需要导入模块: from tracker import Tracker [as 别名]
# 或者: from tracker.Tracker import track [as 别名]
# initialize a background subtractor (can be one of "absdiff", "simple", or "mog2")
backSubtrType = "absdiff"
backgroundSubtractor = BackgroundSubtractor(backSubtrType, counter)
if config.logger.isEnabledFor(logging.DEBUG):
config.logger.debug("Initialized %s background subtractor", backSubtrType)
# keep on tracking until consecutive 100 exceptions are encountered
errorCount = 0
while True:
trackerType = "single"
tracker = Tracker(trackerType, backgroundSubtractor)
if config.logger.isEnabledFor(logging.DEBUG):
config.logger.debug("Initialized %s tracker", trackerType)
try:
return_code = tracker.track(counter)
if config.logger.isEnabledFor(logging.DEBUG):
config.logger.debug("Tracker returned code [%s]", return_code)
if return_code is config.NO_MORE_FRAMES:
if config.logger.isEnabledFor(logging.INFO):
config.logger.info("No more frames to analyze. Exiting.")
sys.exit()
except Exception as e:
if config.logger.isEnabledFor(logging.WARN):
config.logger.warn("Encountered exception in tracking: %s", e)
errorCount += 1
if errorCount > 100:
if config.logger.isEnabledFor(logging.ERROR):