Skip to content

Instantly share code, notes, and snippets.

View arhanjain's full-sized avatar
🥕

Arhan Jain arhanjain

🥕
View GitHub Profile
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(
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:
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
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
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