代码
详细说明见注释,图片使用的是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(