%description: % find the best scale for each edge pixels (based on linderberg approach) %param: % edge_norm = normalized gradient norm scale space % deepness = deepness of the scale space %result: % best_scale_nb = image that store for each pixel its best scale number function best_scale_nb = best_scale(edge_norm, deepness) D = ceil(deepness/2); [H,W,C] = size(edge_norm); local_maximas = zeros(H,W,D); best_scale_nb = zeros(H,W); %for each pixel (i,j) in the image, we find all local maximas in the %gradient stack. There are at moset deepness/2 local maximas. for i=1:H for j = 1:W %find local maxima in the normalized gradient norm indd =lmax(edge_norm(i,j,:)); dim = size(indd,1); for k=1:dim local_maximas(i,j,k) = indd(k,1); end clear indd; end end %we finally retain only the first local maxima, because it represents %the best scale (according to Lindeberg) best_scale_nb = local_maximas(:,:,1); clear local_maximas;