help-octave
[Top][All Lists]
Advanced

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

Re: How to work on each image pixel?


From: Julien563
Subject: Re: How to work on each image pixel?
Date: Tue, 18 Oct 2016 07:31:35 -0700 (PDT)

A=imread('galaxy.jpg')
% Liste des Variables
[nr,nc]= size([A])
x1=y1=500 % Position de la masse défléctrice
R= 1 %Rayon de la masse déflectrice
largeur = nc  %largeur de l'image 
longeur = nr %longueur de l'image
Ralpha=(sqrt((x-x1).^2+(y-y1).^2)) 
L=(4.*G*M)./(c^2)

% Les Constantes

G= 6.67e-11
c=3.0e+8 
M= 1,7e+38 %Masse de la masse déflectrice
z2 = 9,5e+15 %Distance de la masse par rapport à la galaxie
z1= 2,75e+22 %Distance par rapport à la Terre 
n=5
% Lentille gravitationnelle 
B=[]
for i= 0:largeur
        for j= 0:longueur
        n=n+1
                if sqrt((x-x1).^2+(y-y1).^2)<=R:
                        A(i,j)= 0 % pixel noir
                else sqrt((x-x1).^2+(y-y1).^2)>R:
                        x[n]=i+z2.*((i./z1)-(L/R).*i/R)
                        y[n]=j+z2.*((j./z1)-(L/R).*j/R)
                        A(i,j)=A(x[n],y[n])
imread(B)

--------------------

I tried to do it for transformations.  If i try to change A(i,j) to A(x4,y4)
i will change the original pixel wich locate in (x,y) but when the programm
will go to A(x4,y4) throught i,j coordonate. 
The pixel itself has already been moved, it will not change the original
pixel but the pixel from (i, j) already transformed. So how can we apply
transformations while telling it not to apply transformations on the
transformed pixel but the original pixel in this position previously.



--
View this message in context: 
http://octave.1599824.n4.nabble.com/How-to-work-on-each-image-pixel-Not-Resolved-tp4680180p4680215.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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