Skip to main content

A fast Visual Hull implementation

Project description

torchhull: A fast Visual Hull implementation

PyPI - Version PyPI - Python Version GitHub License GitHub License Lint Documentation

torchhull is an extremely fast Torch C++/CUDA implementation for computing visual hulls from mask images and comes with Python bindings through charonload:

  • ⚡ Up to real-time capable speed depending on chosen resolution
  • 🗜️ Memory-efficient computation by constructing sparse voxel octrees
  • 🌊 Watertight mesh generation via Marching Cubes
  • 🛠️ Support for partially visible objects, i.e. clipped mask images, and fully observed objects

In particular, torchhull is a GPU implementation of the following paper:

@article{scharr2017fast,
  title={{Fast High Resolution Volume Carving for 3D Plant Shoot Reconstruction}},
  author={Scharr, Hanno and Briese, Christoph and Embgenbroich, Patrick and Fischbach, Andreas and Fiorani, Fabio and M{\"u}ller-Linow, Mark},
  journal={Frontiers in Plant Science},
  volume={8},
  pages={303692},
  year={2017},
  publisher={Frontiers}
}

Installation

torchhull requires the following prerequites (for JIT compilation):

  • Python >= 3.9
  • CUDA >= 12.1
  • C++17 compiler

The package itself can be installed from PyPI:

pip install torchhull

Quick Start

torchhull gets as input mask images with camera information:

  • masks: Single-channel images M with binary values {0, 1}.
  • transforms: Fused extrinsic and intrinsic matrix K * T, i.e. transformation from world coordinates to OpenGL clip space (right before perspective division).

The visual hull is then evaluated inside a cube with bottom-front-left corner cube_corner_bfl and extent cube_length at extracted at octree level level. The remaining flags control how the output mesh (verts, faces) should look like.

import torchhull

verts, faces = torchhull.visual_hull(masks,  # [B, H, W, 1]
                                     transforms,  # [B, 4, 4]
                                     level,
                                     cube_corner_bfl,
                                     cube_length,
                                     masks_partial=False,
                                     unique_verts=True,
                                    )

License

This software is provided under MIT license, with parts under BSD 3-Clause license. See LICENSE for more information.

Contact

Patrick Stotko - stotko@cs.uni-bonn.de

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

torchhull-0.1.0.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

torchhull-0.1.0-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file torchhull-0.1.0.tar.gz.

File metadata

  • Download URL: torchhull-0.1.0.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for torchhull-0.1.0.tar.gz
Algorithm Hash digest
SHA256 04ecad5908db0d304d8f49556042f3545261ffd9c6c765e8b57f18d38896a3e0
MD5 6b8825a1571cc174b968df87ab2d4c6d
BLAKE2b-256 404a1940908d4a3698db70c460cf7f44afabed4ec7e9de78d75bfd5b3815af83

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchhull-0.1.0.tar.gz:

Publisher: pypi.yml on vc-bonn/torchhull

Attestations:

File details

Details for the file torchhull-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: torchhull-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for torchhull-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8446215f675ffcfd52f2d4646d1f3de09e6ae03578bf0bd355935a299e33d12a
MD5 a975c9983e7f84c956b8cc1c158ea8a9
BLAKE2b-256 42233b16235a13a21f83796b1667eae2ec0e9d8e7eb66335244ac7e0357267c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchhull-0.1.0-py3-none-any.whl:

Publisher: pypi.yml on vc-bonn/torchhull

Attestations:

Supported by

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