コード例 #1
0
ファイル: tracker.py プロジェクト: hendrix513/nuxeo-drive
 def __init__(self, manager, uid="UA-81135-23"):
     '''
     Constructor
     '''
     super(Tracker, self).__init__()
     from UniversalAnalytics import Tracker as UATracker
     self._manager = manager
     self._thread.started.connect(self.run)
     self._user_agent = self.get_user_agent(self._manager.get_version())
     self.uid = uid
     self._tracker = UATracker.create(uid, client_id=self._manager.get_device_id(),
                                     user_agent=self._user_agent)
     self._tracker.set("appName", "NuxeoDrive")
     self._tracker.set("appVersion", self._manager.get_version())
     self._manager.started.connect(self._send_stats)
     # Send stat every hour
     self._stat_timer = QtCore.QTimer()
     self._stat_timer.timeout.connect(self._send_stats)
     # Connect engines
     for _, engine in self._manager.get_engines().iteritems():
         self.connect_engine(engine)
     self._manager.newEngine.connect(self.connect_engine)
     self._manager.get_updater().appUpdated.connect(self._send_app_update_event)
     self._manager.get_direct_edit().openDocument.connect(self._send_directedit_open)
     self._manager.get_direct_edit().editDocument.connect(self._send_directedit_edit)
コード例 #2
0
ファイル: utils.py プロジェクト: Morabaraba/pmg-cms-2
def track_pageview(path=None, ignore_bots=True):
    """ User Google Analytics to track this pageview. """
    from pmg import app

    ga_id = app.config.get('GOOGLE_ANALYTICS_ID')
    if not ga_id:
        return False

    user_agent = request.user_agent.string
    if ignore_bots and BOTS_RE.search(user_agent):
        return False

    path = path or request.path
    user_id = current_user.id if current_user.is_authenticated() else None

    client_id = request.cookies.get('_ga')
    if client_id:
        # GA1.2.1760224793.1424413995
        client_id = client_id.split('.', 2)[-1]

    tracker = Tracker.create(ga_id, user_id=user_id, client_id=client_id)
    tracker.send('pageview',
                 path,
                 uip=request.access_route[0],
                 referrer=request.referrer or '',
                 userAgent=user_agent)

    return True
コード例 #3
0
def ga_create(ga_code):
    ga_tracker = Tracker.create(ga_code, name='GATracker' + plugin.addon.getAddonInfo('name'), client_id=GA_VSTR,
                                user_agent=xbmc_var['user_agent'])
    ga_tracker.set('sr', xbmc_var['screen_resolution'])
    ga_tracker.set('av', plugin.addon.getAddonInfo('version'));
    ga_tracker.set('cd1', plugin.addon.getAddonInfo('version'));
    return ga_tracker
コード例 #4
0
ファイル: tracker.py プロジェクト: jresende/nuxeo-drive
    def __init__(self, manager, uid='UA-81135-23'):
        super(Tracker, self).__init__()
        self._manager = manager
        self._thread.started.connect(self.run)
        self.uid = uid
        self._tracker = UATracker.create(uid,
                                         client_id=self._manager.device_id,
                                         user_agent=self.user_agent)
        self._tracker.set('appName', 'NuxeoDrive')
        self._tracker.set('appVersion', self._manager.get_version())
        self._tracker.set('encoding', sys.getfilesystemencoding())
        self._tracker.set('language', self.current_locale)
        self._manager.started.connect(self._send_stats)

        # Send stat every hour
        self._stat_timer = QtCore.QTimer()
        self._stat_timer.timeout.connect(self._send_stats)

        # Connect engines
        for _, engine in self._manager.get_engines().iteritems():
            self.connect_engine(engine)
        self._manager.newEngine.connect(self.connect_engine)
        if self._manager.get_updater() is not None:
            self._manager.get_updater().appUpdated.connect(
                self._send_app_update_event)
        if self._manager.direct_edit is not None:
            self._manager.direct_edit.openDocument.connect(
                self._send_directedit_open)
            self._manager.direct_edit.editDocument.connect(
                self._send_directedit_edit)
