what is code for non-maxima suppression of a grey image

20 次查看(过去 30 天)
Edge detection using wavelet transform need local maxima to find new approximation coefficient from detail coefficient.

回答(3 个)

Sajid Khan
Sajid Khan 2013-10-10
Hi, attached is the source code for non maximal suppression. I also have submitted the code in file exchange but it will take some time for approval. I got help from canny edge detection code given in image processing toolbox
  2 个评论
S. Sal
S. Sal 2016-11-24
编辑:S. Sal 2016-11-24
Hello Sajid Khan, I am getting this error while using nonMaximalSupp.m you shared, The error is as follows: ___________________________________________________________
Undefined function 'cannyFindLocalMaxima' for input arguments of type 'double'.
Error in nonMaximalSupp (line 19) idxLocalMax = cannyFindLocalMaxima(dir,dx,dy,magGrad); _________________________________________________
Can you refine it please ? Thanks
Swank Williams
Swank Williams 2023-7-1
编辑:Swank Williams 2023-7-1
Hi @S. Sal, for the function cannyFindLocalMaxima, you may have a try on the following codes. And you can find more details in the link https://www.cnblogs.com/mender/p/3501929.html
function idxLocalMax = cannyFindLocalMaxima(direction,ix,iy,mag)
[m,n] = size(mag);
switch direction
case 1
idx = find((iy<=0 & ix>-iy) | (iy>=0 & ix<-iy));
case 2
idx = find((ix>0 & -iy>=ix) | (ix<0 & -iy<=ix));
case 3
idx = find((ix<=0 & ix>iy) | (ix>=0 & ix<iy));
case 4
idx = find((iy<0 & ix<=iy) | (iy>0 & ix>=iy));
end
if ~isempty(idx)
v = mod(idx,m);
extIdx = (v==1 | v==0 | idx<=m | (idx>(n-1)*m));
idx(extIdx) = [];
end
ixv = ix(idx);
iyv = iy(idx);
gradmag = mag(idx);
switch direction
case 1
d = abs(iyv./ixv);
gradmag1 = mag(idx+m).*(1-d) + mag(idx+m-1).*d;
gradmag2 = mag(idx-m).*(1-d) + mag(idx-m+1).*d;
case 2
d = abs(ixv./iyv);
gradmag1 = mag(idx-1).*(1-d) + mag(idx+m-1).*d;
gradmag2 = mag(idx+1).*(1-d) + mag(idx-m+1).*d;
case 3
d = abs(ixv./iyv);
gradmag1 = mag(idx-1).*(1-d) + mag(idx-m-1).*d;
gradmag2 = mag(idx+1).*(1-d) + mag(idx+m+1).*d;
case 4
d = abs(iyv./ixv);
gradmag1 = mag(idx-m).*(1-d) + mag(idx-m-1).*d;
gradmag2 = mag(idx+m).*(1-d) + mag(idx+m+1).*d;
end
idxLocalMax = idx(gradmag>=gradmag1 & gradmag>=gradmag2);

请先登录,再进行评论。


Image Analyst
Image Analyst 2013-3-24
Sounds like you have a paper in mind. Did you ask the authors if they have code to share with you, or search the File Exchange? I don't have the wavelet toolbox so I can't help you.

Image Analyst
Image Analyst 2016-11-24
Try the function imhmax() built in to the Image Processing Toolbox.

类别

Help CenterFile Exchange 中查找有关 Communications Toolbox 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by