ImageConvolve的用法
1、先来准备一幅图片:
img=……;

2、直接套用卷积函数,用Sobel算子来检测图像边界:
Sobel = {{-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}};
p = ImageConvolve[img, Sobel]

3、把Sobel算子转置一下:
Sobel = {{-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}};
p = ImageConvolve[img, Sobel//Transpose]

4、上面两种边界图像叠加到一起,就得到下图——更清晰的边界。

5、用B = {{1/9, 1/9, 1/9}, {1/9, 1/9, 1/9}, {1/9, 1/9, 1/9}};做模版,效果如下。

6、用{{0.009, 0.079, 0.009}, {0.079, 0.641, 0.079}, {0.009, 0.079, 0.009}}做模版:
B = N@Floor[#*1000]/1000 & /@ GaussianMatrix[1];
p = ImageConvolve[img, B]

7、更换一个大模版:
B = N@Floor[#*1000]/1000 & /@ GaussianMatrix[10];
p = ImageConvolve[img, B]
或者
B =GaussianMatrix[10];
p = ImageConvolve[img, B]
或者
B =GaussianMatrix[36];
p = ImageConvolve[img, B]



8、水平方向上的模糊处理:
ImageConvolve[img, {Table[1/6, 6]}]

9、加大模糊力度:
ImageConvolve[img, {Table[1/36, 36]}]

10、竖直方向上的模糊:
ImageConvolve[img, Table[{1/3}, 3]]
ImageConvolve[img, Table[{1/36}, 36]]


11、全方位模糊:
ImageConvolve[img, Table[1/9, 3, 3]]
ImageConvolve[img, Table[1/36, 6, 6]]
ImageConvolve[img, Table[1/36, 4, 9]]
ImageConvolve[img, Table[1/100, 10, 10]]



