matlab边缘检测区域生长和分水岭的代码示例

代码

详细说明见注释,图片使用的是matlab内置的图像,直接可以运行

% Methods of edge detection:LoG and canny
clc;clear;close all
%Read image
img = imread('cameraman.tif');
edge_log = edge(img,'log');
edge_canny= edge(img,'canny');
%watershed
%Filter the image, you can alse annotate this line.
img2 = imgaussfilt(img,2);
edge_watershed = watershed(img2);
%Region Grow
figure,
imshow(img,[])
% 使用鼠标左键点击若干种子点,以回车键结束
[y,x] = getpts(gca);%get points and enter
x = round(x); 
y = round(y);
mask_regiongrow= regiongrowing(im2double(img),x,y);

figure,
subplot(231)
imshow(img,[])
title('原图')
subplot(232)
imshow(edge_log,[])
title(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值