Azzera filtri
Azzera filtri

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

12 visualizzazioni (ultimi 30 giorni)
Edge detection using wavelet transform need local maxima to find new approximation coefficient from detail coefficient.

Risposte (3)

Sajid Khan
Sajid Khan il 10 Ott 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 Commenti
S. Sal
S. Sal il 24 Nov 2016
Modificato: S. Sal il 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 il 1 Lug 2023
Modificato: Swank Williams il 1 Lug 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);

Accedi per commentare.


Image Analyst
Image Analyst il 24 Mar 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 il 24 Nov 2016
Try the function imhmax() built in to the Image Processing Toolbox.

Categorie

Scopri di più su Just for fun in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by