Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvolveGray ¶
func ConvolveGray(img *image.Gray, kernel *Kernel, anchor image.Point, border padding.Border) (*image.Gray, error)
ConvolveGray applies a convolution matrix (kernel) to a grayscale image. Example of usage:
res, err := convolution.ConvolveGray(img, kernel, {1, 1}, BorderReflect)
Note: the anchor represents a point inside the area of the kernel. After every step of the convolution the position specified by the anchor point gets updated on the result image.
func ConvolveRGBA ¶
func ConvolveRGBA(img *image.RGBA, kernel *Kernel, anchor image.Point, border padding.Border) (*image.RGBA, error)
ConvolveRGBA applies a convolution matrix (kernel) to an RGBA image. Example of usage:
res, err := convolution.ConvolveRGBA(img, kernel, {1, 1}, BorderReflect)
Note: the anchor represents a point inside the area of the kernel. After every step of the convolution the position specified by the anchor point gets updated on the result image.
Types ¶
type Kernel ¶
Kernel is a 2 dimensional matrix used mainly for convolution.
func NewKernel ¶
NewKernel creates a new Kernel with the given width and height. The value for every position of the kernel is 0.
func (*Kernel) Normalize ¶
Normalize returns a normalized kernel where each value is divided by the absolute sum of the kernel.