下面文,我介绍了mathematica里面,图像卷积处理的算法实现,并用来实现了某些特殊效果.代码写的比较繁琐.然而,: img=...;直接套用卷积函数,用sobel算子来检测图像边界: sobel = {{-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}}; p = imageconvolve[img, sobel]把sobel算子转置一下: sobel = {{-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}}; p = imageconvolve[img, sobeltranspose]上面两种边界图像叠加到一起,就得到下图-更清晰的边界.用b = {{19, 19, 19}, {19, 19, 19}, {19, 19, 19}};做模版,效果如下.用{{0.009, 0.079, 0.009}, {0.079, 0.641, 0.079}, {0.009, 0.079, 0.009}}做模版: b = n@floor[#*1000]1000 & @ ga ssianmatrix[1]; p = imageconvolve[img, b]更换一个大模版: b = n@floor[#*1000]1000 & @ ga ssianmatrix[10]; p = imageconvolve[img, b] 或者 b =ga ssianmatrix[10]; p = imageconvolve[img, b] 或者 b =ga ssianmatrix[36];