3D object detection and spatial mapping using webcam
Project description
Spatial Detector
A Python package for 3D object detection and spatial mapping using a webcam.
Features
- YOLO-based object detection
- MiDaS depth estimation
- 3D spatial mapping and localization
- Top-down view visualization
- Depth calibration for accurate measurements
- Designed for Apple Silicon and CUDA GPUs
Installation
pip install spatial-detector
Or install from source:
git clone https://github.com/yourusername/spatial-detector.git
cd spatial-detector
pip install -e .
Usage
Command Line Interface
# Basic usage
spatial-detector
# With custom settings
spatial-detector --camera 0 --yolo-model yolov8n.pt --device mps
As a Python Library
from spatial_detector.detection import YOLODetector
from spatial_detector.depth import MiDaSDepthEstimator
from spatial_detector.mapping import SpatialMap, DepthCalibrator
# Initialize components
detector = YOLODetector(model_path="yolov8n.pt")
depth_estimator = MiDaSDepthEstimator()
spatial_map = SpatialMap()
# Process a frame
detections = detector.detect(frame)
depth_map, _ = depth_estimator.estimate_depth(frame)
Controls
q: Quitd: Toggle depth visualizationl: Toggle labelsc: Enter calibration mode+/-: Adjust calibration distancespace: Set calibration point in calibration modes: Save depth calibration
Calibration
For accurate measurements:
- Press
cto enter calibration mode - Place an object at a known distance (e.g., 1 meter from camera)
- Use
+/-to set the correct distance - Align the object with the center crosshair
- Press
spaceto calibrate - Press
sto save the calibration
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spatial_detector-0.1.0.tar.gz
(14.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spatial_detector-0.1.0.tar.gz.
File metadata
- Download URL: spatial_detector-0.1.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e51ece3fd12cd8d779841c97326e459b1b59f7b2b9da69fbeb877ff1c365900
|
|
| MD5 |
c2479d93ae509d06e49574b9c2d8d52a
|
|
| BLAKE2b-256 |
556e8e95783d7deae10fcc2bcd6ea40c14edb33e789f9219646ee84d83e8f9b6
|
File details
Details for the file spatial_detector-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spatial_detector-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f7a4f484d15aeccf363d35d4a6e252573d43a8b1fde08e17a1e779fde032392
|
|
| MD5 |
effc6ff9f82c40759dd5dd3ec3b9826b
|
|
| BLAKE2b-256 |
9ffa5aaec586d69ebc3a08ed77028e3350bc6ba798ef3c797c421fcbed8175c5
|