Skip to main content

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
  • conformal_welding.py: Conformal welding algorithm implementation
  • mesh.py: Mesh generation and processing
  • utils/:
    • boundary.py: Boundary processing tools
    • 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.utils.boundary import get_boundary
from hbs import get_hbs

# Boundary points extraction
# 
# we don't actually restrict the method of boundary extraction,
# but this package provides a simple implementation as follows
img_path = 'img/example.jpg'
circle_point_num = 1000
bound = get_boundary(img_path, bound_point_num)

# HBS computing
# 
# it requires boundary points arranged in clockwise order as input, in `np.complex`
density = 0.01
bound_point_num = 250
hbs, hbs_mapping, 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)

Compute conformal welding from image

from hbs.utils.boundary import get_boundary
from hbs.conformal_welding import get_conformal_welding

# Boundary points extraction
img_path = 'img/example.jpg'
bound_point_num = 250
bound = get_boundary(img_path, bound_point_num)

# Conformal welding computing
# 
# it also requires boundary points arranged in clockwise order as input, in `np.complex`
cw = get_conformal_welding(bound)

Please also refer to example.ipynb

Dependencies

  • NumPy
  • SciPy
  • Matplotlib
  • Opencv

Contributing

Contributions are welcome via pull requests.

Code Author

  • Chenran Lin

Metadata

Release files for hbs 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hbs 1.0.2
File Size Uploaded Provenance Actions
hbs-1.0.2.tar.gz 16.4 kB Without provenance Details for hbs-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hbs 1.0.2
File Interpreter ABI Platform Actions
hbs-1.0.2-py3-none-any.whl Python 3 none any Details for hbs-1.0.2-py3-none-any.whl

Total release size: 34.9 kB

Release files / hbs-1.0.2.tar.gz

Download URL hbs-1.0.2.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b101e8597088d11e754a81f92ef91292b79b45250a567603135285397ecf580a
BLAKE2b-256 checksum
How to use checksums
0ed82bee87b0603a05be63f22a71c80fdeb4f3731571890de60dd9c229512077
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / hbs-1.0.2-py3-none-any.whl

Download URL hbs-1.0.2-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0499292526be9739e2a1574b3097cd64e96d77ed69f69e7c6841611ccf3a8ac
BLAKE2b-256 checksum
How to use checksums
cc9acb7493adf424b8751d668f0f13d0c949b97c3baf3bb3a09eeb614550a32c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for hbs 1.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page