Flip the kernel vertically, horizontally, or both.
kernel_flip_horizontal(k)
kernel_flip_vertical(k)
kernel_flip_both(k)
[matrix] The kernel.
The flipped kernel, a matrix
.
kernel <- matrix(c(
1, 2, 3,
0, 1, 0,
2, 3, 4
), nrow = 3, ncol = 3)
kernel_flip_horizontal(kernel)
#> [,1] [,2] [,3]
#> [1,] 2 0 1
#> [2,] 3 1 2
#> [3,] 4 0 3
kernel_flip_vertical(kernel)
#> [,1] [,2] [,3]
#> [1,] 3 0 4
#> [2,] 2 1 3
#> [3,] 1 0 2
kernel_flip_both(kernel)
#> [,1] [,2] [,3]
#> [1,] 4 0 3
#> [2,] 3 1 2
#> [3,] 2 0 1