This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
from pathlib import Path | |
from azure.cognitiveservices.vision.computervision import ComputerVisionClient | |
from msrest.authentication import CognitiveServicesCredentials | |
class AzureCVClient(): | |
def __init__(self): | |
self.endpoint, self.key = self._get_credentials() | |
self.client = ComputerVisionClient( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
from pathlib import Path | |
from googleapiclient.errors import HttpError | |
from google.auth.transport.requests import Request | |
from google.oauth2.credentials import Credentials | |
from google_auth_oauthlib.flow import InstalledAppFlow | |
from googleapiclient.discovery import build | |
class GooglePhotosClient: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
from pathlib import Path | |
class ImgurClient(): | |
def __init__(self): | |
self.upload_endpoint = "https://api.imgur.com/3/upload" | |
self.delete_endpoint = "https://api.imgur.com/3/image/" | |
self.client_id = self.get_client_id() | |
self.image_del_hash = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def warp_frame(frame, playfield_corners): | |
""" | |
Warps the frame to the playfield. | |
Parameters | |
---------- | |
frame : np.ndarray | |
The frame to transform. | |
playfield_corners : list | |
The coordinates of the corners of the playfield. | |
Returns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_playfield_corners(frame): | |
"""Identifies coordinates of the playfield corners from the frame. | |
Parameters | |
---------- | |
frame : numpy.ndarray | |
The frame read in by the VideoCapture | |
Returns | |
------- | |
corners_coordinates : list | |
List of coordinates of the identified playfield corners |