MATLAB code for non-maximum suppression
44 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Manuel Dominguez
2019 年 11 月 27 日
%% 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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Computer Vision Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!