covid19-people-counter-system comes to share queue length to citizens or simply count people outside markets/shop.
This system analizes images from city cameras, count people inside them, and show a real-time user interface which can be included in an app or website through an <iframe>
.\
The software is entirely on-premise so it doesn't need internet access. So sensitive data from original frame stay only inside the used server.
This is the best way to guarantee people privacy.
City cameras generally already exists or come from new installations by covid emergency.
- cities
- public organizations
- universities
Or simply who owns cameras and wants to count people real-time.
Hardware
- cameras with internet access (es. URL/IP)
- server with at least 2G of RAM
Software
- Docker
-
- set up cameras urls/ips
-
- set up environment in docker-compose
-
- set up environment in Angular UI
-
- set up DNS
-
- run it!
config.json
contains all cameras that covid19-people-counter-system has to contact to get fresh frames.
Urls can be also IPs.\
- url -> URL or IP of a camera (es. https://someserver.com/mycamera)
- code -> unique code of the camera, it must be lowercase alphanumeric (underscore acceptes) (es. carrefour_1)
- description -> short description of a camera (es. "Carrefour in front of the stadium")
(optional) At runtime the above variables are replaced in "url":
- [YYYY] -> year with century as a decimal number (es. 2020)
- [MM] -> Minute as a decimal number [00,59].
- [DD] -> Day of the month as a decimal number [01,31].
- [HH] -> Hour (24-hour clock) as a decimal number [00,23].
- [mm] -> Month as a decimal number [01,12].
So an url like:
[
{
"url": "https://someserver.com/YYYY/MM/DD/HH/mm",
"code": "carrefour_1",
"description": "Carrefour in front of the stadium"
}
]
at runtime will be https://someserver.com/2020/03/27/09/10
.
The timezone is set by TZ env variable of "cron" in docker-compose.
The only variables you need to change are:
- POSTGRES_USER (set a DB username)
- POSTGRES_PASSWORD (set a DB psw)
- TZ: Europe/Rome (set your timezone)
- FREQUENCE_MINUTES [1]
- DOMAIN: test.yuribacciarini.com (your public domain)
[1]
How much you want the data to be fresh?
FREQUENCE_MINUTES env variable set it.
For example FREQUENCE_MINUTES=5 says to covid19-people-counter-system to get fresh images every 5 minutes from every images configured in config.json.
Edit ui/src/environments/environment.prod.ts
export const environment = {
production: true,
codes: ["coop","cadorna"],
apiHost: "http://localhost",
locale: "it-CH",
dateFormat: 'dd/MM/yyyy HH:mm',
timezone: '+01',
frequency: 5000
};
You need con set only:
- codes: the list of your codes cameras defined in config.json (1. set up cameras urls/ips)
- dateFormat: date format for the charts
- timezone: your timezone
- frequency: refresh frequence
set up your A Record to point to your server IP
# build api
cd api && docker build . -t api:1 && cd ..
# build cron
cd cron && docker build . -t cron:1 && cd ..
# build ui
cd ui && docker build -t ui-default:1 . && cd ..
# build ingress
cd ingress && docker build . -t ingress:1 && cd ..
# run
docker-compose up -d
- HTTPs support