help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

where is area?


From: Luiz Portella
Subject: where is area?
Date: Thu, 8 Sep 2011 18:11:25 -0300

Hi,

I´m working in project for computed tomography.
I get matrix 5x5, rotate it with bilinear interpolation (it now is
7x7) and sum elements of columns and get for 0, 45, 90, 135 and 180
degrees counterclockwise:

0.00000   0.00000   0.00000   0.00000   0.00000
0.00000   0.34315   0.00000   0.00000   0.00000
2.00000   0.50000   1.00000   0.00000   1.00000
1.00000   1.05025   0.00000   1.89340   1.00000
1.00000   1.29289   3.00000   1.29289   2.00000
0.00000   0.34315   0.00000   0.34315   0.00000
0.00000   0.00000   0.00000   0.00000   0.00000

For 0, 90 and 180 the sum of this numbers are 4, but not for 45 and
1350! What? I dont understand.... All for cell with 1 (there are 4) is
inside matrix 5x5, away from border.
Thanks a lot.

My code:

#! /home/dijz/ola -qf
     # a sample Octave program
     printf ("Hello, world!, como é que vai esta força?\n");

#load (inicial.m);
a = zeros(7,7); # faz uma matriz 7x7 cheia de zeros
a(3,3) = 1;
a(5,3) = 1;
a(5,4) = 1;
a(5,5) = 1; # monta a imagem
disp(a); #imprime a matriz
# na verdade ela é 5x5, fica 7x7 devido a exigencia da transformada Radon

xmap = colormap('gray');
img01 = imagesc(a);
print( gcf, '-dpng', fullfile( pwd, 'img01.png' ) );
#imwrite(a, 'img01.gif', 'gif'); #imprime a imagem original
#b = rand( 3, 3);
#imwrite( b, 'test.gif', 'gif');


npro = 5;
apro = [0, 45, 90, 135, 180];
disp(npro); #imprime o número de projeções
disp(apro); #imprime os ângulos de projeções

projecao = zeros(7,5);
for i = 1:npro
    temp = imrotate(a, apro(i), "bilinear", "crop", 0);
    projecao(:,i) = (sum(temp))';
 end

disp(projecao); #imprime as projecoes

img02 = imagesc(projecao);
print( gcf, '-dpng', fullfile( pwd, 'img02.png' ) );


-- 
Luiz Portella address@hidden


reply via email to

[Prev in Thread] Current Thread [Next in Thread]