[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Last Turn : Image Processing and Matrix values
From: |
Julien563 |
Subject: |
Re: Last Turn : Image Processing and Matrix values |
Date: |
Thu, 27 Oct 2016 04:59:43 -0700 (PDT) |
Thx a lot,
My last problem, is that for exemple : A(495;495,;) and B(495,495,;) are
the same.
After transformation A(495,495,;) and B(495,495,:) should be different. Is
it an error of affectation? Or just a problem with my equation? Because my
equation are correct but no pixel changes position.
A did B=A
and after i apply changes in B from A. (Look my programm and you will
understand what i mean)
Thx in advance
Julien
-------------------------------------------------------------------------------------------
A=imread('galaxy.bmp');
% Les Constantes
G= 6.67e-11 %Attention! Revoir les unités
c=3.0e+8
M= 1,7e+38 %Masse de la masse déflectrice
z1= 2,75e+15 %Distance de la masse par rapport à la Terre
z2= 2,75e+7%Distance de la galaxie par rapport à la masse
% Liste des Variables
[nr,nc,channels]= size([A])
pixel_x1=round(nr/2)%Coordonnées de la masse
pixel_y1=round(nc/2)
pixel_x_metres=1e+16
pixel_y_metres=1e+16
pixel_x1_metres=(pixel_x_metres.*z1)./(z1+z2)
pixel_y1_metres=(pixel_y_metres.*z1)./(z1+z2)
R= (sqrt((pixel_x1_metres).^2+(pixel_y1_metres).^2)) %Rayon de la masse
déflectrice (exemple de trou noir = 1 pixel)
largeur = nr %largeur de l'image en pixel
longueur = nc %longueur de l'image en pixel
L=(4.*G*M)./(c^2)
B=A
% Lentille gravitationnelle
for pixel_x_metres=(-ceil(nc./2).*(1e+16):(1e+16):floor(nc./2).*(1e+16));%
Boucle OK
for
pixel_y_metres=(-ceil(nr./2).*(1e+16):(1e+16):floor(nr./2).*(1e+16));
%Boucle OK
pixel_x1_metres_boucle=(pixel_x_metres.*z1)./(z1+z2);
pixel_y1_metres_boucle=(pixel_y_metres.*z1)./(z1+z2);
Ralpha = sqrt((pixel_x1_metres).^2+(pixel_y1_metres).^2); % A
revoir
if Ralpha<R; %Condition OK
j=round((pixel_x_metres)./(1e+16))+(floor(nr./2))+1; %OK
i=round((pixel_y_metres)./(1e+16))+(floor(nc/2))+1; %OK
if ((i >=1) && (i <= nr) && (j >= 1) && (j <= nc))
A(i,j,:)= 0; % pixel noir OK
endif
else;
nouveau_pixel_x_metres=pixel_x1_metres_boucle+z2.*((pixel_x1_metres_boucle./z1)-(L/Ralpha).*pixel_x1_metres/Ralpha)
%OK
nouveau_pixel_y_metres=pixel_y1_metres_boucle+z2.*((pixel_y1_metres_boucle./z1)-(L/Ralpha).*pixel_y1_metres/Ralpha)
%OK
j_nouveau=round((nouveau_pixel_x_metres)./(1e+16))+(floor(nr./2))+1 %OK
i_nouveau=round((nouveau_pixel_y_metres)./(1e+16))+(floor(nc./2))+1 %OK
j=round((pixel_x_metres)./(1e+16))+(floor(nr./2))+1 % OK
i=round((pixel_y_metres)./(1e+16))+(floor(nc/2))+1 % OK
if ((i_nouveau >=1) && (i_nouveau <= nr) && (j_nouveau
>= 1) &&
(j_nouveau <= nc))
if ((i >=1) && (i <= nr) && (j >= 1) && (j <=
nc))
B(i_nouveau,j_nouveau,:) = A(i,j,:);
endif
endif
endif
endfor
endfor
imshow(B)
--
View this message in context:
http://octave.1599824.n4.nabble.com/Last-Turn-Image-Processing-and-Matrix-values-tp4680372p4680381.html
Sent from the Octave - General mailing list archive at Nabble.com.