Matlab watershed函数学习(2)

该博客详细介绍了在Matlab中如何进行分水岭变换。首先计算二值图像的补的距离变换,接着处理距离变换,然后计算并展示分水岭变换结果。通过实例代码解释了直接对bw和距离变换后的D做分水岭变换的区别,以及极小值区域的计算和连通组件的标识。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

%   2. Compute the distance transform of thecomplement of the binary

%      image.

%

%       D = bwdist(~bw);

%       figure,imshow(D,[],'InitialMagnification','fit')

%       title('Distance transform of ~bw')

2. 计算上述二值图像的补的距离变换


%   3. Complement the distance transform, andforce pixels that don't

%      belong to the objects to be at -Inf.

%

%       D = -D;

%       D(~bw) = -Inf;

3. 计算距离变换的补, 并令不属于两个对象的像素为负无穷.


%   4. Compute the watershed transform, anddisplay the resulting label

%      matrix as an RGB image.

%

%       L = watershed(D);

%       rgb = label2rgb(L,'jet',[.5 .5 .5]);

%       figure,imshow(rgb,'InitialMagnification','fit')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值