matlab多种图像边缘检测方法,Matlab多种图像边缘检测方法

Matlab多种图像边缘检测方法

1、用Prewitt算子检测图像的边缘

I = imread('bacteria.BMP');

BW1 = edge(I,'prewitt',0.04); % 0.04为梯度阈值

figure(1);

imshow(I);

figure(2);

imshow(BW1);

2、用不同σ值的LoG算子检测图像的边缘

I = imread('bacteria.BMP');

BW1 = edge(I,'log',0.003); % σ=2

imshow(BW1);title('σ=2')

BW1 = edge(I,'log',0.003,3); % σ=3

figure, imshow(BW1);title('σ=3')

3、用Canny算子检测图像的边缘

I = imread('bacteria.BMP');

imshow(I);

BW1 = edge(I,'canny',0.2);

figure,imshow(BW1);

4、图像的阈值分割

I=imread('blood1.tif');

imhist(I); % 观察灰度直方图, 灰度140处有谷,确定阈值T=140

I1=im2bw(I,140/255); % im2bw函数需要将灰度值转换到[0,1]范围内 figure,imshow(I1);

5、用水线阈值法分割图像

afm = imread('afmsurf.tif');figure, imshow(afm);

se = strel('disk', 15);

Itop = imtophat(afm, se); % 高帽变换

Ibot = imbothat(afm, se); % 低帽变换

figure, imshow(Itop, []); % 高帽变换,体现原始图像的灰度峰值

figure, imshow(Ibot, []); % 低帽变换,体现原始图像的灰度谷值

Ienhance = imsubtract(imadd(Itop, afm), Ibot);% 高帽图像与低帽图像相减,增强图像 figure, imshow(Ienhance);

Iec = imcomplement(Ienhance); % 进一步增强图像

Iemin = imextendedmin(Iec, 20); figure,imshow(Iemin) % 搜索Iec中的谷值 Iimpose = imimposemin(Iec, Iemin);

wat = watershed(Iimpose); % 分水岭分割

rgb = label2rgb(wat); figure, imshow(rgb); % 用不同的颜色表示分割出的不同区域

6、对矩阵进行四叉树分解

I = [ 1 1 1 1 2 3 6 6

1 1 2 1 4 5 6 8

1 1 1 1 10 15 7 7

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值