Source code of "Geometric Total Variation for Image Vectorization, Zooming and Pixel Art Depixelizing" authored by Bertrand Kerautret and Jacques-Oliver Lachaud (2019)
You can also access to IPOL online demonstration here
Build status:
To use this source code, you need to install the following dependencies:
- DGTal library (current version or at least commit 0e13036), on Linux/Mac just follow these steps:
- Install (if not already present), the boost dependancies (see https://www.boost.org).
For instance on linux you can install the following package: sudo apt-get install
libboost-dev libboost-system-dev libboost-program-options-dev
(thelibboost-program-options-dev
is not mandatory for DGtal but is used by our project) git clone [email protected]:DGtal-team/DGtal.git
cd DGtal; mkdir build; cd build
cmake .. -DCMAKE_POLICY_DEFAULT_CMP0057=NEW -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE:string="Release";
make;
eventually:make install
. Note that the option -DCMAKE_POLICY_DEFAULT_CMP0057=NEW is needed in some situation to fix boost search error due to cmake langage policy change. For any problem, don't hesitate to contact the DGtal team on the GitHub repository. On windows or more details see instructions here.
- Install (if not already present), the boost dependancies (see https://www.boost.org).
For instance on linux you can install the following package: sudo apt-get install
- cairo On Linux, the installation can be done from a package mananger (see here for more details. On Windows, you can follow the steps of the cairo website or run the script or upload the binary from the cairo-windows repository. You can also consult the appveyor configuration file (appveyor.yml) that uses it.
- boost programm options by default the application use the package
libboost-program-options-dev
. You can use you default package manager to install it.
The installation of the code can be done by following these steps:
-
Download the source for instance by using the
git
command:git clone [email protected]:kerautret/GTVimageVect.git
cd GTVimageVect; mkdir build; cd build;
-
Then, you can start to build the code: (you can remove the DGtal path if you make a global installation of DGtal).
cmake .. -DDGtal_DIR="/fullpath_to_yourParent_DGtal_dir/DGtal/build" -DCMAKE_BUILD_TYPE:string="Release"
make
cd ..
The algorithm is run from executable tv-triangulation-color
. For instance, you can use as follows (from the project directory):
./build/bin/tv-triangulation-color -i Input/dolphin.ppm -b 16 -D 16 -o output -C result.svg
Then you should obtain:
![]() |
![]() | |
source image (.png) | result (scaled bitmap .png) | result (vectorial format .svg) |
The vectorial representation allows you to edit easely the shape by using for instance inskape. First you can generate the vectorial representation:
./build/bin/tv-triangulation-color -i tests/ex_results/skeleton.ppm -b 16 -D 16 -C skeleton.svg
Then, thanks to the vectorial representation, you can animate the resulting vectorial file like in the animation below on the right:
![]() |
|
|
source (scaled) | result (svg) | Edited using inskape and animated with svg format (reload or click to see animation). |
The algorithm can be used to zoom on part of photography:
./build/bin/tv-triangulation-color -i Input/ara.ppm -b 16 -D 16 -o resultAra
convert -scale 1600% Input/ara.ppm ara16x.png
You should obtain such resulting images:
![]() |
![]() |
Source scaled x16 | Resulting image |
All the figures of the paper using the present algorihtms can be reproduced from the following script script-figures.sh
.
You just have to run by specifying the Input/Output directory:
mkidr Output
script-figures.sh Input Output
The comparisons with existing algorithms can be applied onlne with the following demonstrations:
- Convolutional Neural Network for Subpixel Super-Resolution [22]: online demo.
- Super resolution with HQx Algorithm [23]: online demo
- Image Interpolation with Geometric Contour Stencils [7]: online demo.
- Vector-valued image interpolation by an anisotropic diffusion-projection PDE [19]: online demo.
- Vector Magic Inc [10]: online demo.
- Depixelizing [13] and Potrace [21] were produced by using Inskape with the default parameters.