www.gusucode.com > 《matlab图像处理与界面编程宝典》秦襄培 编著,每章的MATLAB源代码程序 > 第11章/代码11-10.txt

    
I = imread('rice.png');                       % 读入图像
J = filter2(fspecial('sobel'),I);             % 滤波
K = mat2gray(J);                              % 转换为图像
imshow(I), figure, imshow(K)                  % 显示原图,开启窗口显示滤波后的图像