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 Build 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
  • 🎈 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 images M with binary values {0, 1}.
  • transforms: Fused extrinsic and intrinsic matrix K * 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

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.3.0.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

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

torchhull-0.3.0-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: torchhull-0.3.0.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for torchhull-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9bb8b6434a9b8b1a7fac09cc3792ac48fe59fc2135554f4ca0b5a1748c0a0be9
MD5 3e70afb5109d68202426983392417963
BLAKE2b-256 84943c371815f669a9f93a7eaebfe472eedcaced7be9b9377f5e63412696b673

See more details on using hashes here.

Provenance

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

Publisher: pypi.yml on vc-bonn/torchhull

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: torchhull-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for torchhull-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38d9bf82d33f86fd330363ea2c1b3cff044771d26c0ebe1e54ca4ea03dc01af6
MD5 7753b147d1bba76b93358b6fc3662acf
BLAKE2b-256 abb011c4417fc8e87e2cc4a1f5865b1dcb2c7cb672f8da6e6c99522ce3ba1d97

See more details on using hashes here.

Provenance

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

Publisher: pypi.yml on vc-bonn/torchhull

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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