コード例 #5
0
    def __init__(self, manager: "Manager", uid: str = "UA-81135-23") -> None:
        super().__init__()
        self._manager = manager
        self._thread.started.connect(self.run)
        self.uid = uid
        self._tracker = UATracker.create(uid,
                                         client_id=self._manager.device_id,
                                         user_agent=self.user_agent)
        self._tracker.set("appName", "NuxeoDrive")
        self._tracker.set("appVersion", self._manager.version)
        self._tracker.set("encoding", sys.getfilesystemencoding())
        self._tracker.set("language", self.current_locale)
        self._manager.started.connect(self._send_stats)

        # Send stat every hour
        self._stat_timer = QTimer()
        self._stat_timer.timeout.connect(self._send_stats)

        # Connect engines
        for _, engine in self._manager.get_engines().items():
            self.connect_engine(engine)
        self._manager.newEngine.connect(self.connect_engine)
        if self._manager.direct_edit is not None:
            self._manager.direct_edit.openDocument.connect(
                self._send_directedit_open)
            self._manager.direct_edit.editDocument.connect(
                self._send_directedit_edit)
コード例 #6
0
 def setUp(self):
     self._buffer = HTTPLog.StringIO()
     HTTPLog.consume(self._buffer) # Capture HTTP output in readible fashion
     Tracker.HTTPPost.debug() # Enabled debugging from urllib2
     
     # Create the tracker
     self.tracker = Tracker.create('UA-XXXXX-Y', use_post = True)
コード例 #7
0
ファイル: tracker.py プロジェクト: nuxeo/nuxeo-drive
    def __init__(self, manager: "Manager", uid: str = "UA-81135-23") -> None:
        super().__init__()
        self._manager = manager
        self.thread.started.connect(self.run)
        self.uid = uid
        self.app_name = APP_NAME.replace(" ", "")
        self.arch = get_arch()
        self.current_os = " ".join(get_current_os())
        self._tracker = UATracker.create(
            uid, client_id=self._manager.device_id, user_agent=self.user_agent
        )
        self._tracker.set("appName", self.app_name)
        self._tracker.set("appVersion", self._manager.version)
        self._tracker.set("encoding", sys.getfilesystemencoding())
        self._tracker.set("language", self.current_locale)
        self._manager.started.connect(self._send_stats)

        # Send stat every hour
        self._stat_timer = QTimer()
        self._stat_timer.timeout.connect(self._send_stats)

        # Connect engines
        for _, engine in self._manager.get_engines().items():
            self.connect_engine(engine)
        self._manager.newEngine.connect(self.connect_engine)
        if self._manager.direct_edit is not None:
            self._manager.direct_edit.openDocument.connect(self._send_directedit_open)
            self._manager.direct_edit.editDocument.connect(self._send_directedit_edit)
コード例 #8
0
ファイル: tracker.py プロジェクト: hendrix513/nuxeo-drive
 def __init__(self, manager, uid="UA-81135-23"):
     '''
     Constructor
     '''
     super(Tracker, self).__init__()
     from UniversalAnalytics import Tracker as UATracker
     self._manager = manager
     self._thread.started.connect(self.run)
     self._user_agent = self.get_user_agent(self._manager.get_version())
     self.uid = uid
     self._tracker = UATracker.create(
         uid,
         client_id=self._manager.get_device_id(),
         user_agent=self._user_agent)
     self._tracker.set("appName", "NuxeoDrive")
     self._tracker.set("appVersion", self._manager.get_version())
     self._manager.started.connect(self._send_stats)
     # Send stat every hour
     self._stat_timer = QtCore.QTimer()
     self._stat_timer.timeout.connect(self._send_stats)
     # Connect engines
     for _, engine in self._manager.get_engines().iteritems():
         self.connect_engine(engine)
     self._manager.newEngine.connect(self.connect_engine)
     self._manager.get_updater().appUpdated.connect(
         self._send_app_update_event)
     self._manager.get_direct_edit().openDocument.connect(
         self._send_directedit_open)
     self._manager.get_direct_edit().editDocument.connect(
         self._send_directedit_edit)
コード例 #9
0
    def __init__(self, manager: "Manager", uid: str = "UA-81135-23") -> None:
        super().__init__()
        self._manager = manager
        self.thread.started.connect(self.run)
        self.uid = uid
        self.app_name = APP_NAME.replace(" ", "")
        self.arch = get_arch()
        self.current_os = " ".join(get_current_os())
        self._tracker = UATracker.create(uid,
                                         client_id=self._manager.device_id,
                                         user_agent=self.user_agent)
        self._tracker.set("appName", self.app_name)
        self._tracker.set("appVersion", self._manager.version)
        self._tracker.set("encoding", sys.getfilesystemencoding())
        self._tracker.set("language", self.current_locale)
        self._manager.started.connect(self._send_stats)

        # Send stat every hour
        self._stat_timer = QTimer()
        self._stat_timer.timeout.connect(self._send_stats)

        # Connect Direct Edit metrics
        if self._manager.direct_edit:
            self._manager.direct_edit.openDocument.connect(
                self._send_directedit_open)
            self._manager.direct_edit.editDocument.connect(
                self._send_directedit_edit)
