MATLAB code for non-maximum suppression
46 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I have a set of bounding boxes with score. Now I want to apply non-maximum suppression on that set for my detection task. Could you kindly give me matlab code for non-maximum suppression? Thanks in advances.
Reserveboxes=[score box] % Reserveboxes is a 5920x5 array
0 comentarios
Respuestas (1)
Manuel Dominguez
el 27 de Nov. de 2019
%% Nonmaxmimum Suppression
function imgResult = nonmaxsup2d(imgHough)
imgResult = zeros(size(imgHough));
for y = 2:size(imgHough, 1)-1
for x = 2:size(imgHough, 2)-1
offx = [1 1 0 -1 -1 -1 0 1];
offy = [0 1 1 1 0 -1 -1 -1];
val = imgHough(y, x);
is_max = true;
for i=1:8
if y == 2 && offy(i) == -1
continue
end
if y ==size(imgHough,1)-1 && offy(i) == 1
continue
end
if x ==2 && offx(i) == -1
continue
end
if x ==size(imgHough,2)-1 && offx(i) == 1
continue
end
if val < imgHough(y+offy(i), x+offx(i))
is_max = false;
break;
end
end
if is_max
imgResult(y, x) = val;
end
end
end
end
0 comentarios
Ver también
Categorías
Más información sobre Computer Vision Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!