The repository contains the sources code for the Camera Security System project(CSS).
The CSS is mainly composed of three 5 components:
1. Frontend: It is the UI that enables the user to view and use the project in the browser.
2. Backend: It is responsible for authentication, logging detection events, and establish communication between the frontend and the media server to access the IP Cameras.
4. Machine learning: It is responsible for analyzing the camera streams and check if an object is
detected.
5. NVR & IPCameras: These are the cameras that captures videos of the surrounding.
In order to successfully run the full project components in your local machine, launch the components in the following order:
- Install your IP Cameras in the areas desired and connect it to the network.
- Run the frontend and DB dockerized images.
- Run the backend.
- Run the machine learning component.
Below, you will get full details on how to run each component.
You should first install node.js and docker in your machine.
The frontend is the part of the camera security system that enables user to interact with the system visually.
To run the frontend you need to have the following environment variables defined in a .secrets.yml
file in the root directory. You can use the following example
NEXT_PUBLIC_BACKEND_URL=https://localhost:8080/
MONGO_PROTOCOL=mongodb
# mongo:27017 indicates the container called mongo and the port it is listening on
MONGO_HOST=mongo:27017
# DB root username
MONGO_INITDB_ROOT_USERNAME=username
# DB root password
MONGO_INITDB_ROOT_PASSWORD=password
# JWT cryptographic secret
JWT_SECRET=secret
# User to access the backend
CSD_USER=User
# Password to access the backend
CSD_PASSWORD=Password
# Telegram bot token
TELEGRAM_TOKEN=api_token
# Should be of the format of BCrypt hash
BCRYPT_SALT=...
# Put the IP address of the NVR
NVR_IP_ADDRESS=
Install the required packages by running:
docker compose up -d
The backend is the part of the camera security system that is responsible for authentication, logging detection events, and establish communication between the frontend and the media server to access the IP Cameras.
To run the backend you need to have the following environment variables defined in a .env
file in the root directory of the backend. You can use the following example
# User to access the backend
CSD_USER=User
# Password to access the backend
CSD_PASSWORD=Password
MONGO_PROTOCOL=mongodb
# mongo:27017 indicates the container called mongo and the port it is listening on
MONGO_HOST=localhost:27017
# DB root username
MONGO_INITDB_ROOT_USERNAME=username
# DB root password
MONGO_INITDB_ROOT_PASSWORD=password
# JWT cryptographic secret
JWT_SECRET=secret
# Telegram bot token
TELEGRAM_TOKEN=api_token
# Should be of the format of BCrypt hash
BCRYPT_SALT=...
# Put the IP address of the NVR
NVR_IP_ADDRESS=
You can also run the backend by just adding the telegram token and leave the rest of the config as it is.
Run the application using the following commands:
cd Backend
npm run css:start
The machine learning component is responsible for analyzing the camera streams and check if an object is detected.
It is simple to start it using the following commands:
python ImageRecognition/main.py