$ account pymatting
PyMatting is a Python library for alpha matting: given an RGB image and a trimap that coarsely labels foreground, background, and unknown pixels, it estimates per-pixel foreground opacity (an alpha matte) and can extract a foreground cutout. The primary production entry points are the high-level `cutout()` function and the `pymatting` CLI, both of which pair closed-form alpha matting with multi-level foreground estimation. Below that, the library exposes a structured numerical toolbox: six alpha estimation algorithms (closed-form, KNN, large-kernel, learning-based, random-walk, and shared matting), multiple matting Laplacian constructions, foreground estimation on CPU/GPU, preconditioners, and a custom conjugate-gradient solver. The architecture is a modular Python package built on NumPy, SciPy, and Numba, with optional CuPy and PyOpenCL GPU backends for foreground estimation only.