function A_shift_filtered = frekvencni_filtr(A_shift, P, r1, r2, t)
[m,n] = size(A_shift);
A_shift_filtered = A_shift;
stupen_polynomu = 2;

for k = 1:size(P, 1)
    % inicializace proměnných
    sx = P(k, 1); sy = P(k, 2);
    x = []; y = []; z = [];
    xx = []; yy = [];
    mean = 0;
    p = 0;
    % spočítání průměrné amplitudy
    for i = 1:m
        for j = 1:n
            if (i-sx)^2 + (j-sy)^2 <= r1^2
                mean = mean + A_shift(i, j);
                p = p + 1;
                x = [x; i];
                y = [y; j];
                z = [z; A_shift(i, j)];
            end
        end
    end
    mean = mean/p;
    % prahování
    for i = 1:m
        for j = 1:n
            if ((i-sx)^2 + (j-sy)^2 <= r1^2) && (A_shift(i, j) >= t*mean)
                xx = [xx; i];
                yy = [yy; j];
            elseif (i-sx)^2 + (j-sy)^2 <= r2^2
                x = [x; i];
                y = [y; j];
                z = [z; A_shift(i, j)];
            end
        end
    end
    % aproximace okolí
    f = fit2dPolySVD(x, y, z, stupen_polynomu);
    % dopočítání amplitud
    for i = 1:length(xx)
        A_shift_filtered(xx(i),yy(i)) = eval2dPoly(xx(i), yy(i), f);
    end
end

end