Hello Mat

 找回密码
 立即注册
查看: 4858|回复: 0

beltrami滤波器

[复制链接]

1294

主题

1520

帖子

112

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22635
发表于 2017-9-21 21:54:41 | 显示全部楼层 |阅读模式
beltrami滤波器
resim = beltrami2D(im, 30, 0.01);   % beltrami滤波
  1. function Fim = beltrami2D(im, num_iter, delta_t)
  2. % beltrami滤波器   a NonLinear filter
  3. % 函数输入:
  4. %         im       - 灰度图像 (MxN).
  5. %         num_iter - 迭代次数
  6. %         delta_t  - 时间步长
  7. %               
  8. % 函数输出:
  9. %         Fim - (Filtered) image.

  10. if ~isa(im,'double')
  11.     im = double(im)/255;
  12. end
  13. % 梯度矩阵
  14. hx=0.5.*[0 0 0; -1 0 1; 0 0 0]; % 水平
  15. hy=0.5.*[0 -1 0; 0 0 0; 0 1 0]; % 垂直
  16. % 度量张量
  17. hxx=[0 0 0; 1 -2 1; 0 0 0];% 水平
  18. hyy=[0 1 0; 0 -2 0; 0 1 0];% 垂直
  19. % xy
  20. hxy=[1 0 -1; 0 0 0; -1 0 1];

  21. Ik=im;  % 赋值

  22. for i=1:num_iter
  23.    
  24.     Ixx=imfilter(Ik,hxx,'conv');% 滤波
  25.     Iyy=imfilter(Ik,hyy,'conv');% 滤波
  26.     Ix=imfilter(Ik,hx,'conv');  % 滤波
  27.     Iy=imfilter(Ik,hy,'conv');  % 滤波
  28.     Ixy=imfilter(Ik,hxy,'conv');% 滤波
  29. %     对梯度下降方程积分
  30.     Ikx=Ik+delta_t.*((Ixx.*(ones(size(Iy))+Iy.^2)+...
  31.         Iyy.*(ones(size(Ix))+Ix.^2)-2.*Ix.*Iy.*Ixy)./(ones(size(Ix))+Ix.^2+Iy.^2).^2);
  32.     Fim= Ikx;
  33.     Ik = Ikx;
  34. end
复制代码





算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-5-3 16:00 , Processed in 0.208994 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表