Convolve - Serabe/rinzelight GitHub Wiki

Convolve

The convolve functions apply a convolution with to the image given the kernel.

In Java, ConvolveOp has to edge operators, in rinzelight there are more and you can even define them. Take a look at the basics of convolution operators for knowing about them.

Convolving is used for a lot of image filters, like edge or blur, and the most important part of a convolution is the kernel. Support for kernels is in rinzelight.effects.convolve.kernel namespace.

Kernel

The first thing you need to know about kernels is that they are defined as a protocol. Available functions are:

  • to-java: returns an instance of java.awt.image.Kernel
  • valid?: check if the kernel is valid (both dimensions are odd and depending on the implementation you may need another check).
  • kernel: actual kernel as a float-array of length width * height.
  • width: width of kernel.
  • height: height of kernel.
  • x-orig: x coordinate of the origin element (the element that will be multiplied to the current pixel).
  • y-orig: y coordinate of the origin element (the element that will be multiplied to the current pixel).
  • change-kernel: given the kernel and a new kernel data, returns a new kernel with the new data.

For creating a kernel use create-kernel and for normalizing it, normalize-kernel

⚠️ **GitHub.com Fallback** ⚠️