1. 背景
如下图所示,为LBF模型当水平集初始化位置不同时,分割效果不同; 分析其原因是,LBF模型是一个考虑局部区域的模型,当水平集演化到一个比较平坦的位置时,水平集演化速度将会迅速下降;为了克服该问题,提出多尺度的LBF模型。
2. 模型简介
3. 模型代码
%demo_multi_LBF.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('Multi_LBF solver\'));
% save result path
SaveFilePath = 'Results\';
% Read Image
c0 = 2;
imgID = 6;
Img = imread('Image\vessel.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