コード例 #10
0
ファイル: utils.py プロジェクト: kollinsayz/pmg-cms-2
def track_pageview(path=None, ignore_bots=True):
    """ User Google Analytics to track this pageview. """
    from pmg import app

    ga_id = app.config.get('GOOGLE_ANALYTICS_ID')
    if not ga_id:
        return False

    user_agent = request.user_agent.string
    if ignore_bots and BOTS_RE.search(user_agent):
        return False

    path = path or request.path
    user_id = current_user.id if current_user.is_authenticated() else None

    client_id = request.cookies.get('_ga')
    if client_id:
        # GA1.2.1760224793.1424413995
        client_id = client_id.split('.', 2)[-1]

    tracker = Tracker.create(ga_id, user_id=user_id, client_id=client_id)
    tracker.send('pageview', path,
                 uip=request.access_route[0],
                 referrer=request.referrer or '',
                 userAgent=user_agent)

    return True
コード例 #11
0
    def setUp(self):
        self._buffer = HTTPLog.StringIO()
        HTTPLog.consume(
            self._buffer)  # Capture HTTP output in readible fashion
        Tracker.HTTPPost.debug()  # Enabled debugging from urllib2

        # Create the tracker
        self.tracker = Tracker.create('UA-XXXXX-Y', use_post=True)
コード例 #12
0
def send_analytic_event_server_side(event_category, event_action, event_label):
    """ Sending event to google analytics with server side code
        for the specific organization and for govil also

    :param event_category: The category of the event (Example: OrganizationTitle~Resource_Download)
    :param event_action: The action of the event (Example: DatasetTitle)
    :param event_label: The label of the event (Example: ResourceName)
    :return: None
    """

    # sending event to organization analytics
    tracker = Tracker.create(get_current_analytics_code())
    tracker.send('event', event_category, event_action, event_label)

    # sending event to govil analytics
    tracker = Tracker.create(get_govil_analytics_code())
    tracker.send('event', event_category, event_action, event_label)
コード例 #13
0
ファイル: _header.py プロジェクト: pehas/xbmc-kg-ontv
def ga_create(ga_code):
    ga_tracker = Tracker.create(ga_code,
                                name='GATracker' +
                                plugin.addon.getAddonInfo('name'),
                                client_id=GA_VSTR,
                                user_agent=xbmc_var['user_agent'])
    ga_tracker.set('sr', xbmc_var['screen_resolution'])
    ga_tracker.set('av', plugin.addon.getAddonInfo('version'))
    ga_tracker.set('cd1', plugin.addon.getAddonInfo('version'))
    return ga_tracker
コード例 #14
0
ファイル: bot_event.py プロジェクト: kmcgaire/PokemonGoBot
 def __init__(self,bot):
     self.bot = bot
     # UniversalAnalytics can be reviewed here:
     # https://github.com/analytics-pros/universal-analytics-python
     # For central TensorFlow training, forbiden any personally information
     # report to server
     # Review Very Carefully for the following line, forbiden ID changed PR:
     if bot.config.health_record:
         logger.log('Send anonymous bot health report to server, it can be disabled by config \"health_record\":false in config file', 'red')
         logger.log('Wait for 2 seconds ', 'red')
         sleep(3)
         self.tracker = Tracker.create('UA-81469507-1', use_post=True)
コード例 #15
0
 def track_event(self, event):
     """
     Send a tracking event if tracking is enabled
     :param event: the string idetifier of the event
     :return: None
     """
     addon = self.get_addon()
     # Check if tracking is enabled
     enable_tracking = (addon.getSetting('enable_tracking') == 'true')
     if enable_tracking:
         #Get or Create Tracking id
         tracking_id = addon.getSetting('tracking_id')
         if tracking_id is '':
             tracking_id = str(uuid4())
             addon.setSetting('tracking_id', tracking_id)
         # Send the tracking event
         tracker = Tracker.create('UA-46081640-5', client_id=tracking_id)
         tracker.send('event', event)
