function [ cornerMap ] = nonmaximalsuppression( cornerStrengthMap )
% Hassan Nahas
%This function performs non-maximum suppression in a 3X3 window.
    cornerMap = zeros(size(cornerStrengthMap,1),size(cornerStrengthMap,2));
    for x = 2:size(cornerStrengthMap,1)-1
        for y = 2:size(cornerStrengthMap,2)-1
            pixelValues = cornerStrengthMap(x,y);
            neighbourhood = cornerStrengthMap(x-1:x+1,y-1:y+1);
            bestInneighborhood = max(max(neighbourhood));
            if(pixelValues == bestInneighborhood && pixelValues ~= 0)
               cornerMap(x,y) = 1;
            end
        end
    end

end

