Compare commits
4 Commits
7cf156baea
...
c74972ce0e
Author | SHA1 | Date |
---|---|---|
|
c74972ce0e | |
|
f0fae811d8 | |
|
42687f5bd9 | |
|
c1a6dc693d |
20
README.md
20
README.md
|
@ -98,7 +98,7 @@ Users are expected to use this software responsibly and legally. If using a real
|
||||||
|
|
||||||
## Installation (Manual)
|
## Installation (Manual)
|
||||||
|
|
||||||
**Please be aware that the installation requires technical skills and is not for beginners. Consider downloading the prebuilt version.**
|
**Please be aware that the installation requires technical skills and is not for beginners. Consider downloading the quickstart version.**
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Click to see the process</summary>
|
<summary>Click to see the process</summary>
|
||||||
|
@ -109,7 +109,7 @@ This is more likely to work on your computer but will be slower as it utilizes t
|
||||||
|
|
||||||
**1. Set up Your Platform**
|
**1. Set up Your Platform**
|
||||||
|
|
||||||
- Python (3.10 recommended)
|
- Python (3.11 recommended)
|
||||||
- pip
|
- pip
|
||||||
- git
|
- git
|
||||||
- [ffmpeg](https://www.youtube.com/watch?v=OlNWCpFdVMA) - ```iex (irm ffmpeg.tc.ht)```
|
- [ffmpeg](https://www.youtube.com/watch?v=OlNWCpFdVMA) - ```iex (irm ffmpeg.tc.ht)```
|
||||||
|
@ -153,14 +153,14 @@ pip install -r requirements.txt
|
||||||
Apple Silicon (M1/M2/M3) requires specific setup:
|
Apple Silicon (M1/M2/M3) requires specific setup:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install Python 3.10 (specific version is important)
|
# Install Python 3.11 (specific version is important)
|
||||||
brew install python@3.10
|
brew install python@3.11
|
||||||
|
|
||||||
# Install tkinter package (required for the GUI)
|
# Install tkinter package (required for the GUI)
|
||||||
brew install python-tk@3.10
|
brew install python-tk@3.10
|
||||||
|
|
||||||
# Create and activate virtual environment with Python 3.10
|
# Create and activate virtual environment with Python 3.11
|
||||||
python3.10 -m venv venv
|
python3.11 -m venv venv
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
|
@ -236,7 +236,7 @@ python3.10 run.py --execution-provider coreml
|
||||||
# Uninstall conflicting versions if needed
|
# Uninstall conflicting versions if needed
|
||||||
brew uninstall --ignore-dependencies python@3.11 python@3.13
|
brew uninstall --ignore-dependencies python@3.11 python@3.13
|
||||||
|
|
||||||
# Keep only Python 3.10
|
# Keep only Python 3.11
|
||||||
brew cleanup
|
brew cleanup
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ python3.10 run.py --execution-provider coreml
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip uninstall onnxruntime onnxruntime-coreml
|
pip uninstall onnxruntime onnxruntime-coreml
|
||||||
pip install onnxruntime-coreml==1.13.1
|
pip install onnxruntime-coreml==1.21.0
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Usage:
|
2. Usage:
|
||||||
|
@ -261,7 +261,7 @@ python run.py --execution-provider coreml
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip uninstall onnxruntime onnxruntime-directml
|
pip uninstall onnxruntime onnxruntime-directml
|
||||||
pip install onnxruntime-directml==1.15.1
|
pip install onnxruntime-directml==1.21.0
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Usage:
|
2. Usage:
|
||||||
|
@ -276,7 +276,7 @@ python run.py --execution-provider directml
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip uninstall onnxruntime onnxruntime-openvino
|
pip uninstall onnxruntime onnxruntime-openvino
|
||||||
pip install onnxruntime-openvino==1.15.0
|
pip install onnxruntime-openvino==1.21.0
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Usage:
|
2. Usage:
|
||||||
|
|
|
@ -799,73 +799,39 @@ def webcam_preview(root: ctk.CTk, camera_index: int):
|
||||||
|
|
||||||
|
|
||||||
def get_available_cameras():
|
def get_available_cameras():
|
||||||
"""Returns a list of available camera names and indices."""
|
"""
|
||||||
|
Safe camera detection for macOS and Unix-like systems that avoids threading and AVX crashes.
|
||||||
|
Returns a tuple of (camera_indices, camera_names).
|
||||||
|
"""
|
||||||
|
import cv2
|
||||||
|
import platform
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
try:
|
try:
|
||||||
|
from pygrabber.dshow_graph import FilterGraph
|
||||||
graph = FilterGraph()
|
graph = FilterGraph()
|
||||||
devices = graph.get_input_devices()
|
devices = graph.get_input_devices()
|
||||||
|
|
||||||
# Create list of indices and names
|
|
||||||
camera_indices = list(range(len(devices)))
|
camera_indices = list(range(len(devices)))
|
||||||
camera_names = devices
|
camera_names = devices
|
||||||
|
|
||||||
# If no cameras found through DirectShow, try OpenCV fallback
|
|
||||||
if not camera_names:
|
|
||||||
# Try to open camera with index -1 and 0
|
|
||||||
test_indices = [-1, 0]
|
|
||||||
working_cameras = []
|
|
||||||
|
|
||||||
for idx in test_indices:
|
|
||||||
cap = cv2.VideoCapture(idx)
|
|
||||||
if cap.isOpened():
|
|
||||||
working_cameras.append(f"Camera {idx}")
|
|
||||||
cap.release()
|
|
||||||
|
|
||||||
if working_cameras:
|
|
||||||
return test_indices[: len(working_cameras)], working_cameras
|
|
||||||
|
|
||||||
# If still no cameras found, return empty lists
|
|
||||||
if not camera_names:
|
if not camera_names:
|
||||||
return [], ["No cameras found"]
|
return [], ["No cameras found"]
|
||||||
|
|
||||||
return camera_indices, camera_names
|
return camera_indices, camera_names
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error detecting cameras: {str(e)}")
|
print(f"[Camera Detection Error - Windows]: {e}")
|
||||||
return [], ["No cameras found"]
|
return [], ["No cameras found"]
|
||||||
else:
|
|
||||||
# Unix-like systems (Linux/Mac) camera detection
|
|
||||||
camera_indices = []
|
|
||||||
camera_names = []
|
|
||||||
|
|
||||||
if platform.system() == "Darwin": # macOS specific handling
|
# macOS or Linux
|
||||||
# Try to open the default FaceTime camera first
|
try:
|
||||||
|
print("[Info] Safely checking for available cameras...")
|
||||||
cap = cv2.VideoCapture(0)
|
cap = cv2.VideoCapture(0)
|
||||||
if cap.isOpened():
|
if cap is None or not cap.isOpened():
|
||||||
camera_indices.append(0)
|
print("[Warning] Default camera (index 0) not available.")
|
||||||
camera_names.append("FaceTime Camera")
|
return [], ["No cameras found"]
|
||||||
cap.release()
|
cap.release()
|
||||||
|
return [0], ["Default Camera (Index 0)"]
|
||||||
# On macOS, additional cameras typically use indices 1 and 2
|
except Exception as e:
|
||||||
for i in [1, 2]:
|
print(f"[Camera Detection Error - Unix]: {e}")
|
||||||
cap = cv2.VideoCapture(i)
|
|
||||||
if cap.isOpened():
|
|
||||||
camera_indices.append(i)
|
|
||||||
camera_names.append(f"Camera {i}")
|
|
||||||
cap.release()
|
|
||||||
else:
|
|
||||||
# Linux camera detection - test first 10 indices
|
|
||||||
for i in range(10):
|
|
||||||
cap = cv2.VideoCapture(i)
|
|
||||||
if cap.isOpened():
|
|
||||||
camera_indices.append(i)
|
|
||||||
camera_names.append(f"Camera {i}")
|
|
||||||
cap.release()
|
|
||||||
|
|
||||||
if not camera_names:
|
|
||||||
return [], ["No cameras found"]
|
return [], ["No cameras found"]
|
||||||
|
|
||||||
return camera_indices, camera_names
|
|
||||||
|
|
||||||
|
|
||||||
def create_webcam_preview(camera_index: int):
|
def create_webcam_preview(camera_index: int):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
--extra-index-url https://download.pytorch.org/whl/cu118
|
--extra-index-url https://download.pytorch.org/whl/cu128
|
||||||
|
|
||||||
numpy>=1.23.5,<2
|
numpy>=1.23.5,<2
|
||||||
typing-extensions>=4.8.0
|
typing-extensions>=4.8.0
|
||||||
|
@ -10,12 +10,12 @@ psutil==5.9.8
|
||||||
tk==0.1.0
|
tk==0.1.0
|
||||||
customtkinter==5.2.2
|
customtkinter==5.2.2
|
||||||
pillow==11.1.0
|
pillow==11.1.0
|
||||||
torch==2.5.1+cu118; sys_platform != 'darwin'
|
torch; sys_platform != 'darwin'
|
||||||
torch==2.5.1; sys_platform == 'darwin'
|
torch==2.5.1; sys_platform == 'darwin'
|
||||||
torchvision==0.20.1; sys_platform != 'darwin'
|
torchvision; sys_platform != 'darwin'
|
||||||
torchvision==0.20.1; sys_platform == 'darwin'
|
torchvision==0.20.1; sys_platform == 'darwin'
|
||||||
onnxruntime-silicon==1.16.3; sys_platform == 'darwin' and platform_machine == 'arm64'
|
onnxruntime-silicon==1.21.0; sys_platform == 'darwin' and platform_machine == 'arm64'
|
||||||
onnxruntime-gpu==1.17; sys_platform != 'darwin'
|
onnxruntime-gpu==1.21.0; sys_platform != 'darwin'
|
||||||
tensorflow; sys_platform != 'darwin'
|
tensorflow; sys_platform != 'darwin'
|
||||||
opennsfw2==0.10.2
|
opennsfw2==0.10.2
|
||||||
protobuf==4.23.2
|
protobuf==4.23.2
|
||||||
|
|
Loading…
Reference in New Issue