Skip to content
Implementation of Coherent Line Drawing algorithm
Branch: master
Clone or download
Latest commit f8dfe23 Jul 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cli include process indicator Jul 4, 2019
vendor include bmp dep Jul 4, 2019
.gitignore Extend gocv Feb 8, 2019
Gopkg.lock Adding vendor dependencies Oct 2, 2018
Gopkg.toml Adding vendor dependencies Oct 2, 2018
LICENSE
Makefile
README.md Update README.md Jul 16, 2019
build.sh changed version Jun 14, 2019
cld.go Correcting rows, cols var declaration Jul 6, 2019
etf.go remove old code Jul 2, 2019
go.mod update go.mod Jul 4, 2019
go.sum
progress.go small update on spinner Jul 10, 2019
sobel.go Refactoring code Oct 4, 2018
vizualize.go visualize etf concurrently Jul 2, 2019

README.md

colidr (Coherent Line Drawing)

license release

Golang implementation of 'Coherent Line Drawing' algorithm developed by Kang et al, NPAR 2007.

sample

Requirements

  • Go 1.10 or higher, but it should work even with a lower version
  • OpenCV 3 (tested with 3.4.2)
  • gocv (bundled into the project, since it was extended with missing OpenCV functions needed for the implementation)
  • potrace - for transforming the bitmap into smooth, scalable image (however this is optional)

Installation

$ go get -u github.com/esimov/colidr/
$ go install

Another option is cloning the repository and running the make file.

$ git clone https://github.com/esimov/colidr
$ cd colidr
$ make

This will generate the binary file.

Usage

$ colidr -h

┌─┐┌─┐┬  ┬┌┬┐┬─┐
│  │ ││  │ ││├┬┘
└─┘└─┘┴─┘┴─┴┘┴└─

Coherent Line Drawing CLI
    Version: 1.0.1

  -aa
    	Anti aliasing
  -bl int
    	Blur size (default 3)
  -di int
    	Number of FDoG iteration
  -ei int
    	Number of Etf iteration (default 1)
  -in string
    	Source image
  -k int
    	Etf kernel (default 3)
  -out string
    	Destination image
  -pt
    	Use potrace to smooth edges (default true)
  -rho float
    	Rho (default 0.98)
  -sc float
    	SigmaC (default 1)
  -sm float
    	SigmaM (default 3)
  -sr float
    	SigmaR (default 2.6)
  -tau float
    	Tau (default 0.98)
  -ve
    	Visualize Etf
  -vr
    	Visualize end result

Feel free to play with the values in order to modify the visual output of the generated (non-photorealistically rendered) image. To obtain higher fidelity results you need to increase the kernel value and also the ETF iteration number. Different combinations produces completely different output. The -di, -ei, -k flags are mostly used for fine tuning, on the other hand -rho and -tau flags could change dramatically the rendered output.

You can also visualize the edge tangent flow if you enable the -ve flag. Below is the process illustrated:

Original image Edge tangent flow Coherent line drawing (final output)
original flowfield output

Using the -pt flag you can trace the generated bitmap into a smooth scalabe image. You need to have potrace installed on your machine for this scope.

Below is an example whith and without the potrace flag activated.

Normal output Potrace activated
normal smooth

The above image was ganareted with the following command:

colidr -in ~/Desktop/patio.jpg -out ~/Desktop/patio_scene.png -k=1 -sr=2.5 -sm=3.2 -tau=0.9975 -di=1 -aa=1 -ve=1 -vr=0 -pt=1 -ei=1

Sample images

Rasterized bitmap Vectorized image
great_wave_of_kanagawa great_wave_of_kanagawa
starry_night starry_night
people people
tiger tiger

Todo

  • GUI support

Author

License

Copyright © 2019 Endre Simo

This project is under the MIT License. See the LICENSE file for the full license text.

You can’t perform that action at this time.