Пишу, по большей части, про историю, свою жизнь и немного про программирование.

StackBlur в go-gd

Портировал алгоритм Stack Blur с языка Processing на Google Go, теперь в моей библиотеке go-gd появился метод StackBlur.

Методы Smooth и GaussianBlur, которые я портировал из форка PHP-GD мне не нравились, не давали удобоваримого размытия, StackBlur куда лучше.

Вот небольшое описание этого алгоритма от автора, Марио Клингемана:

This is a compromise between Gaussian Blur and Box blur. It creates much better looking blurs than Box Blur, but is 7x faster than my Gaussian Blur implementation.

I called it Stack Blur because this describes best how this filter works internally: it creates a kind of moving stack of colors whilst scanning through the image. Thereby it just has to add one new block of color to the right side of the stack and remove the leftmost color. The remaining colors on the topmost layer of the stack are either added on or reduced by one, depending on if they are on the right or on the left side of the stack.

Ctrl ←Дима…
Ctrl →JS Linux