Skip to main content

Python library for computing Harmonic Beltrami Signature(HBS)

Project description

HBS - Harmonic Beltrami Signature

This is a Python library for computing Harmonic Beltrami Signature(HBS). It provides a set of tools for boundary conditions, mesh generation, conformal welding and other mathematical problems, particularly suited for numerical computations in complex analysis.

Reference

This implementation is based on the paper:

Harmonic Beltrami Signature: A Novel 2D Shape Representation for Object Classification
Chenran Lin, Lok Ming Lui DOI: 10.1137/22M1470852

Installation

Install directly from PyPI:

pip install hbs

Or install from source:

  1. Clone this repository:
    git clone https://github.com/ChanceAroundYou/hbs_python.git
    
  2. Install dependencies:
    pip install -r requirements.txt
    

Main Modules

  • hbs.py: HBS algorithm for computing HBS and recontructing shape from HBS
  • boundary.py: Boundary processing tools
  • conformal_welding.py: Conformal welding algorithm implementation
  • mesh.py: Mesh generation and processing
  • utils/:
    • geodesic_welding.py: Geodesic welding
    • mobius.py: Möbius transformations
    • poisson.py: Poisson integral implementation
    • tool_functions.py: Utility functions
    • zipper.py: Zipper algorithm implementation
  • qc/: Quasiconformal mapping algorithms
    • bc.py: Beltrami coefficient computation
    • lsqc.py: Least squares quasiconformal mapping algorithm

Usage Example

Compute HBS from image

from hbs.boundary import get_boundary
from hbs import get_hbs

img_path = 'img/example.jpg'
bound = get_boundary(img_path, bound_point_num)
hbs, he, cw, disk = get_hbs(bound, circle_point_num, density)

Reconstruct shape from HBS

from hbs import reconstruct_from_hbs

## `disk` must be a DiskMesh corresponding to give `hbs`
bound, _, _, _ = reconstruct_from_hbs(hbs, disk)

Please also refer to example.ipynb

Dependencies

  • NumPy
  • SciPy
  • Matplotlib
  • Opencv

Contributing

Contributions are welcome via pull requests.

Code Author

  • Chenran Lin

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

hbs-0.3.1.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

hbs-0.3.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file hbs-0.3.1.tar.gz.

File metadata

  • Download URL: hbs-0.3.1.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.10

File hashes

Hashes for hbs-0.3.1.tar.gz
Algorithm Hash digest
SHA256 15aeaccf7e60111b327d0cfcad4ee0c6c02eb4831e7861ab74136f5be04ca953
MD5 65d3c5b6582520ea2d94d6babfc77fc9
BLAKE2b-256 1dd85d06d1d45071a6b27cf7bac454033b812b7dbd0a3c3cea9a277cee7e373b

See more details on using hashes here.

File details

Details for the file hbs-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: hbs-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.10

File hashes

Hashes for hbs-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c96747ac17b55521122c7f46e28bccaad0c82e76536c8eec951c6a66cef66333
MD5 a38b5b9698d3d1bce345d336daa5d443
BLAKE2b-256 6d2f34318b3bf871c88a5f7cb0b6b79925e8db471cecee7233be38b6bbf3064d

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