Filter löschen
Filter löschen

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

9 Ansichten (letzte 30 Tage)
Rahul
Rahul am 24 Mär. 2013
Bearbeitet: Swank Williams am 1 Jul. 2023
Edge detection using wavelet transform need local maxima to find new approximation coefficient from detail coefficient.

Antworten (3)

Sajid Khan
Sajid Khan am 10 Okt. 2013
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 Kommentare
S. Sal
S. Sal am 24 Nov. 2016
Bearbeitet: S. Sal am 24 Nov. 2016
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 am 1 Jul. 2023
Bearbeitet: Swank Williams am 1 Jul. 2023
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);

Melden Sie sich an, um zu kommentieren.


Image Analyst
Image Analyst am 24 Mär. 2013
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 am 24 Nov. 2016
Try the function imhmax() built in to the Image Processing Toolbox.

Kategorien

Mehr zu Just for fun finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by