Skip to main content

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

JumpFlooding-taichi

Semi-Isotropic Triangular Image Lowpoly

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CVTLowpoly-1.0.2.tar.gz (9.1 kB view hashes)

Uploaded Source

Built Distribution

CVTLowpoly-1.0.2-py3-none-any.whl (10.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page