Vehicle counting API
Count cars, trucks, buses, bicycles and motorcycles in camera images.
What it detects
Count vehicles visible in parking areas and loading yards.
Camera setup
Send a frame with pipeline: detector. Select car, truck, bus, bicycle and motorcycle, or just the classes your application needs.
Send a camera image.
Set KIRKWOOD_API_KEY on your server. Save a frame as frame.jpg.
import base64
import json
import os
import urllib.request
with open("frame.jpg", "rb") as frame:
image = base64.b64encode(frame.read()).decode()
body = json.loads('''{
"images": [
"<BASE64_JPEG>"
],
"pipeline": "detector",
"detections": {
"classes": [
"car",
"truck",
"bus",
"bicycle",
"motorcycle"
],
"return_boxes": true
}
}''')
body["images"] = [image]
request = urllib.request.Request(
"https://app.kirkwood.ai/v1/analyze",
data=json.dumps(body).encode(),
headers={
"Authorization": "Bearer " + os.environ["KIRKWOOD_API_KEY"],
"Content-Type": "application/json",
},
method="POST",
)
with urllib.request.urlopen(request, timeout=120) as response:
print(json.dumps(json.load(response), indent=2))Read the result
Read detections.counts for each selected class and detections.boxes for its location in the image.
Try it on your footage.
Upload an image and choose the detector pipeline. Run analysis.
Approved account required. Analysis uses credit. Images are retained for annotation and training.
Open the live PlaygroundBefore you integrate
These are counts of detected vehicles in a frame. The API’s directional lines currently count people, not vehicle crossings or license plates.
Does this count available parking spaces?
It counts vehicles visible in the image. Parking-space availability needs a separate space map and application logic; it is not a built-in tag.