go-effects

module
v0.0.0-...-fdc64c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2020 License: MIT

README

Go Report Card

go-effects

Parallelized image manipulation effects, written in Go. All sample images used in this project are from: https://unsplash.com

Overview

This library provides basic image effects, running on multiple goroutines to parallelize the processing. You can include the library directly in your code via gihutb.com/markdaws/go-effect/pkg/effects or there is a command line app that you can use to process photos in cmd/goeffects, to run:

go install ./cmd/goeffects 
goeffects --help

Usage

Take a look at pkg/effects/effects_test.go for examples of how to use this library

Package

github.com/markdaws/go-effects/pkg/effects

Docs

GoDoc

Oil Painting

This effect takes an input image and renders it styled as an oil painting. The boldness of the stroke and the range of the palette can be modified.

Original Image

Modified Image (filterSize:5, levels:30)

Cartoon

This effect renders an image as if it were drawn as a cartoon. The effect is achieved by rendering the image as an oil paiting and running edge detection on the input image, drawing the edges on top of the oil painting rendering.

Original Image

Modified Image (cartoon)

Pixelate

Renders the input image as a pixelated image, based on the blockSize specified by the caller.

Original Image

Modified Image (pixelate, blockSize: 10)

Pencil

Given an input image returns an image rendered as if it was drawn by pencil. This is just an inverted sobel image, you can specify a blur factor to reduce noise

Original Image

Modified Image (Pencil, blurFactor: 5)

Sobel

Given an input image returns an image containing edge gradients values, based on the Sobel operator. By default the pixel r,g,b values all contain the gradient intensity, but if you supply a threshold value to the function, then if the gradient intensity is >= threshold the pixel value will be 255 and if it is less than it will be 0. This way you can set some threshold and use this for edge detection.

Original Image

Modified Image (Sobel)

Gaussian

Applies a Gaussian blur to the input image. You can specify the kernelSize, larger values equate to more blurring and sigma, larger values give more weighting to pixels further from the target pixel. Same values would be 11, 1 for example. The kernelSize must be an odd number.

Original Image

Modified Image (Gaussian)

Grayscale

Given an input image returns a grayscale version. Three algorithms are available, lightness (average of the max and min rgb value of a pixel), average (the average of the r,g,b values), luminosity (a weighted average of the rgb values based on how humans perceive color).

The luminence algorithm generally gives the best results.

Original Image

Modified Image (luminosity)

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL