sobel.m
来自「用所写算子进行边缘检测」· M 代码 · 共 30 行
M
30 行
image = imread('testpat1.png');
image1=suanzi(image,0.2);
image2=suanzi(image,0.5);
image3=suanzi(image,0.9);
subplot(221)
imshow(image);
subplot(222)
imshow(image1);
subplot(223)
imshow(image2);
subplot(224)
imshow(image3);
%function y=sobel(image ,th)
%[nx,ny]=size(image);
%image=double(image);
%h=[1 2 1;0 0 0;-1 -2 -1];
%Gx=filter(h,image);
%Gy=filter(h',image);
%F=abs(Gx)+abs(Gy);
%th_F=double(F)/255;
%for i=1:nx
% for j=1:ny
%if th_F(i,j)<th;
% th_F(i,j)=0;
%else
% th_F(i,j)=1;
% end
% end
%end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?