Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

C++ Voronoi Art - Stained Glass Effect

Travis-CI Build Status AppVeyor Build status

Create a "stain-glass" effect using the Voronoi diagram of an image, with randomly generated points.
This project is based on methods out in the paper:

This was initially developed as a group project for Computational Geometry CS5237 course in NUS in 2013. Work on this project since then has been to polish/improve it for fun. :-)
The Voronoi Diagram is computed from the result of the Delaunay Triangulation. It's pretty slow.


Using the GUI

Load an image using the "..." button.

Select a number of points to generate.

Generate random points, either with a uniform distribution, or with a probability distribution based on detected edges.

The Voronoi diagram is computed when the "Voronoi Effect" radiobutton is selected.

Clicking "Save Image" will output the canvas to "output.bmp" in the current directory.

Project Dependencies

Various libraries used in this project include:

  • OpenGL - for drawing the image, vertices and polygons.
  • OpenCV - for computing find-edge result (& Gaussian blurs) of an image.
  • Qt 5 - for the GUI.

Building on Linux

On Ubuntu/Linux, it's fairly easy to get the above dependencies: sudo apt-get install libopencv-dev qt5-default libqt5-opengl5-dev should be enough to get all the required dependencies listed above.

Use CMake to generate a Makefile. e.g.

mkdir build
cd build
cmake -Dtest=ON ..

Building on Windows

Visual Studio 15 2017

Visual Studio 2017 (Community Edition) can be downloaded using Chocolatey:

choco install cmake visualstudio2017-installer visualstudio2017buildtools visualstudio2017community

Microsoft's excellend vcpkg can then be used to install our dependencies. (vcpkg provides the equivalent of MSYS2's use of pacman, for Visual Studio).

git clone C:\src\vcpkg
cd C:\src\vcpkg
.\vcpkg integrate install
.\vcpkg install opencv qt5

(Note that this will require "MFC and ATL support" to be installed, e.g. from the Visual Studio installer).

cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake"
cmake --build .

vcpkg will helpfully copy the necessary DLLs to the build directory, making it easy to distribute the program.

MSYS2 / MinGW-64

msys2 can be installed from Chocolatey

choco install msys2

From there, we can install dependencies with:

pacman -Syu
pacman -S \
  cmake \
  make \
  mingw-w64-x86_64-gcc \
  mingw-w64-x86_64-mesa \
  mingw-w64-x86_64-opencv \

Then, with the Mingw64 bin dir C:\tools\msys64\mingw64\bin on the PATH,

mkdir build
cd build
cmake -Dtest=ON -G "MSYS Makefiles" ..

General Project Structure

Directories within the root project folder are:

  • forms - for Qt .ui form files.
  • include - for .h, .hpp header files.
  • src - for .cpp source files.
  • test - for .cpp unit test source files.


Voronoi Art program written with OpenGL, Qt and OpenCV.







No releases published


No packages published

Contributors 4