https://github.com/abichinger/ninja-vs
A Discord bot with object and motion detection for CCTV cameras
https://github.com/abichinger/ninja-vs
Last synced: about 1 year ago
JSON representation
A Discord bot with object and motion detection for CCTV cameras
- Host: GitHub
- URL: https://github.com/abichinger/ninja-vs
- Owner: abichinger
- Created: 2022-01-13T15:46:40.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-06T08:54:44.000Z (about 2 years ago)
- Last Synced: 2025-01-24T17:48:12.635Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 46.2 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NinjaVS
A Discord bot with object and motion detection for CCTV cameras.
The NinjaVS bot will send you pictures, when something happens in front of your camera.
# Features
- Snapshot support
- Motion detection
- Object detection
- Combined motion and object detection
- CLI Interface
# CLI Interface
- `!list` - lists all available commands
- `!help motion` - usage information of the `motion` command
- `!set-interval -cooldown 3s "!smart" 1s` - perform motion+object detection every second
# Install using Docker
Clone the repository
```
git pull https://github.com/abichinger/ninja-vs.git
cd ninja-vs
```
**Setup a discord bot**:
1. Create a new discord [application](https://discord.com/developers/applications) and copy the application id
2. Add a bot to your application and note the api token
3. Replace `app_id` with your applicaton id and enter it into your browser: https://discord.com/api/oauth2/authorize?client_id=app_id&permissions=52224&scope=bot
Create `.env` file with all the required variables ([full list of environment varaibles](#environment-variables)).
```ini
NVS_INPUT=rtsp://username:password@host
NVS_DISCORD_TOKEN=your_discord_token
NVS_CAPTURE_WIDTH=2560
NVS_CAPTURE_HEIGHT=1440
NVS_CAPTURE_FPS=10
NVS_CHANNEL_ID=123
```
Build and start the docker container
```
docker-compose build
docker-compose up -d
```
# Manual Installation
## Requirements
- ffmpeg
- cmake
- build-essential
TODO
# Environment Variables
| Variable | Description | Required | Default
| --- | --- | --- | ---
| `NVS_INPUT` | input stream for ffmpeg | x
| `NVS_DISCORD_TOKEN` | discord api token | x
| `NVS_CAPTURE_WIDTH` | width of captured frames | x
| `NVS_CAPTURE_HEIGHT` | height of captured frames | x
| `NVS_CAPTURE_FPS` | fps processed by NinjaVS | x
| `NVS_CHANNEL_ID` | input stream for ffmpeg | x
| `NVS_ONNX_FILE` | path to onnx model | | `./dnn/yolov5s.onnx`
| `NVS_STORAGE` | directory of persistent storage files | | `storage`
| `NVS_CMD_PREFIX` | prefix to trigger NinjaVS | | `!`
| `NVS_OBJECT_EXCLUDE` | coco class names to exclude | | `''`
| `NVS_OBJECT_CONFIDENCE` | confidence threshold | | `0.6`
| `NVS_MOTION_DELAY` | delay in ms between images | | `100`
| `NVS_MOTION_AREA` | min size of motion in percent | | `0.001`
| `NVS_MOTION_THRESHOLD` | threshold value between 0-255 | | `20`
| `NVS_MOTION_BLUR` | kernel size of gaussian blur, must be odd | | `11`
| `NVS_MOTION_WIDTH` | processing width | | `1000`
# Development
```bash
# Install dependencies
npm install
# Build opencv
npm run build-opencv
# Run tests
npm run test
# Run NinjaVS
npm run start
```
# Attribution
[ultralytics/yolov5](https://github.com/ultralytics/yolov5) - origin of onnx model
# Alternatives
- [Shinobi](https://shinobi.video/)