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
python -m pip install pixcurve
For local development from source:
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
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:
{"11":[[[x,y],[x,y]]],"16":[[[x,y],[x,y]]]}
CLI
pixcurve path/to/mask.png > polygons.json
Example
python examples/convert_mask.py path/to/mask.png > polygons.json
Native C++ Binary
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
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
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
Then upload to TestPyPI first:
python -m twine upload --repository testpypi dist/*
Metadata
Release files for pixcurve 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pixcurve-0.1.0.tar.gz | 16.7 kB | Details |
Release files / pixcurve-0.1.0.tar.gz
| Download URL | pixcurve-0.1.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec5800e81c6e8b80fc3a442e13b6efb45f03021f0d936295adcc33c1f31633cb
|
|
BLAKE2b-256 checksum How to use checksums |
d469a7b02252c1a4eaf77142cbf47a33ba8c830181e893824a475f91383afac1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|