當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。