[Octave] Image Processing : Pixel Transformation and Quality Picture.
Hello everyone,
I’m still on the modeling of gravitational lensing.
I intended to proceed in a different method. Let me explain.
I intend to take a picture, for example, a sky with a galaxy. And model the image by a matrix. This matrix would actually be of size N * M (where N is the pixel length of the image and M, the width)
Each pixel would therefore a number of the matrix.
I have two perspectives:
First, create a map as modeling the geometric changes applied to our image (to represent the bending of light rays) and then apply to the image.
The second, operate directly on the image without using a tier modeling.
My result should look like this:
http://www.epm6604b.be/lentille/images/imginfluence/m31_trou_noir.jpg
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 (exemple de trou noir = 1 pixel)
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
% Lentille gravitationnelle
B=[]
for i=1:largeur
for j= 1:longueur
if sqrt((x-x1).^2+(y-y1).^2)<=R:
A(i,j)= 0 % pixel noir
if sqrt((x-x1).^2+(y-y1).^2)>R:
x[i]=i+z2.*((i./z1)-(L/R).*i/R)
y[j]=j+z2.*((j./z1)-(L/R).*j/R)
A(i,j)=B(x[i],y[j])
imread(B)
end
% code
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.
Here i try to create an other matrix B which contains all transformation (or value pixel with relocation).
Next problem : Quality picture:
If i apply these transformations in A matrix, i will lose in image quality? Because when i transformed my image in A matrix, Octave noticed that :
"Warning : Your Version of GraphicsMagick limits images to 8 bits per pixel"
That’s why i would like to know if it could be better to call the image in an other way to keep the original quality picture. But if i must do that, i don’t know how… :/
Excuse me for my expression, but i’m not english.
Thx in AdvanceHello everyone,
I’m still on the modeling of gravitational lensing.
I intended to proceed in a different method. Let me explain.
I intend to take a picture, for example, a sky with a galaxy. And model the image by a matrix. This matrix would actually be of size N * M (where N is the pixel length of the image and M, the width)
Each pixel would therefore a number of the matrix.
I have two perspectives:
First, create a map as modeling the geometric changes applied to our image (to represent the bending of light rays) and then apply to the image.
The second, operate directly on the image without using a tier modeling.
My result should look like this:
http://www.epm6604b.be/lentille/images/imginfluence/m31_trou_noir.jpg
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 (exemple de trou noir = 1 pixel)
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
% Lentille gravitationnelle
B=[]
for i=1:largeur
for j= 1:longueur
if sqrt((x-x1).^2+(y-y1).^2)<=R:
A(i,j)= 0 % pixel noir
if sqrt((x-x1).^2+(y-y1).^2)>R:
x[i]=i+z2.*((i./z1)-(L/R).*i/R)
y[j]=j+z2.*((j./z1)-(L/R).*j/R)
A(i,j)=B(x[i],y[j])
imread(B)
end
% code
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.
Here i try to create an other matrix B which contains all transformation (or value pixel with relocation).
Next problem : Quality picture:
If i apply these transformations in A matrix, i will lose in image quality? Because when i transformed my image in A matrix, Octave noticed that :
"Warning : Your Version of GraphicsMagick limits images to 8 bits per pixel"
That’s why i would like to know if it could be better to call the image in an other way to keep the original quality picture. But if i must do that, i don’t know how… :/
Excuse me for my expression, but i’m not english.
Thx in Advance Hello everyone,
I’m still on the modeling of gravitational lensing.
I intended to proceed in a different method. Let me explain.
I intend to take a picture, for example, a sky with a galaxy. And model the image by a matrix. This matrix would actually be of size N * M (where N is the pixel length of the image and M, the width)
Each pixel would therefore a number of the matrix.
I have two perspectives:
First, create a map as modeling the geometric changes applied to our image (to represent the bending of light rays) and then apply to the image.
The second, operate directly on the image without using a tier modeling.
My result should look like this:
http://www.epm6604b.be/lentille/images/imginfluence/m31_trou_noir.jpg
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 (exemple de trou noir = 1 pixel)
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
% Lentille gravitationnelle
B=[]
for i=1:largeur
for j= 1:longueur
if sqrt((x-x1).^2+(y-y1).^2)<=R:
A(i,j)= 0 % pixel noir
if sqrt((x-x1).^2+(y-y1).^2)>R:
x[i]=i+z2.*((i./z1)-(L/R).*i/R)
y[j]=j+z2.*((j./z1)-(L/R).*j/R)
A(i,j)=B(x[i],y[j])
imread(B)
end
% code
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.
Here i try to create an other matrix B which contains all transformation (or value pixel with relocation).
Next problem : Quality picture:
If i apply these transformations in A matrix, i will lose in image quality? Because when i transformed my image in A matrix, Octave noticed that :
"Warning : Your Version of GraphicsMagick limits images to 8 bits per pixel"
That’s why i would like to know if it could be better to call the image in an other way to keep the original quality picture. But if i must do that, i don’t know how… :/
Excuse me for my expression, but i’m not english.
Thx in Advance image processing, pixel, matrix, simulation MATLAB Answers — New Questions