A Fast Bilateral image filter for Golang
A FastBilateral filter is a non-linear, edge-preserving and noise-reducing
smoothing filter for images. The intensity value at each pixel in an image is
replaced by a weighted average of intensity values from nearby pixels.
Algorithm and implementation is based on http://people.csail.mit.edu/sparis/bf/
Please cite above paper for research purpose.
Original | Filtered | Luminance Filtered |
---|---|---|
![]() |
![]() SigmaSpace: 16 SigmaRange: 0.076 (auto)Execution time 1.22s |
![]() SigmaSpace: 16 SigmaRange: 0.76 (auto)Execution time 348.56ms |
![]() |
![]() SigmaSpace: 16 SigmaRange: 0.092 (auto)Execution time 21.66s |
![]() SigmaSpace: 16 SigmaRange: 0.76 (auto)Execution time 347.69ms |
// Fast Bilateral
bilateral.Auto(m)
// Luminance Fast Bilateral
luminance.Auto(m)
$ go get -u github.com/mdouchement/bilateral
fi, _ := os.Open("input_path")
defer fi.Close()
m, _, _ := image.Decode(fi)
start := time.Now()
fbl := bilateral.New(m, 16, 0.1)
fbl.Execute()
m2 := fbl.ResultImage() // Or use `At(x, y)` func or just use `fbl` as an image.Image for chained treatments.
fo, _ := os.Create("output_path")
defer fo.Close()
jpeg.Encode(fo, m2, &jpeg.Options{Quality: 100})
MIT. See the LICENSE for more details.
git checkout -b my-new-feature
)gometalinter --config=gometalinter.json ./...
)git commit -am 'Add some feature'
)git push origin my-new-feature
)