TP-traitement-audio-visuel/TP9/retroprojection.m
2023-06-22 20:47:16 +02:00

36 lines
715 B
Matlab

function f = retroprojection(sinogramme, theta, n_rayons, n_lignes, n_colonnes)
n_theta = length(theta);
f = zeros(n_lignes, n_colonnes);
theta = theta * pi / 180;
for k=1:n_theta
angle = theta(k);
for i=1:n_lignes
for j=1:n_colonnes
x = j - n_colonnes/2;
y = -i + n_lignes/2;
t = x * cos(angle) + y * sin(angle);
t = t + n_rayons/2;
t = min(max(round(t),1), n_rayons);
% if t > 501 || t <= 0
% continue
% end
f(i, j) = f(i, j) + sinogramme(t, k);
end
end
end
f = f / n_rayons;
end