Skip to content

Instantly share code, notes, and snippets.

@danleyb2
Created February 26, 2021 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danleyb2/4aed2c223001fa36baaca06be394874d to your computer and use it in GitHub Desktop.
Save danleyb2/4aed2c223001fa36baaca06be394874d to your computer and use it in GitHub Desktop.
Send images in a folder to Platerecognizer Snapshot SDK
import os
import requests
# API_TOKEN = '77c2fabd94b7d0c9b6ac63c4###################'
DIRECTORY = '/tmp/SonnyCarwash-Genetech-US/'
regions = ['in'] # Change to your country
def run_rec(i):
with open(i, 'rb') as fp:
response = requests.post(
# 'http://api.platerecognizer.com/v1/plate-reader',
'http://localhost:8080/v1/plate-reader/',
data= dict(
# regions=regions,
# camera_id='dz1',
),
files=dict(upload=fp),
# headers={'Authorization': 'Token '+API_TOKEN}
)
print(response)
print(response.text)
return response.json()
def process(path):
run_recognition_response = run_rec(path)
for result in run_recognition_response['results']:
plate_bounding_box = result['box']
plate = result['plate']
print(plate)
if __name__ == '__main__':
directory = DIRECTORY
for filename in os.listdir(directory):
process(directory+ filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment