torchhull: A fast Visual Hull implementation
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
- 🎈 Smooth surfaces with sparse Gaussian blur preprocessing tailored for mask images
- 🛠️ 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.10
- 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 imagesMwith binary values {0, 1}.transforms: Fused extrinsic and intrinsic matrixK * T, i.e. from world coordinates to image coordinates (right before perspective division), either in OpenGL or OpenCV convention.
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
# Optional
masks = torchhull.gaussian_blur(masks, # [B, H, W, 1]
kernel_size,
sigma,
sparse=True,
)
verts, faces = torchhull.visual_hull(masks, # [B, H, W, 1]
transforms, # [B, 4, 4]
level,
cube_corner_bfl,
cube_length,
masks_partial=False,
transforms_convention="opengl",
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
Metadata
Release files for torchhull 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| torchhull-0.3.0.tar.gz | 40.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| torchhull-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 81.2 kB
Release files / torchhull-0.3.0.tar.gz
| Download URL | torchhull-0.3.0.tar.gz |
|---|---|
| Size | 40.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bb8b6434a9b8b1a7fac09cc3792ac48fe59fc2135554f4ca0b5a1748c0a0be9
|
|
BLAKE2b-256 checksum How to use checksums |
84943c371815f669a9f93a7eaebfe472eedcaced7be9b9377f5e63412696b673
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 19, 2025.
Transparency logRelease files / torchhull-0.3.0-py3-none-any.whl
| Download URL | torchhull-0.3.0-py3-none-any.whl |
|---|---|
| Size | 40.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38d9bf82d33f86fd330363ea2c1b3cff044771d26c0ebe1e54ca4ea03dc01af6
|
|
BLAKE2b-256 checksum How to use checksums |
abb011c4417fc8e87e2cc4a1f5865b1dcb2c7cb672f8da6e6c99522ce3ba1d97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 19, 2025.
Transparency log