A face recognition-based security system for Linux that monitors and controls access through your computer's camera.
- Install system dependencies:
sudo apt-get update
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl \
git cmake libopencv-dev
- Install pyenv (if not already installed):
curl https://pyenv.run | bash
- Add pyenv to your shell configuration (~/.bashrc or ~/.zshrc):
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
- Reload your shell configuration:
source ~/.bashrc
- Install Python 3.11.0:
pyenv install 3.11.0
- Create a virtual environment for the project:
cd to/the/folder/you/want/to/clone/security-script
pyenv local 3.11.0
python -m venv .venv
source .venv/bin/activate
- Clone the repository:
git clone <repository-url>
cd security-script
- Install required Python packages:
pip install -r requirements.txt
-
Add authorized face images to the
database1
directory (supported formats: .jpg, .jpeg, .png) -
Run the security camera system:
python security_linux.py
- The system will create an
unknown_faces
directory to store detected unauthorized faces - Logs are stored in
security_system.log
- Press 'q' to quit the application
- The system will automatically log out the current user if an unauthorized face is detected in consecutive frames
The main script security_linux.py
is structured to be self-documenting with clear variable names and logical organization. Key components include:
- Face detection and recognition using the
face_recognition
library - Real-time camera feed processing with OpenCV
- Automatic logging of security events
- Force logout capability for unauthorized access
- Support for toggling camera feed visibility
This project is licensed under the MIT License - see the LICENSE file for details.