当前位置: 首页>>代码示例>>Python>>正文


Python Tracker.track方法代码示例

本文整理汇总了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
开发者ID:MirichST,项目名称:patchcap,代码行数:34,代码来源:objecttracker.py

示例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 ''
开发者ID:akarpenko,项目名称:APRS2Tracker,代码行数:22,代码来源:aprs2tracker.py

示例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()
开发者ID:abogdan,项目名称:licenta,代码行数:32,代码来源:app.py

示例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):
开发者ID:seerpod,项目名称:seerpod-hardware,代码行数:33,代码来源:counter.py


注:本文中的tracker.Tracker.track方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。