30 Commits

Author SHA1 Message Date
rattatwinko 633af882ca requirements file
Build MuCaPy Executable / build-and-package (push) Failing after 9s
2025-06-03 18:20:27 +02:00
rattatwinko d2864fd337 hopefully run tests 2025-06-03 18:19:44 +02:00
rattatwinko 08431ee6ca removed unused shit and added a logo
Build MuCaPy Executable / build-and-package (push) Successful in 1m41s
2025-06-02 14:46:37 +02:00
rattatwinko 7dcf03970e think this would work
Build MuCaPy Executable / build-and-package (push) Successful in 1m46s
2025-06-02 14:33:11 +02:00
rattatwinko 44f2797a5c i cant do shit
Build MuCaPy Executable / build-and-package (push) Successful in 1m41s
2025-06-02 14:25:08 +02:00
rattatwinko 98ad6242fa hopefully it works now, made a function that gets the cwd and then joins it!
Build MuCaPy Executable / build-and-package (push) Successful in 1m42s
2025-06-02 14:21:55 +02:00
rattatwinko b3b3d77394 moved the styling into seperate files that are now contained in the styling directory ; workflow should work with this!
Build MuCaPy Executable / build-and-package (push) Successful in 1m43s
2025-06-02 14:10:19 +02:00
rattatwinko e50ab9d03c systeminfo updated in the about section!
Build MuCaPy Executable / build-and-package (push) Successful in 1m41s
2025-05-30 22:32:32 +02:00
rattatwinko c9c60f7237 more info about this bullshit
Build MuCaPy Executable / build-and-package (push) Successful in 1m46s
2025-05-30 22:12:02 +02:00
rattatwinko de156a5c33 stoopid
Build MuCaPy Executable / build-and-package (push) Successful in 1m42s
2025-05-30 22:06:58 +02:00
rattatwinko e4ec7fe244 video on how to run the GACC (gitactionscompiledcode)
Build MuCaPy Executable / build-and-package (push) Successful in 1m43s
2025-05-30 22:03:30 +02:00
rattatwinko 1546528550 added a license and readme
Build MuCaPy Executable / build-and-package (push) Successful in 1m49s
2025-05-30 21:43:27 +02:00
rattatwinko e7b4cc0f92 new cool detection dis/enable
Build MuCaPy Executable / build-and-package (push) Successful in 1m44s
2025-05-28 20:23:16 +02:00
rattatwinko 199d81891f cool HW monitor!
Build MuCaPy Executable / build-and-package (push) Successful in 1m38s
2025-05-28 20:13:54 +02:00
rattatwinko ea1f0bcd85 my cock is very very small
Build MuCaPy Executable / build-and-package (push) Successful in 1m36s
2025-05-28 15:10:04 +02:00
rattatwinko 9ae940585a my cock is very small
Build MuCaPy Executable / build-and-package (push) Successful in 1m39s
2025-05-28 15:02:58 +02:00
rattatwinko 78403395c1 testing this shit
Run MuCaPy / build-and-run (push) Failing after 3m16s
2025-05-28 14:57:52 +02:00
rattatwinko b313fc7629 seoerated 2025-05-27 20:47:53 +02:00
rattatwinko 3c847cee01 sidebar dissaperance 2025-05-26 17:30:35 +02:00
rattatwinko 9ed0b768b8 yeahhhh 2025-05-26 17:27:28 +02:00
rattatwinko 4a06b759e3 yesssssssssss ; it fucking wooooooooooorks !!!! 2025-05-26 17:19:24 +02:00
rattatwinko 2887e2927c made netcams work again 2025-05-26 17:14:38 +02:00
rattatwinko 6da4cd2b40 Merge pull request 'experimental' (#2) from experimental into main
Reviewed-on: http://10.0.0.13:3002/rattatwinko/mucapy/pulls/2
2025-05-26 14:48:31 +00:00
rattatwinko 65be018700 fixed the stupid ass fswindow 2025-05-26 16:47:53 +02:00
rattatwinko 5399cb8739 crossplatform? 2025-05-26 16:47:00 +02:00
rattatwinko b80dd3f7d7 dirty shitt 2025-05-26 16:41:58 +02:00
rattatwinko c264acac29 i hate python 2025-05-26 16:39:58 +02:00
rattatwinko b24426c1d3 better bullshit 2025-05-26 16:18:25 +02:00
rattatwinko 2ebaf16006 working really nicely 2025-05-26 15:59:10 +02:00
rattatwinko 24ac4ccd51 Merge pull request 'experimental-logo' (#1) from experimental-logo into main
Reviewed-on: http://100.64.96.20:3002/rattatwinko/mucapy/pulls/1
---
Everything works! Merged!
2025-05-26 07:57:04 +00:00
20 changed files with 2296 additions and 280 deletions
+45
View File
@@ -0,0 +1,45 @@
name: Build MuCaPy Executable
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-package:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: make test
- name: Install PyInstaller
run: pip install pyinstaller
- name: Build executable with PyInstaller
run: |
pyinstaller --onefile --windowed mucapy/main.py \
--add-data "mucapy/styling:styling" \
--add-data "mucapy/models:models"
- name: Upload executable artifact
uses: actions/upload-artifact@v3
with:
name: mucapy-executable
path: dist/
+10
View File
@@ -0,0 +1,10 @@
mucapy/seperate/__pycache__/__init__.cpython-313.pyc
mucapy/seperate/__pycache__/AboutWindow.cpython-313.pyc
mucapy/seperate/__pycache__/CameraDisplay.cpython-313.pyc
mucapy/seperate/__pycache__/CollapsibleDock.cpython-313.pyc
mucapy/seperate/__pycache__/Config.cpython-313.pyc
mucapy/seperate/__pycache__/main.cpython-313.pyc
mucapy/seperate/__pycache__/MainWindow.cpython-313.pyc
mucapy/seperate/__pycache__/MultiCamYOLODetector.cpython-313.pyc
mucapy/seperate/__pycache__/NetworkCameraDialog.cpython-313.pyc
+3
View File
@@ -0,0 +1,3 @@
{
"makefile.configureOnOpen": false
}
+41
View File
@@ -0,0 +1,41 @@
MuCaPy Proprietary Software License
Version 1.0 — May 30, 2025
Copyright © 2025 Rattatwinko
All Rights Reserved.
This software, including all source code, binaries, documentation, and associated files (collectively, the "Software"), is the exclusive property of the copyright holder.
The Software is proprietary and confidential. It is licensed, not sold, solely for internal, non-commercial use by the copyright holder or explicitly authorized individuals.
1. License Grant
The copyright holder does not grant any rights to use, copy, modify, distribute, sublicense, or create derivative works from the Software except as explicitly authorized in writing.
2. Restrictions
You shall not, under any circumstances:
Redistribute the Software in any form (source or binary).
Publish, transmit, upload, or make the Software publicly available.
Reverse engineer, decompile, or disassemble the Software.
Use the Software for any commercial or revenue-generating purpose.
Share the Software with third parties, contractors, or external collaborators.
Access to the Software must remain confined to private, secure environments under the control of the copyright holder.
3. Ownership
All title, ownership rights, and intellectual property rights in and to the Software remain solely with the copyright holder.
4. Termination
Any unauthorized use of the Software automatically terminates any implied rights and may result in legal action.
5. Disclaimer of Warranty
The Software is provided "AS IS" without warranty of any kind, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or non-infringement.
6. Limitation of Liability
In no event shall the copyright holder be liable for any damages, including direct, indirect, incidental, special, or consequential damages arising out of or related to the use or inability to use the Software.
This license is not OSI-approved and must not be interpreted as open-source. For internal use only.
+2
View File
@@ -0,0 +1,2 @@
test:
PYTHONPATH=. pytest tests
+169
View File
@@ -0,0 +1,169 @@
# MuCaPy: Multi-Camera Python🎥🧠
[![Python](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://www.python.org/)
[![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)]()
[![OpenCV](https://img.shields.io/badge/OpenCV-4.x-brightgreen)](https://opencv.org/)
[![Qt](https://img.shields.io/badge/PyQt5-Used-informational)](https://riverbankcomputing.com/software/pyqt/)
[![YOLO](https://img.shields.io/badge/YOLOv4-Supported-orange)]()
---
## 📌 Overview
**MuCaPy** (Multi-Camera Python) is a modern, robust, and user-friendly real-time multi-camera object detection platform powered by **YOLOv4** and **OpenCV**, designed with a professional PyQt5 GUI. It supports both **local** and **network IP cameras**, allows dynamic camera selection, advanced configuration, and comes with a beautiful dark-themed UI. CUDA support ensures high performance where available.
---
## ✨ Features
- 🔁 Connect multiple **local USB or IP cameras**
- 💡 Real-time **YOLOv4 object detection**
- 🎛️ Intelligent UI with **PyQt5**, collapsible dock widgets, and tabbed views
- 📸 Take **screenshots** per camera feed
- ⚙️ **Model loader** for dynamic YOLO weight/config/class sets
- 🔌 **Network camera support** with authentication
- 🖥️ **Hardware monitor** (CPU and per-core utilization via `psutil`)
- 🖼️ Fullscreen camera views & dynamic layout switcher
- 💾 Persistent **configuration management**
- 🧪 **Camera connectivity test tools**
---
## 📦 Requirements
```bash
pip install -r requirements.txt
```
<details>
<summary><strong>Dependencies:</strong></summary>
- Python 3.8+
- OpenCV (cv2)
- PyQt5
- NumPy
- Requests
- psutil
</details>
---
## 🚀 Getting Started
```bash
python main.py
```
> ✅ Make sure your YOLOv4 model directory contains `.weights`, `.cfg`, and `.names` files.
---
## 📁 Model Directory Structure
This is important! If you dont have the correct directory structure, the model loader won't work.
Models are Included in the Git Repository!
```bash
model/
├── yolov4.cfg
├── yolov4.weights
└── coco.names
```
---
## 🎮 UI Highlights
- **Model Loader**: Easily select model directory
- **Camera Selection**: Mix and match local/network sources
- **Layouts**: Switch between 1, 2, 3, 4, or grid layouts
- **FPS Control**: Adjustable frame rate
- **Dark Theme**: Developer-friendly aesthetic
- **Screenshot Button**: Save current camera frame
- **Hardware Stats**: Monitor CPU load in real-time
---
## Gitea Worflow Download
You can actually download Gitea Workflow compiled code that will run on your local machine. But for this to work you need to enter one of the following commands in your terminal:
```sh
chmod a+x main # or the name of your compiled file
```
>Note: _This will only work on Linux! **( This is cause of the Gitea Runner (Which runs on Ubuntu!))** If you are on Windows you can compile it yourself with PyInstaller_
[![Watch the demo video](https://img.shields.io/badge/▶️-Click%20to%20Watch-red)](run.mp4)
---
## 🔗 Recommended YOLOv4 Model Links
- [YOLOv4.cfg](https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4.cfg)
- [YOLOv4.weights](https://github.com/AlexeyAB/darknet/releases/download/yolov4/yolov4.weights)
- [COCO.names](https://github.com/pjreddie/darknet/blob/master/data/coco.names)
---
## 🔐 Network Camera Example
Supports URLs like:
- `http://192.168.1.101:8080/video`
- `http://username:password@ip:port/stream`
Authentication is optional and can be configured per-camera.
---
## 🧪 Camera Test Tools
- Test connectivity to any selected camera
- Auto-handle reconnection on failures
- Preview all selected feeds with drag-and-drop reordering
---
## ⚙️ Configuration & Persistence
This is also Very Important if you have multiple cameras or want to save / delete your settings. You can save your settings to a file and load them later.
Settings (last model, selected cameras, layout, FPS, etc.) are saved to:
- **Linux/macOS**: `~/.config/mucapy/config.json`
- **Windows**: `%APPDATA%\MuCaPy\config.json`
---
## 📸 Screenshot Storage
Default directory: `~/Pictures/MuCaPy` (can be changed from the UI)
---
## 📖 About
> _I built MuCaPy to learn about OpenCV, Python, and to have a simple, easy-to-use camera viewer for my Camera Server, since ContaCam doesn't work on my system (not well atleast!)._
---
## 🔮 To Be Added
- **YOLOv5 / YOLOv8 / YOLO-NAS support**
- **RTSP stream handling** _( Currently works but is fuzzy / crashes easily)_
- **Real-time performance dashboards**
- **WebSocket remote monitoring**
- **Not-so-laggy UI improvements**
- **Better CUDA implementation**
---
## 📄 License
This Project is currently under a Proprietary Licsence and shouldnt be distributed!
---
## 🧑‍💻 Maintainers
- 👤 Rattatwinko
View File
+1668 -276
View File
File diff suppressed because it is too large Load Diff
+36
View File
@@ -0,0 +1,36 @@
QDialog {
background-color: #2D2D2D;
color: #DDD;
}
QLabel {
color: #DDD;
}
QGroupBox {
border: 1px solid #555;
border-radius: 6px;
margin-top: 10px;
padding: 4px;
background-color: #252525;
}
QGroupBox::title {
subcontrol-origin: margin;
left: 10px;
padding: 0 3px;
color: #DDD;
}
QPushButton {
background-color: #3A3A3A;
color: #DDD;
border: 1px solid #555;
border-radius: 4px;
padding: 5px;
min-width: 80px;
}
QPushButton:hover {
background-color: #4A4A4A;
}
+11
View File
@@ -0,0 +1,11 @@
QProgressBar {
border: 1px solid #555;
border-radius: 2px;
text-align: center;
background-color: #2A2A2A;
}
QProgressBar::chunk {
background-color: #E5A823;
width: 1px;
}
+11
View File
@@ -0,0 +1,11 @@
QProgressBar {
border: 1px solid #555;
border-radius: 2px;
text-align: center;
background-color: #2A2A2A;
}
QProgressBar::chunk {
background-color: #A23535;
width: 1px;
}
+11
View File
@@ -0,0 +1,11 @@
QProgressBar {
border: 1px solid #555;
border-radius: 2px;
text-align: center;
background-color: #2A2A2A;
}
QProgressBar::chunk {
background-color: #3A6EA5;
width: 1px;
}
+12
View File
@@ -0,0 +1,12 @@
QProgressBar {
border: 1px solid #555;
border-radius: 2px;
text-align: center;
background-color: #2A2A2A;
max-height: 12px;
}
QProgressBar::chunk {
background-color: #3A6EA5;
width: 1px;
}
+11
View File
@@ -0,0 +1,11 @@
QProgressBar {
border: 1px solid #555;
border-radius: 2px;
text-align: center;
background-color: #2A2A2A;
}
QProgressBar::chunk {
background-color: #3A6EA5;
width: 1px;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+95
View File
@@ -0,0 +1,95 @@
QMainWindow, QWidget {
background-color: #2D2D2D;
color: #DDD;
}
QLabel {
color: #DDD;
}
QPushButton {
background-color: #3A3A3A;
color: #DDD;
border: 1px solid #555;
border-radius: 4px;
padding: 5px;
}
QPushButton:hover {
background-color: #4A4A4A;
}
QPushButton:pressed {
background-color: #2A2A2A;
}
QPushButton:disabled {
background-color: #2A2A2A;
color: #777;
}
QComboBox, QSpinBox {
background-color: #3A3A3A;
color: #DDD;
border: 1px solid #555;
border-radius: 4px;
padding: 3px;
}
QGroupBox {
border: 1px solid #555;
border-radius: 4px;
margin-top: 10px;
padding-top: 15px;
background-color: #252525;
}
QGroupBox::title {
subcontrol-origin: margin;
left: 10px;
padding: 0 3px;
color: #DDD;
}
QMenuBar {
background-color: #252525;
color: #DDD;
}
QMenuBar::item {
background-color: transparent;
padding: 5px 10px;
}
QMenuBar::item:selected {
background-color: #3A3A3A;
}
QMenu {
background-color: #252525;
border: 1px solid #444;
color: #DDD;
}
QMenu::item:selected {
background-color: #3A3A3A;
}
QScrollArea {
border: none;
}
QDockWidget {
titlebar-close-icon: url(none);
titlebar-normal-icon: url(none);
}
QDockWidget::title {
background: #252525;
padding-left: 5px;
}
QToolButton {
background-color: transparent;
border: none;
}
+13
View File
@@ -0,0 +1,13 @@
{
"network_cameras": {},
"last_model_dir": "",
"last_screenshot_dir": "/home/rattatwinko/Pictures/MuCaPy",
"last_layout": 0,
"last_fps": 10,
"last_selected_cameras": [],
"window_geometry": null,
"confidence_threshold": 0.35,
"model_dir": "/home/rattatwinko/Documents/mucapy/mucapy/mucapy/models",
"fps": 10,
"layout": 0
}
+6 -4
View File
@@ -1,4 +1,6 @@
opencv-python>=4.5.0
opencv-contrib-python>=4.5.0
numpy>=1.19.0
PyQt5>=5.15.0
opencv-python==4.11.0.86
numpy==2.2.6
PyQt5==5.15.11
requests==2.32.3
psutil==7.0.0
pytest==8.4.0
BIN
View File
Binary file not shown.
+152
View File
@@ -0,0 +1,152 @@
import os
import sys
import json
import tempfile
import shutil
import unittest
from unittest.mock import patch, MagicMock
import numpy as np
# Import the classes to test
from mucapy.main import Config, CameraThread, MultiCamYOLODetector
class TestConfig(unittest.TestCase):
def setUp(self):
# Create a temporary directory for config
self.temp_dir = tempfile.mkdtemp()
self.config_file = os.path.join(self.temp_dir, 'config.json')
self.expanduser_patcher = patch('os.path.expanduser', return_value=self.temp_dir)
self.makedirs_patcher = patch('os.makedirs', return_value=None)
self.expanduser_patcher.start()
self.makedirs_patcher.start()
# Patch environment variables that may affect config path
self.env_patches = []
for var in ['APPDATA', 'USERPROFILE']:
self.env_patches.append(patch.dict(os.environ, {var: self.temp_dir}))
self.env_patches[-1].start()
self.config = Config()
self.config.config_file = self.config_file
def tearDown(self):
self.expanduser_patcher.stop()
self.makedirs_patcher.stop()
for p in self.env_patches:
p.stop()
shutil.rmtree(self.temp_dir)
def test_save_and_load_setting(self):
self.config.save_setting('test_key', 'test_value')
self.assertEqual(self.config.load_setting('test_key'), 'test_value')
# Reload config to check persistence
self.config.settings['test_key'] = None
self.config.load_config()
self.assertEqual(self.config.load_setting('test_key'), 'test_value')
def test_default_settings(self):
self.assertIn('network_cameras', self.config.settings)
self.assertIn('last_model_dir', self.config.settings)
def test_load_nonexistent_key(self):
self.assertIsNone(self.config.load_setting('nonexistent_key'))
self.assertEqual(self.config.load_setting('nonexistent_key', default=123), 123)
def test_save_invalid_json(self):
# Simulate corrupted config file
with open(self.config_file, 'w') as f:
f.write("{invalid json")
# Should not raise, should print error and keep defaults
self.config.load_config()
self.assertIn('network_cameras', self.config.settings)
class TestCameraThread(unittest.TestCase):
def setUp(self):
self.thread = CameraThread(0, {'url': 'http://192.168.1.2:4747'})
@patch('mucapy.main.CameraThread.validate_url')
def test_validate_url(self, mock_validate_url):
mock_validate_url.side_effect = lambda url: 'http://192.168.1.2:4747/video' if ':4747' in url else url
url = '192.168.1.2:4747'
validated = self.thread.validate_url(url)
self.assertEqual(validated, 'http://192.168.1.2:4747/video')
url2 = 'http://example.com/stream'
validated2 = self.thread.validate_url(url2)
self.assertEqual(validated2, url2)
def test_construct_camera_url_no_auth(self):
info = {'url': 'http://example.com/stream'}
url = self.thread.construct_camera_url(info)
self.assertEqual(url, 'http://example.com/stream')
def test_construct_camera_url_with_auth(self):
info = {'url': 'http://example.com/stream', 'username': 'user', 'password': 'pass'}
url = self.thread.construct_camera_url(info)
self.assertTrue(url.startswith('http://user:pass@'))
def test_construct_camera_url_invalid_url(self):
# Should handle invalid URL gracefully
info = {'url': '!!!not_a_url'}
url = self.thread.construct_camera_url(info)
self.assertIsInstance(url, str) # Should still return a string, possibly normalized
def test_construct_camera_url_non_dict(self):
url = self.thread.construct_camera_url('http://example.com/stream')
self.assertEqual(url, 'http://example.com/stream')
class TestMultiCamYOLODetector(unittest.TestCase):
def setUp(self):
self.detector = MultiCamYOLODetector()
def test_add_and_remove_network_camera(self):
self.detector.add_network_camera('testcam', 'http://test')
self.assertIn('testcam', self.detector.network_cameras)
self.detector.remove_network_camera('testcam')
self.assertNotIn('testcam', self.detector.network_cameras)
@patch('os.listdir', side_effect=FileNotFoundError)
def test_load_yolo_model_dir_not_found(self, mock_listdir):
result = self.detector.load_yolo_model('/nonexistent')
self.assertFalse(result)
@patch('os.listdir', return_value=['model.weights', 'model.cfg', 'model.names'])
@patch('cv2.dnn.readNet', side_effect=Exception("Failed to load net"))
def test_load_yolo_model_readnet_exception(self, mock_readnet, mock_listdir):
result = self.detector.load_yolo_model('/some/dir')
self.assertFalse(result)
@patch('os.path.exists', return_value=False)
@patch('cv2.dnn.readNet', return_value=MagicMock())
@patch('os.listdir', return_value=[])
def test_load_yolo_model_no_files(self, mock_listdir, mock_readnet, mock_exists):
result = self.detector.load_yolo_model('/nonexistent')
self.assertFalse(result)
@patch('cv2.VideoCapture')
def test_scan_for_cameras(self, mock_vc):
# Simulate one camera available
mock_instance = MagicMock()
mock_instance.isOpened.return_value = True
mock_vc.return_value = mock_instance
cams = self.detector.scan_for_cameras(max_to_check=1)
self.assertTrue(any(c.isdigit() for c in cams))
@patch('cv2.VideoCapture')
def test_scan_for_cameras_none_available(self, mock_vc):
# Simulate no cameras available
mock_instance = MagicMock()
mock_instance.isOpened.return_value = False
mock_vc.return_value = mock_instance
cams = self.detector.scan_for_cameras(max_to_check=1)
self.assertFalse(any(c.isdigit() for c in cams))
def test_connect_cameras_empty(self):
# Should not fail if given empty list
result = self.detector.connect_cameras([])
self.assertFalse(result)
def test_disconnect_cameras_noop(self):
# Should not raise if no cameras connected
self.detector.disconnect_cameras() # Should not raise
if __name__ == '__main__':
unittest.main()