Metadata-Version: 2.4
Name: pixcurve
Version: 0.1.0
Summary: Bridge labeled pixel masks and compact Bezier-style polygon curves
Keywords: image-processing,opencv,bezier,segmentation,geometry
Author: pixcurve contributors
License-Expression: MIT
License-File: LICENSE
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: C++
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.9
Requires-Dist: numpy>=2
Requires-Dist: Pillow>=10
Description-Content-Type: text/markdown

# pixcurve

High-performance C++ conversion from labeled pixel masks to compact Bezier-style polygons.

Input is a single-channel `uint8` label mask where background is `0`.
Output is JSON-compatible polygons keyed by label value.

## Install

```bash
python -m pip install pixcurve
```

For local development from source:

```bash
python -m pip install -e .
```

If a prebuilt wheel is not available for your platform, installation from source requires:

- CMake
- a C++20 compiler
- OpenCV development libraries available to CMake

## Python API

```python
import numpy as np
from PIL import Image

from pixcurve import mask_to_bezier

mask = np.asarray(Image.open("mask.png").convert("L"), dtype=np.uint8)
polygons = mask_to_bezier(mask)
```

Output shape:

```json
{"11":[[[x,y],[x,y]]],"16":[[[x,y],[x,y]]]}
```

## CLI

```bash
pixcurve path/to/mask.png > polygons.json
```

## Example

```bash
python examples/convert_mask.py path/to/mask.png > polygons.json
```

## Native C++ Binary

```bash
cmake -S src_cpp -B src_cpp/build -DCMAKE_BUILD_TYPE=Release
cmake --build src_cpp/build -j
./src_cpp/build/mask_to_bezier_cpp path/to/mask.png
```

## Tests

```bash
python -m unittest discover -s tests
cmake -S src_cpp -B src_cpp/build -DCMAKE_BUILD_TYPE=Release
cmake --build src_cpp/build -j
ctest --test-dir src_cpp/build --output-on-failure
```

## Publishing checklist

```bash
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
```

Then upload to TestPyPI first:

```bash
python -m twine upload --repository testpypi dist/*
```
