This function applies a kernel to an image. The kernel should contain three possible values: 0, 1 and NaN. The pixels in the result are set to 1 iif the pixels surrounding it in the original match the pattern of 0 and 1 defined by the kernel.
The following lines could be copied / adapted. The computeConvolutionPixel() function should ignore kernel values set to NaN. Don't forget to use isNan().
This function applies a kernel to an image. The kernel should contain three possible values: 0, 1 and NaN. The pixels in the result are set to 1 iif the pixels surrounding it in the original match the pattern of 0 and 1 defined by the kernel.
https://homepages.inf.ed.ac.uk/rbf/HIPR2/hitmiss.htm
The following lines could be copied / adapted. The
computeConvolutionPixel()
function should ignore kernel values set toNaN
. Don't forget to useisNan()
.https://github.com/image-js/image-js-typescript/blob/be36409d09cc18d8d733ed357ef8f00144022335/src/filters/convolution.ts#L146-L176