声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1496|回复: 1

[综合讨论] 请问如何得到小波边缘检测的模极大值,一定要通过编程实现么,请高手指点,谢谢!

[复制链接]
发表于 2006-8-22 14:55 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
请问如何得到小波边缘检测的模极大值,一定要通过编程实现么,请高手指点,谢谢!
回复
分享到:

使用道具 举报

发表于 2006-8-23 20:35 | 显示全部楼层
  1. clear all;
  2. load wbarb;
  3. I = ind2gray(X,map);imshow(I);
  4. I1 = imadjust(I,stretchlim(I),[0,1]);figure;imshow(I1);
  5. [N,M] = size(I);

  6. h = [0.125,0.375,0.375,0.125];
  7. g = [0.5,-0.5];
  8. delta = [1,0,0];

  9. J = 3;

  10. a(1:N,1:M,1,1:J+1) = 0;
  11. dx(1:N,1:M,1,1:J+1) = 0;
  12. dy(1:N,1:M,1,1:J+1) = 0;
  13. d(1:N,1:M,1,1:J+1) = 0;

  14. a(:,:,1,1) = conv2(h,h,I,'same');
  15. dx(:,:,1,1) = conv2(delta,g,I,'same');
  16. dy(:,:,1,1) = conv2(g,delta,I,'same');

  17. x = dx(:,:,1,1);
  18. y = dy(:,:,1,1);
  19. d(:,:,1,1) = sqrt(x.^2+y.^2);
  20. I1 = imadjust(d(:,:,1,1),stretchlim(d(:,:,1,1)),[0 1]);figure;imshow(I1);

  21. lh = length(h);
  22. lg = length(g);

  23. for j = 1:J+1
  24. lhj = 2^j*(lh-1)+1;
  25. lgj = 2^j*(lg-1)+1;
  26. hj(1:lhj)=0;
  27. gj(1:lgj)=0;
  28. for n = 1:lh
  29. hj(2^j*(n-1)+1)=h(n);
  30. end

  31. for n = 1:lg
  32. gj(2^j*(n-1)+1)=g(n);
  33. end

  34. a(:,:,1,j+1) = conv2(hj,hj,a(:,:,1,j),'same');
  35. dx(:,:,1,j+1) = conv2(delta,gj,a(:,:,1,j),'same');
  36. dy(:,:,1,j+1) = conv2(gj,delta,a(:,:,1,j),'same');

  37. x = dx(:,:,1,j+1);
  38. y = dy(:,:,1,j+1);
  39. dj(:,:,1,j+1) = sqrt(x.^2+y.^2);

  40. I1 = imadjust(dj(:,:,1,j+1),stretchlim(dj(:,:,1,j+1)),[0 1]);figure;imshow(I1);
  41. end
复制代码


看看是不是这样?
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-20 02:46 , Processed in 0.065358 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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