clc;clear all;close all;
%% 水平 垂直
Prewitt_x=[1 1 1;0 0 0;-1 -1 -1];
Prewitt_y=[-1 0 1;-1 0 1;-1 0 1];
%% 处理
I=imread('../gray4.jpg'); %读取图像
[ROW,COL, DIM] = size(I);%保存图像尺寸
subplot(131),imshow(I),title('原始图像');%显示原始图像
%A=fspecial('laplacian'); %生成系统预定义的3X3滤波器
Sobel_img1=My_filter(I,Prewitt_x);
subplot(132),imshow(Sobel_img1),title('水平 Prewitt_x');
Sobel_img2=My_filter(I,Prewitt_y);
subplot(133),imshow(Sobel_img2),title('垂直 Prewitt_y');