Created
February 26, 2021 07:59
-
-
Save danleyb2/4aed2c223001fa36baaca06be394874d to your computer and use it in GitHub Desktop.
Send images in a folder to Platerecognizer Snapshot SDK
This file contains 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 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