Skip to main content

Realtime 3D (depth) + detection pipeline for laptop cameras (OpenCV optional)

Project description

scanLt

Realtime camera pipeline for detection + monocular depth ("3D") with pluggable backends.

  • Project/package name (PyPI): scanLt3d
  • Import name (Python): scanlt3d

This library does not require OpenCV.

Install

Minimal (always works)

CPU-only, no special hardware acceleration:

pip install scanlt3d

Optional extras

You can install extra backends depending on your machine.

pip install "scanlt3d[onnx]"       # ONNX Runtime (recommended cross-platform)
pip install "scanlt3d[torch]"      # PyTorch (CUDA/MPS support)
pip install "scanlt3d[mediapipe]"  # (planned) camera source via MediaPipe

Note: Hardware acceleration depends on which runtime is installed and available on your system (CUDA/DirectML/MPS).

Quickstart (works immediately)

import scanlt

# Runs a realtime loop with a built-in dummy camera source.
# This ensures `import + run()` never fails even if no webcam/backend is available.
scanlt.run()

Use by hardware (CPU / NVIDIA / Windows iGPU / Mac M)

scanLt can auto-detect the best available backend:

import scanlt

print(scanlt.choose_backend())

1) CPU (Intel/AMD)

Install:

pip install scanlt3d
# recommended runtime
pip install "scanLt[onnx]"

What to expect:

  • Best compatibility.
  • Realtime depends heavily on your detector/depth model sizes.
  • Use lower resolution / run depth less frequently for higher FPS.

2) NVIDIA GPU (CUDA)

Two typical options:

  • ONNX Runtime CUDA (best for ONNX models)
  • PyTorch CUDA (best for torch models)

Install (choose one):

# Option A: PyTorch CUDA
pip install "scanLt[torch]"

# Option B: ONNX Runtime (you must install a CUDA-enabled onnxruntime build)
pip install "scanLt[onnx]"

Notes:

  • If choose_backend() returns cuda, scanLt detected a CUDA-capable runtime.
  • CUDA packaging varies by OS/driver; if CUDA runtime is not available, scanLt falls back to CPU.

3) Windows Intel/AMD iGPU (DirectML)

scanLt can pick dml if your ONNX Runtime installation exposes a DirectML provider.

Install:

pip install "scanLt[onnx]"

Notes:

  • DirectML is Windows-specific.
  • If DirectML is not available, scanLt falls back to CPU.

4) macOS Apple Silicon (M1/M2/M3)

Install:

pip install scanlt3d
pip install "scanLt[torch]"

Notes:

  • scanLt will try to use mps if PyTorch MPS is available.
  • If MPS is not available or unsupported by the model, it falls back to CPU.

Force backend (override auto-detect)

You can override backend selection via environment variable:

  • SCAN3D_BACKEND=cpu
  • SCAN3D_BACKEND=cuda
  • SCAN3D_BACKEND=dml
  • SCAN3D_BACKEND=mps

Example:

# Windows PowerShell
setx SCAN3D_BACKEND cuda

(Then restart your terminal.)

Provide your own detector/depth

scanLt is designed to let you plug in your own models.

Minimal interfaces

  • Detector.predict(frame) -> list[Detection]
  • DepthEstimator.predict(frame, detections=None) -> depth_map

Example

import scanlt

class MyDetector:
    def predict(self, frame):
        # return list of scanlt.api.Detection
        return []

class MyDepth:
    def predict(self, frame, detections=None):
        import numpy as np
        h, w = frame.shape[:2]
        return np.zeros((h, w), dtype=np.float32)


def on_result(res):
    # res.frame: np.ndarray (H,W,3)
    # res.detections: list
    # res.depth: np.ndarray (H,W) or None
    # res.fps: float
    print(res.fps)


scanlt.run(detector=MyDetector(), depth=MyDepth(), on_result=on_result, max_frames=100)

Troubleshooting

pip install succeeds but choose_backend() is still CPU

This usually means:

  • CUDA / DirectML / MPS runtime is not installed or not detected
  • your model runtime doesn't support the needed execution provider

scanLt will always fall back to CPU to stay usable.

I want real webcam input

Current default run() uses a dummy source. For real camera sources, you will plug in a FrameSource (or enable the MediaPipe source once implemented).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scanlt3d-0.1.3.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scanlt3d-0.1.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file scanlt3d-0.1.3.tar.gz.

File metadata

  • Download URL: scanlt3d-0.1.3.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for scanlt3d-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c3472450faa9ea6dc57651da0361d5bfda18e635e44eecec64eec31ef95f80c4
MD5 ec3624254caa972805bba194c8b2036d
BLAKE2b-256 6ca87fb37361778b4c6a688d11aba3237b933ba026a1cb6b875d3978dc05fc2a

See more details on using hashes here.

File details

Details for the file scanlt3d-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: scanlt3d-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for scanlt3d-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d9d55a0bc0892828d64ac252124ca5b816915485174401360acc3f5660071da2
MD5 d5f424011e9f851d4d95c04309af7ad2
BLAKE2b-256 76bcf0a2466425fa2f41c27fc28bce3a11d11edd191c3f0c63f0c0a0eaad90d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page