spectralbrain.spectral.collections#

Collection-aware spectral descriptors.

These descriptors operate on pairs or collections of shapes rather than single shapes. They quantify how a shape deforms relative to a reference or within a cohort.

Implemented#

  • Shape Difference Operator — captures the spectral change between two shapes via functional maps.

  • DWKS — Deformation Wave Kernel Signature (Magnet & Ovsjanikov, ICCV 2021): applies the WKS filter to shape-difference operators to produce a pointwise deformation descriptor.

Functions

compute_dwks(decomp_source, decomp_target, *)

Deformation Wave Kernel Signature.

compute_dwks_collection(reference, collection, *)

Compute DWKS for each shape in a collection against a reference.

compute_functional_map(decomp_a, decomp_b, *)

Estimate a functional map C between two shapes.

shape_difference_operator(C, *[, type])

Compute a shape-difference operator from a functional map.

spectralbrain.spectral.collections.compute_dwks(decomp_source, decomp_target, *, n_basis=30, n_energies=50, sigma=None, diff_type='area', descriptor_pairs=None)[source]#

Deformation Wave Kernel Signature.

Applies the WKS band-pass filter to the eigenvalues of a shape-difference operator, producing a pointwise descriptor of deformation at each vertex.

Unlike HKS/WKS which describe geometry, DWKS describes how geometry changed between two shapes.

Parameters:
  • decomp_source (SpectralDecomposition) – Source (reference) shape.

  • decomp_target (SpectralDecomposition) – Target (deformed) shape.

  • n_basis (int) – Functional map truncation.

  • n_energies (int) – Number of WKS energy levels applied to the difference operator spectrum.

  • sigma (float, optional) – WKS bandwidth. None = auto.

  • diff_type (str) – Shape-difference type ("area" or "conformal").

  • descriptor_pairs (list, optional) – Descriptor correspondences for functional map estimation.

Returns:

ndarray, shape (N_source, n_energies) – Per-vertex deformation descriptor on the source shape.

Return type:

ndarray[tuple[Any, …], dtype[floating]]

References

Magnet R, Ovsjanikov M. DWKS: A Local Descriptor of Deformations Between Meshes and Point Clouds. ICCV 2021.

spectralbrain.spectral.collections.compute_dwks_collection(reference, collection, *, n_basis=30, n_energies=50, diff_type='area')[source]#

Compute DWKS for each shape in a collection against a reference.

Parameters:
Returns:

dict of {name (ndarray}) – DWKS descriptor per shape.

Return type:

dict[str, ndarray[tuple[Any, …], dtype[floating]]]

spectralbrain.spectral.collections.compute_functional_map(decomp_a, decomp_b, *, n_basis=30, descriptor_pairs=None, regularize=0.001)[source]#

Estimate a functional map C between two shapes.

The functional map C : F(M_a) → F(M_b) is represented in the truncated eigenbasis as a (n_basis × n_basis) matrix satisfying:

Φ_b^T · M_b · f_b ≈ C · (Φ_a^T · M_a · f_a)

for corresponding functions f_a, f_b.

Parameters:
  • decomp_a (SpectralDecomposition) – Source and target spectral decompositions.

  • decomp_b (SpectralDecomposition) – Source and target spectral decompositions.

  • n_basis (int) – Truncation size for the functional map.

  • descriptor_pairs (list of (ndarray, ndarray), optional) – Pairs of corresponding descriptors (f_a, f_b) on the two shapes. If None, uses HKS at several time-scales as default correspondence signals.

  • regularize (float) – Tikhonov regularisation weight.

Returns:

C (ndarray, shape (n_basis, n_basis)) – Functional map matrix.

Return type:

ndarray

spectralbrain.spectral.collections.shape_difference_operator(C, *, type='area')[source]#

Compute a shape-difference operator from a functional map.

Parameters:
  • C (ndarray, shape (k, k)) – Functional map from shape A to shape B.

  • type (str) – "area" — D_area = C^T · C (captures area distortion). "conformal" — D_conf = C^T · Λ_B · C · Λ_A^{-1} (simplified: uses C^T · C − I to capture conformal distortion).

Returns:

D (ndarray, shape (k, k)) – Shape-difference operator (symmetric positive semi-definite for area type).

Return type:

ndarray

References

Rustamov RM, Ovsjanikov M, Azencot O, Ben-Chen M, Chazal F, Guibas LJ. Map-based exploration of intrinsic shape differences and variability. ACM TOG 32(4):72, 2013.