2025年水平集图像分割序列——LCV模型

水平集图像分割序列——LCV模型1 参考文献 2 LCV 模型 demo LCV m Author HSW Date 2015 4 12 HARBIN INSTITUTE OF TECHNOLOGY Set Matlab close all clear all clc demo 编号 需要修改 ii 1 Add path

大家好,我是讯享网,很高兴认识大家。

1. 参考文献


2. LCV模型

%demo_LCV.m %Author: HSW %Date;2015/4/12 %HARBIN INSTITUTE OF TECHNOLOGY % Set Matlab close all; clear all; clc; % demo 编号,需要修改 ii = 1; % Add path addpath(genpath('Image\')); addpath(genpath('LCV solver\')); % save result path SaveFilePath = 'Results\'; % Read Image c0 = 2; imgID = 6; Img = imread('Image\vessel2.bmp'); Temp = Img; if ndims(Img) == 3 Img = rgb2gray(Img); end Img = double(Img); % Initial phi is the level set function switch imgID case 1 phi= ones(size(Img(:,:,1))).*c0; a=43;b=51;c=20;d=28; phi(a:b,c:d) = -c0; figure; imshow(Temp);colormap; hold on; [c,h] = contour(phi, 0, 'r'); hold off; case 2 [m,n] = size(Img(:,:,1)); a=m/2; b=n/2; r=min(m,n)/4;%set the radius phi= ones(m,n).*c0; phi(a-r:a+r,b-r:b+r) = -c0; imshow(Temp);colormap; hold on; [c,h] = contour(phi, 0, 'r'); hold off; case 3 figure; imshow(Temp);colormap; text(6,6,'Left click to get points, right click to get end point','FontSize',12,'Color', 'g'); BW=roipoly; %BW is mask phi=c0*2*(0.5-BW); hold on; [c,h] = contour(phi,[0 0],'r'); hold off; case 4 %figure;imagesc(Img,[0,255]);colormap(gray);hold on; axis off; axis equal; figure; imshow(Temp);colormap; [x,y] = ginput(9);%set nine centre points of nine initial level set function [m,n] = size(Img); r = min(m,n)/6; %we need to set the radius phi= ones(m,n).*c0; for iter = 1:length(x) phi(x(iter)-r:x(iter)+r,y(iter)-r:y(iter)+r) = -c0;%initial zero level set is square % initial zero level set is circle,this method is not recommended % for i = 1:m % for j = 1:n % d = (i - x(iter))^2 + (j - y(iter))^2; % if d <= r^2 % phi(i,j) = -c0; % end%if % end% j % end% i % 上述注释部分为实现选择的中心点初始化为圆形,不推荐这种方法 end% iter hold on; [c,h] = contour(phi,[0 0],'r'); hold off; case 5 %figure;imagesc(Img,[0,255]);colormap(gra
讯享网
小讯
上一篇 2025-03-14 15:22
下一篇 2025-03-08 15:21

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/74549.html