A fast library for image lowpoly generation based on centroid voronoi diagram
Project description
CVTLowpoly: Image Lowpoly via Centroid Voronoi Diagram
Image Sharp Feature Extraction using Guide Filter's Local Linear Theory via opencv-python.
The Following two parts are bollowed from https://github.com/songshibo/JumpFlooding-taichi
2D/3D Voronoi tessellation using Jump Flooding algorithm(JFA). Adopt 1+JFA strategy to reduce errors.
2D Centroidal Voronoi Tessellation using Lloyd algorithm.
Installation
The Python package can be installed with Pypi:
pip install CVTLowpoly
Usage
import cv2, CVTLowpoly
img = cv2.imread(filename, cv2.IMREAD_ANYCOLOR)
# case1: get triangle mesh
V, F, _sharp_image = CVTLowpoly.lowpoly_mesh(img)
# case2: get lowpoly image and triangle mesh
lowpoly_img, V, F, FColor = CVTLowpoly.lowpoly_image(img)
Results
- Case 1: Source Image: 550x825(pixels: 453750), 1% sites
Source Image | CVTLowpoly(iterations: 5, time: 1.7108s on MacPro2017 i5) |
---|---|
- Case 2: Source Image: 550x828(pixels: 455400), 1% sites
Source Image | CVTLowpoly(iterations: 5, time: 2.0708s on MacPro2017 i5) |
---|---|
- Case 3: Source Image: 550x825(pixels: 453750), 1% sites
Source Image | CVTLowpoly(iterations: 5, time: 0.7505s on MacPro2017 i5) |
---|---|
- Case 4: Source Image: 1193x834(pixels: 994962), 1% sites
Source Image | CVTLowpoly(iterations: 5, time: 2.889s on MacPro2017 i5) |
---|---|
- Case 5: Source Image: 1193x834(pixels: 691200), 1% sites
Source Image | CVTLowpoly(iterations: 5, time: 2.763s on MacPro2017 i5) |
---|---|
Reference
Jump flooding in GPU with applications to Voronoi diagram and distance transform
GPU-Assisted Computation of Centroidal Voronoi Tessellation
Variants of Jump Flooding Algorithm for Computing Discrete Voronoi Diagrams
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for CVTLowpoly-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23eb1cbed1c99d14f22c02ff86caa48a62966a2cfaeb2073b8cf770c485c82e3 |
|
MD5 | 58374b7eca8eeaa6cc7392ee82d3b667 |
|
BLAKE2b-256 | 0fcf262b1cdf8677d4828ab710d9aef2683e6dd02f8dd091bde2b50202c8d64a |