コード例 #16
0
ファイル: quote.py プロジェクト: eunjungchoi/bookocr
def add(request):
    ''' save quote with book info. quote message not added yet. '''

    # track image upload time
    if '_request_start_time_ms' in request.POST:
        _rtime = int(request.POST['_request_start_time_ms'])
        time_to_upload_ms = datetime.now().timestamp() * 1000 - _rtime
        book_title = request.POST['book-title']
        tracker = Tracker.create(settings.GOOGLE_ANALYTICS_TRACKER_ID)
        tracker.send('event', 'upload', 'image', book_title,
                     int(time_to_upload_ms))
        tracker.send('timing', 'upload', 'image', str(time_to_upload_ms),
                     book_title)
        logger.debug('upload image: %.1f s, "%s"' %
                     (time_to_upload_ms / 1000, book_title))

    #
    title = request.POST['book-title'][:TITLE_MAX_LENGTH]
    try:
        book = Book.objects.get(title=title)
    except Book.DoesNotExist:
        book = Book(
            title=title,
            authors=request.POST['book-authors'],
            cover_url=request.POST['book-cover-url'],
            _raw_response=request.POST['book-response'],
        )
        book.isbn13 = request.POST['book-isbn']
        book.save()

    q = Quote(
        user=request.user,
        book=book,
        photo=request.FILES['photo'],
        quotation=request.POST['quotation'],
    )
    q.resize_image(max_size=(640, 640))
    q.save()

    return redirect(
        reverse('new_quote_ocr', kwargs={
            "book_id": book.id,
            "quote_id": q.id
        }))
コード例 #17
0
# This project is free software, distributed under the BSD license. 
# Analytics Pros offers consulting and integration services if your firm needs 
# assistance in strategy, implementation, or auditing existing work.
###############################################################################

from UniversalAnalytics import Tracker

DEBUG = True

if DEBUG: # these are optional...
    from UniversalAnalytics import HTTPLog
    HTTPLog.consume() # Filters urllib2's standard debugging for readability
    Tracker.HTTPPost.debug() # Enables debugging in urllib2

# Create the tracker
tracker = Tracker.create('UA-XXXXX-Y', name = 'mytracker', use_post = True)

# Apply campaign settings
tracker.set('campaignName', 'testing')
tracker.set('campaignMedium', 'testing')

tracker['campaignSource'] = 'test-source'

# Send a pageview
tracker.send('pageview', '/test')

# Send an event
tracker.send('event', 'mycat', 'myact', 'mylbl', { 'noninteraction': 1, 'page': '/1' })

# Send a social hit
tracker.send('social', 'facebook', 'test', '/test#social')
コード例 #18
0
_ = addon.getLocalizedString
ga = {
    "enabled": False,
    "UA": 'UA-18146963-3',
    "appName": addon.getAddonInfo("name"),
    "appVersion": addon.getAddonInfo("version"),
    "appId": addon.getAddonInfo("id")
}
randomButtonEnabled = False if (addon.getSetting("randomButtonEnabled")
                                == "false") else True
playFullEpisodesByDefault = False if (
    addon.getSetting("playFullEpisodesByDefault") == "false") else True

if (addon.getSetting("analytics") == "true"):
    from UniversalAnalytics import Tracker
    tracker = Tracker.create(ga["UA"])
    tracker.set("appName", ga["appName"])
    tracker.set("appVersion", ga["appVersion"])
    tracker.set("appId", ga["appId"])
    ga["enabled"] = True
    if (addon.getSetting("uuid") == ""):
        addon.setSetting("uuid", tracker.params["cid"])
    else:
        tracker.set("clientId", addon.getSetting("uuid"))

# setting SBT urls
urls = {}
urls["sbtvideos"] = "http://www.sbt.com.br/sbtvideos/"
urls[
    "playlist"] = "http://api.sbt.com.br/1.5.0/playlists/key=AE8C984EECBA4F7F835C585D5CB6AB4B&fields=id&idsite=211&idSiteArea=1068&limit=1&description=$programId"
