People counting API

Get people counts and bounding boxes from camera images.

What it detects

Count people visible in a shop, lobby or public space.

Camera setup

Send one JPEG or PNG frame. Use pipeline: detector and select the person class when you only need counting and boxes.

Send a camera image.

Set KIRKWOOD_API_KEY on your server. Save a frame as frame.jpg.

Python POST /v1/analyze
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": [
      "person"
    ],
    "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.person and detections.boxes. Each box includes its class, detector score and image coordinates.

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 Playground

API pricing

Billed per image analyzed. Contact us for your rate.

Request pricing

Before you integrate

A frame count is the number of people detected in that image. It is not a count of unique visitors across a day or across different cameras.

How do I count visitors entering a store?

Use a directional counting line and successive frames. The footfall API example shows entry and exit counts; a single-frame people count shows how many are in view.

API guide