• 大小: 138KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-14
  • 语言: Matlab
  • 标签: 水平集  

资源简介

图像分割中常用的水平集方法的matlab源代码

资源截图

代码片段和文件信息

function [kappa] = curvature(phi dx dy)
%
% function [kappa] = curvature(phi dx dy)
%
% Calculates the curvature of the function phi(xy)
%
% Author: Baris Sumengen  sumengen@ece.ucsb.edu
% http://vision.ece.ucsb.edu/~sumengen/
%



dx2 = dx*dx;
dy2 = dy*dy;

phi_xp1 = zeros(size(phi));
phi_xm1 = zeros(size(phi));
phi_yp1 = zeros(size(phi));
phi_ym1 = zeros(size(phi));

phi_xp1(:2:end) = phi(:1:end-1);
phi_xp1(:1) = 2*phi_xp1(:2)-phi_xp1(:3);
phi_xm1(:1:end-1) = phi(:2:end);
phi_xm1(:end) = 2*phi_xm1(:end-1)-phi_xm1(:end-2);

phi_yp1(2:end:) = phi(1:end-1:);
phi_yp1(1:) = 2*phi_yp1(2:)-phi_yp1(3:);
phi_ym1(1:end-1:) = phi(2:end:);
phi_ym1(end:) = 2*phi_ym1(end-1:)-phi_ym1(end-2:);

phi_x = (phi_xm1 - phi_xp1)/(2*dx);
phi_y = (phi_ym1 - phi_yp1)/(2*dy);
phi_xx = (phi_xm1 - 2*phi + phi_xp1)/dx2;
phi_yy = (phi_ym1 - 2*phi + phi_yp1)/dy2;

dummy1 = circshift(phi [11]);
dummy1(12:end) = 2*dummy1(22:end)-dummy1(32:end);
dummy1(:1) = 2*dummy1(:2)-dummy1(:3);

dummy2 = circshift(phi [-1-1]);
dummy2(end1:end-1) = 2*dummy2(end-11:end-1)-dummy2(end-21:end-1);
dummy2(:end) = 2*dummy2(:end-1)-dummy2(:end-2);

dummy3 = circshift(phi [1-1]);
dummy3(11:end-1) = 2*dummy3(21:end-1)-dummy3(31:end-1);
dummy3(:end) = 2*dummy3(:end-1)-dummy3(:end-2);

dummy4 = circshift(phi [-11]);
dummy4(end2:end) = 2*dummy4(end-12:end)-dummy4(end-22:end);
dummy4(:1) = 2*dummy4(:2)-dummy4(:3);

phi_xy = (dummy1 + dummy2 - dummy3 - dummy4)/(4*dx*dy);

abs_grad_phi_sq = (phi_x.*phi_x + phi_y.*phi_y);
abs_grad_phi_cube = abs_grad_phi_sq.^1.5;

kappa = (phi_xx.*phi_y.*phi_y - 2.*phi_y.*phi_x.*phi_xy ...
    + phi_yy.*phi_x.*phi_x)./(abs_grad_phi_cube + (abs_grad_phi_cube == 0));




 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......      1730  2005-05-05 00:00  LevelSetMethods\evolve_normal_vector_ENO1_SD.m

    .......      1302  2005-05-05 00:00  LevelSetMethods\evolve_normal_vector_ENO1.m

    .......      1463  2005-05-05 00:00  LevelSetMethods\evolve_normal_ENO3.m

    .......      1461  2005-05-05 00:00  LevelSetMethods\evolve_normal_ENO2.m

    .......      1463  2005-05-05 00:00  LevelSetMethods\evolve_normal_ENO1.m

    .......      1749  2005-05-05 00:00  LevelSetMethods\evolve_kappa.m

    .......     11010  2005-05-12 07:10  LevelSetMethods\evolve2D.m

    .......      1600  2005-05-05 00:00  LevelSetMethods\der_WENO_plus.m

    .......      1602  2005-05-05 00:00  LevelSetMethods\der_WENO_minus.m

    .......      1521  2005-05-05 00:00  LevelSetMethods\der_ENO3_plus.m

    .......      1525  2005-05-05 00:00  LevelSetMethods\der_ENO3_minus.m

    .......      1246  2005-05-05 00:00  LevelSetMethods\der_ENO2_plus.m

    .......      1250  2005-05-05 00:00  LevelSetMethods\der_ENO2_minus.m

    .......       618  2005-05-06 00:00  LevelSetMethods\der_ENO1_plus.m

    .......       624  2005-05-05 00:00  LevelSetMethods\der_ENO1_minus.m

    .......      1786  2005-05-05 00:00  LevelSetMethods\curvature.m

    .......       408  2005-05-05 00:00  LevelSetMethods\get_dt_normal_vector_kappa.m

    .......       363  2005-05-05 00:00  LevelSetMethods\get_dt_normal_vector.m

    .......       399  2005-05-05 00:00  LevelSetMethods\get_dt_normal_kappa.m

    .......       356  2005-05-05 00:00  LevelSetMethods\get_dt_normal.m

    .......       360  2005-05-05 00:00  LevelSetMethods\get_dt_kappa.m

    .......       673  2005-05-05 00:00  LevelSetMethods\evolve_vector_WENO.m

    .......       672  2005-05-05 00:00  LevelSetMethods\evolve_vector_ENO3.m

    .......       672  2005-05-05 00:00  LevelSetMethods\evolve_vector_ENO2.m

    .......       674  2005-05-05 00:00  LevelSetMethods\evolve_vector_ENO1.m

    .......      1465  2005-05-05 00:00  LevelSetMethods\evolve_normal_WENO.m

    .......      1640  2005-05-05 00:00  LevelSetMethods\evolve_normal_vector_WENO_SD.m

    .......      1302  2005-05-05 00:00  LevelSetMethods\evolve_normal_vector_WENO.m

    .......      1642  2005-05-05 00:00  LevelSetMethods\evolve_normal_vector_ENO3_SD.m

    .......      1304  2005-05-05 00:00  LevelSetMethods\evolve_normal_vector_ENO3.m

............此处省略29个文件信息

评论

共有 条评论