urls[
コード例 #19
0
# Analytics Pros offers consulting and integration services if your firm needs
# assistance in strategy, implementation, or auditing existing work.
###############################################################################

from UniversalAnalytics import Tracker

DEBUG = True

if DEBUG:  # these are optional...
    from UniversalAnalytics import HTTPLog

    HTTPLog.consume()  # Filters urllib2's standard debugging for readability
    Tracker.HTTPPost.debug()  # Enables debugging in urllib2

# Create the tracker
tracker = Tracker.create("UA-XXXXX-Y", name="mytracker")

# Apply campaign settings
tracker.set("campaignName", "testing")
tracker.set("campaignMedium", "testing")

# Send a pageview
tracker.send("pageview", "/test")

# Send an event
tracker.send("event", "mycat", "myact", "mylbl", {"noninteraction": 1, "page": "/1"})

# Send a social hit
tracker.send("social", "facebook", "test", "/test#social")

# A few more hits for good measure, testing real-time support for time offset
コード例 #20
0
ファイル: tracker.py プロジェクト: tm8r/ga_plugin_example
# -*- coding: utf-8 -*-
from UniversalAnalytics import Tracker
import functools

TRACKING_CODE = "UA-XXXXXXXX-Y"
tracker = Tracker.create(TRACKING_CODE)
EXD_FORMART = "{0} on {1}"


def before_tracking(hittype, *args, **kwargs):
    def receive_func(func):
        @functools.wraps(func)
        def wrapper(*wargs, **wkwargs):
            tracker.send(hittype, *args, **kwargs)
            print(hittype, args, kwargs)
            return func(*wargs, **wkwargs)

        return wrapper

    return receive_func


def after_tracking(hittype, *args, **kwargs):
    def receive_func(func):
        @functools.wraps(func)
        def wrapper(*wargs, **wkwargs):
            try:
                result = func(*wargs, **wkwargs)
                print("normal", hittype)
                tracker.send(hittype, *args, **kwargs)
                return result
コード例 #21
0
import cv2
import numpy
import math
from UniversalAnalytics import Tracker

size = 1
cv2.namedWindow('Preview')
life=5


face_cascade = cv2.CascadeClassifier('/home/pi/people_counter/lbpcascade_frontalface.xml')
#face_cascade = cv2.CascadeClassifier('/home/pi/people_counter/haarcascade_frontalface_default.xml')
#face_cascade = cv2.CascadeClassifier('hogcascade_pedestrians.xml')

stream = io.BytesIO()
tracker = Tracker.create('UA-123944-30')

def distance(newpoint, oldpoint):
    return math.sqrt((newpoint[0] - oldpoint[0]) ** 2 + (newpoint[1] - oldpoint[1]) ** 2)

(oldpoints, opid) = ({}, 0)

with picamera.PiCamera() as camera:
        #camera.start_preview()
        camera.resolution = (360,240)
        camera.rotation = 180


        #capture into stream
        count = 0
        for foo in camera.capture_continuous(stream, format='jpeg', use_video_port=True):
コード例 #22
0
from UniversalAnalytics import Tracker

#be sure to replace the tracker with your own code!
tracker = Tracker.create('XX-XXXXXXXX-X', client_id = 'PY_TEST')

for i in range (1,10):
	eventCategory = 'test' + str(i)
	eventAction = 'PythonTest'
	tracker.send('event', eventCategory, eventAction)
	print("event %s %s sent" % (eventCategory, eventAction))
コード例 #23
0
ファイル: report.py プロジェクト: boyps/WeatherMapBot
 def __init__(self, track_id, client_id):
     self.client_id = client_id
     self.tracker = Tracker.create(track_id, client_id=client_id)
     log.info('tracker: create tracker for user=%s' % client_id)
コード例 #24
0
 def setUp(self):
     # Create the tracker
     self.tracker = Tracker.create('UA-XXXXX-Y', client_id='123cid', use_post=True)
コード例 #25
0
ファイル: v1.py プロジェクト: zno-ua/site
    def dispatch(self, request_type, request, **kwargs):
        if 'test' in request.GET:
            tracker = Tracker.create(GOOGLE_ANALYTICS_ID, client_id=request.META.get('HTTP_X_REAL_IP'))
            tracker.send('event', 'API', 'test', request.GET['test'])

        return super(QuestionResource, self).dispatch(request_type, request, **kwargs)
コード例 #26
0
# getting addon strings
addon = settings.Settings("plugin.video.sbtvideos");
_ = addon.getLocalizedString;
ga = {
	"enabled" : False,
	"UA" : 'UA-18146963-3',
	"appName" : addon.getAddonInfo("name"),
	"appVersion" : addon.getAddonInfo("version"),
	"appId" : addon.getAddonInfo("id")
}
randomButtonEnabled = False if (addon.getSetting("randomButtonEnabled") == "false") else True;
playFullEpisodesByDefault = False if (addon.getSetting("playFullEpisodesByDefault") == "false") else True;

if (addon.getSetting("analytics") == "true"):
	from UniversalAnalytics import Tracker;
	tracker = Tracker.create(ga["UA"]);
	tracker.set("appName", ga["appName"]);
	tracker.set("appVersion", ga["appVersion"]);
	tracker.set("appId", ga["appId"]);
	ga["enabled"] = True;
	if (addon.getSetting("uuid") == ""):
		addon.setSetting("uuid", tracker.params["cid"]);
	else:
		tracker.set("clientId", addon.getSetting("uuid"));

# setting SBT urls
urls = {};
urls["sbtvideos"] = "http://www.sbt.com.br/sbtvideos/";
urls["playlist"] = "http://api.sbt.com.br/1.5.0/playlists/key=AE8C984EECBA4F7F835C585D5CB6AB4B&fields=id&idsite=211&idSiteArea=1068&limit=1&description=$programId";
urls["menu"] = "http://api.sbt.com.br/1.5.0/medias/key=AE8C984EECBA4F7F835C585D5CB6AB4B&fields=id,title,description,thumbnail,author,opcional&idsite=211&idSiteArea=1068&idPlaylist=$playlistId&limit=100&orderby=ordem&sort=ASC";
urls["media"] = "http://api.sbt.com.br/1.5.0/videos/key=AE8C984EECBA4F7F835C585D5CB6AB4B&fields=id,title,idcategory,idprogram,program,thumbnail,publishdatestring,secondurl,playerkey,total&program=$programId&category=$authorId&limit=100&orderBy=publishdate&sort=desc&page=$page";
コード例 #27
0
ファイル: ga.py プロジェクト: khoaanh2212/nextChef
def sendGoogleAnalyticsPageview(path, title):
    #tracker = Tracker.create('UA-45832883-9', client_id=CUSTOMER_UNIQUE_ID)
    tracker = Tracker.create('UA-45832883-9')
    tracker.send('pageview', {'path': path, 'title': title})
コード例 #28
0
 def setUp(self):
     # Create the tracker
     self.tracker = Tracker.create('UA-XXXXX-Y',
                                   client_id='123cid',
                                   use_post=True)
コード例 #29
0
ファイル: tasks.py プロジェクト: IT-corridor/savings-champion
def analytics(*args, **kwargs):
    tracker = Tracker.create(settings.GA_ACCOUNT)
    tracker.send(*args, **kwargs)
コード例 #30
0
 def __init__(self, track_id, client_id):
     self.client_id = client_id
     self.name = APP_NAME
     self.tracker = Tracker.create(track_id, client_id=client_id)
コード例 #31
0
ファイル: middleware.py プロジェクト: rkunal/indigo
 def send(self, client_id, *args, **kwargs):
     tracker = Tracker.create(settings.GOOGLE_ANALYTICS_ID,
                              client_id=client_id)
     tracker.send(*args, **kwargs)
コード例 #32
0
 def __init__(self, ua_id):
     self.tracker = Tracker.create(ua_id, client_id='zzz')
コード例 #33
0
def analytics(*args, **kwargs):
    tracker = Tracker.create(settings.GA_ACCOUNT)
    tracker.send(*args, **kwargs)
コード例 #34
0
import cv2
import numpy
import math
from UniversalAnalytics import Tracker

size = 1
cv2.namedWindow('Preview')
life = 20

#face_cascade = cv2.CascadeClassifier('cascades/lbpcascade_frontalface.xml')
#face_cascade = cv2.CascadeClassifier('cascades/haarcascade_frontalface_default.xml')
#face_cascade = cv2.CascadeClassifier('cascades/hogcascade_pedestrians.xml')
face_cascade = cv2.CascadeClassifier('cascades/banana.xml')

stream = io.BytesIO()
tracker = Tracker.create('UA-123944-30')


def distance(newpoint, oldpoint):
    return math.sqrt((newpoint[0] - oldpoint[0])**2 +
                     (newpoint[1] - oldpoint[1])**2)


(oldpoints, opid) = ({}, 0)

cap = cv2.VideoCapture(0)

while (True):
    # Capture frame-by-frame
    ret, frame = cap.read()
コード例 #35
0
 def __init__(self, ua_id):
     self.tracker = Tracker.create(ua_id, client_id='zzz')