This function applies the Laplacian, Sobel, or Robert Cross filter to
the input image img
. The filter is applied to each color channel separately. ltype
determines
the different matrices for Laplacian filter used in the
literature. ltype == 1
will use:
conv <- matrix(c(-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,
-1,-1,24,-1,-1,
-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1),5,5)
ltype == 2
will use:
conv <- matrix(c(0,-1,0,-1,4,-1,0,-1,0), 3, 3)
ltype == 3
will use:
conv <- matrix(c(-1,-1,-1,-1,8,-1,-1,-1,-1), 3, 3)
ltype == 4
(default) will use:
conv <- matrix(c(1,-2,1,-2,4,-2,1,-2,1), 3, 3)