visual-search/util/getEdgeAngleHist.m

26 lines
563 B
Mathematica
Raw Normal View History

2019-11-29 19:33:07 +00:00
function F=getEdgeAngleHist(mag_img, angle_img, bins, threshold)
dimensions = size(angle_img);
rows = dimensions(1);
columns = dimensions(2);
vals = [];
for i = 1:rows
for j = 1:columns
if mag_img(i, j) > threshold
bin_value = angle_img(i, j) / (2 * pi);
2019-11-29 19:33:07 +00:00
bin_value = floor(bin_value * bins);
vals = [vals bin_value];
end
end
end
2019-11-29 19:33:07 +00:00
if size(vals, 2) == 0
2019-11-30 17:56:27 +00:00
F = zeros(1, bins);
2019-11-29 19:33:07 +00:00
else
F= histogram(vals, bins, 'Normalization', 'probability').Values;
end
2019-11-12 16:27:04 +00:00
return;