Matlab图像的边缘检测

%%-------------------------Matlab图像的边缘检测-------------------------

%-------------------头文件-----------------------------

clc ; %清屏幕

clear ; %删除所有的变量

close all ; %将所有打开的图片关掉

%---------------边缘检测 edge()--------------------

A = imread( '1.jpg' ) ;

A1 = rgb2gray(A) ;

% edge( I, method, threshold)

% method为边缘检测方法

% threshold为敏感度阈值,"Canny" 方法使用两个阈值[low,high],

% 边缘强度低于low的像素点会被认为不是边缘;高于high的像素点会被认为是边缘;

% 在low和high之间的像素点, 若与高于high的边缘像素点相邻,则被认为是边缘,否则不是边缘。

B = edge( A1, 'Canny', [0.04, 0.25] ); %edge查找二维灰度图像中的边缘

subplot( 1, 2, 1) ; imshow( A1 ) ; title('原图') ;

subplot( 1, 2, 2) ; imshow( B ) ; title('边缘检测') ;

猜你喜欢

转载自blog.csdn.net/starryskyzl/article/details/129120004