image-js
Version:
Image processing and manipulation in JavaScript
12 lines (11 loc) • 341 B
text/typescript
/**
* Checks the that the dimensions of the kernel are odd.
* @param kernel - Kernel passed to a morphology function.
*/
export function checkKernel(kernel: number[][]) {
if (kernel.length % 2 === 0 || kernel[0].length % 2 === 0) {
throw new TypeError(
'the number of rows and columns of the kernel must be odd',
);
}
}