急!!求matlab的图像分割程序!!!
急!!求matlab的图像分割程序,例如模糊算法,数学形态学算法等,希望程序尽量完整,尽快发到邮箱1784395338@qq.com,万分感谢!!如顺利还可再加分神经网络...
急!!求matlab的图像分割程序,例如模糊算法,数学形态学算法等,希望程序尽量完整,尽快发到邮箱1784395338@qq.com,万分感谢!!如顺利还可再加分
神经网络方法,遗传算子法,统计学方法,随机场等等,越多越好!!感谢 展开
神经网络方法,遗传算子法,统计学方法,随机场等等,越多越好!!感谢 展开
展开全部
Img = imread('t11.jpg'); % The same cell image in the paper is used here
Img=double(Img(:,:,1));
sigma=1.5; % scale parameter in Gaussian kernel for smoothing.
G=fspecial('gaussian',15,sigma);
Img_smooth=conv2(Img,G,'same'); % smooth image by Gaussiin convolution
[Ix,Iy]=gradient(Img_smooth);
f=Ix.^2+Iy.^2;
g=1./(1+f); % edge indicator function.
epsilon=1.5; % the papramater in the definition of smoothed Dirac function
timestep=5; % time step, try timestep=10, 20, ..., 50, ...
mu=0.2/timestep; % coefficient of the internal (penalizing) energy term P(\phi)
% Note: the product timestep*mu must be less than 0.25 for stability!
lambda=5; % coefficient of the weighted length term Lg(\phi)
alf=1.5; % coefficient of the weighted area term Ag(\phi);
% Note: Choose a positive(negative) alf if the initial contour is outside(inside) the object.
[nrow, ncol]=size(Img);
figure;imagesc(Img, [0, 255]);colormap(gray);hold on;
text(6,6,'Left click to get points, right click to get end point','FontSize',[12],'Color', 'r');
% Click mouse to specify initial contour/region
BW = roipoly; % get a region R inside a polygon, BW is a binary image with 1 and 0 inside or outside the polygon;
c0=4; % the constant value used to define binary level set function;
initialLSF= c0*2*(0.5-BW); % initial level set function: -c0 inside R, c0 outside R;
u=initialLSF;
[c,h] = contour(u,[0 0],'r');
u=initialLSF;
figure;imagesc(Img, [0, 255]);colormap(gray);hold on;
[c,h] = contour(u,[0 0],'r');
title('Initial contour');
% start level set evolution
for n=1:300
u=EVOLUTION(u, g ,lambda, mu, alf, epsilon, timestep, 1);
if mod(n,20)==0
pause(0.001);
imagesc(Img, [0, 255]);colormap(gray);hold on;
[c,h] = contour(u,[0 0],'r');
iterNum=[num2str(n), ' iterations'];
title(iterNum);
hold off;
end
end
close ('figure 1')
close ('figure 2')
axes(handles.fgh);
imagesc(Img, [0, 255]);colormap(gray);hold on;
[c,h] = contour(u,[0 0],'r');
totalIterNum=[num2str(n), ' iterations'];
希望这个程序对你有帮助
Img=double(Img(:,:,1));
sigma=1.5; % scale parameter in Gaussian kernel for smoothing.
G=fspecial('gaussian',15,sigma);
Img_smooth=conv2(Img,G,'same'); % smooth image by Gaussiin convolution
[Ix,Iy]=gradient(Img_smooth);
f=Ix.^2+Iy.^2;
g=1./(1+f); % edge indicator function.
epsilon=1.5; % the papramater in the definition of smoothed Dirac function
timestep=5; % time step, try timestep=10, 20, ..., 50, ...
mu=0.2/timestep; % coefficient of the internal (penalizing) energy term P(\phi)
% Note: the product timestep*mu must be less than 0.25 for stability!
lambda=5; % coefficient of the weighted length term Lg(\phi)
alf=1.5; % coefficient of the weighted area term Ag(\phi);
% Note: Choose a positive(negative) alf if the initial contour is outside(inside) the object.
[nrow, ncol]=size(Img);
figure;imagesc(Img, [0, 255]);colormap(gray);hold on;
text(6,6,'Left click to get points, right click to get end point','FontSize',[12],'Color', 'r');
% Click mouse to specify initial contour/region
BW = roipoly; % get a region R inside a polygon, BW is a binary image with 1 and 0 inside or outside the polygon;
c0=4; % the constant value used to define binary level set function;
initialLSF= c0*2*(0.5-BW); % initial level set function: -c0 inside R, c0 outside R;
u=initialLSF;
[c,h] = contour(u,[0 0],'r');
u=initialLSF;
figure;imagesc(Img, [0, 255]);colormap(gray);hold on;
[c,h] = contour(u,[0 0],'r');
title('Initial contour');
% start level set evolution
for n=1:300
u=EVOLUTION(u, g ,lambda, mu, alf, epsilon, timestep, 1);
if mod(n,20)==0
pause(0.001);
imagesc(Img, [0, 255]);colormap(gray);hold on;
[c,h] = contour(u,[0 0],'r');
iterNum=[num2str(n), ' iterations'];
title(iterNum);
hold off;
end
end
close ('figure 1')
close ('figure 2')
axes(handles.fgh);
imagesc(Img, [0, 255]);colormap(gray);hold on;
[c,h] = contour(u,[0 0],'r');
totalIterNum=[num2str(n), ' iterations'];
希望这个程序对你有帮助
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
楼主能发给我一份么?525932724@qq.com万分感谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已发送,请查收!发送邮箱396601903@qq.com!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询