|
![](/i/fill.gif) |
Alf Peake wrote:
>Maybe worth checking astro stuff?
>Adaptive optics where the image is distorted to remove atmospheric
>distortions. Perhaps the way images from multiple sites are combined.
>
>
>Alf
>
VISAR came from NASA where they were using it to look at sunspots I
believe...
still, I understand that the commercial set up goes for about $20k, if
you have any
idea of where to look for free software from astronomical places....
So far I've managed to straighten one of my test images, but it still
seems a bit off
of true...
#version 3.5;
#include "colors.inc"
#include "math.inc"
global_settings { assumed_gamma 1.0 }
// ----------------------------------------
camera {
orthographic
location <1, 1, -2.0>
look_at <1, 1, 0>
}
background {rgb <0.5, 0.5, 0.5>}
// show the X and Y Axis
// cylinder {-200*x, 200*x, 0.01 pigment {checker Red White translate
-0.5*y} finish {ambient 1}}
// cylinder {-200*y, 200*y, 0.01 pigment {checker Red White translate
-0.5*x} finish {ambient 1}}
#declare xsize = 100; // image size
#declare ysize = 100;
#declare AX = 18 /xsize; // coords of rectangle in image to be
straightened
#declare AY = 5 /ysize;
#declare BX = 84 /xsize;
#declare BY = 12 /ysize;
#declare CX = 6 /xsize;
#declare CY = 84 /ysize;
#declare DX = 94 /xsize;
#declare DY = 96 /ysize;
#declare fn_image = function { // the input image
pigment {
image_map {
png "testimg.png"
once
}
scale <xsize, ysize, 1> // pixel units
}
}
#local SAB = (BY-AY)/(BX-AX); // slope along AB = (BY-AY)/(BX-AX)
#local SCD = (DY-CY)/(DX-CX); // slope along CD = (DY-CY)/(DX-CX)
#local SACr = (CX-AX)/(CY-AY); // slope along AC (rotated) = (CX-AX)/(CY-AY)
#local SBDr = (DX-BX)/(DY-BY); // slope along BD (rotated) = (DX-BX)/(DY-BY)
#local IA = 1-(AY - SAB*AX); // intersect of AB with Y axis = AY -
slope at A * AX
#local IC = 1-(CY - SCD*CX); // intersect of CD with Y axis = CY -
slope at C * CX
#local IB = (CX - SACr*CY); // intersect of AC with X axis = CX -
slope at AC* CY
#local ID = (DX - SBDr*DY); // intersect of BD with X axis = CX -
slope at AC* CY
#local fn_I = function(v) { ((IA-IC)*v )}; // ((IA-IC)*v + IC)}; // (min
- max)*v -max
#local fn_S = function(v) { (SAB-SCD)*v + SCD};
#local fn_Ib = function(u) { ((IB-ID)*u + ID)};
#local fn_Sb = function(u) { ((SACr-SBDr)*u + SBDr)};
#local fn_deformy = function(u,v) { (fn_S(v)*u + fn_I(v)) }; // u
#local fn_deformx = function(u,v) { (1-(fn_Sb(u)*v + fn_Ib(u))) }; // v
mesh2 {
vertex_vectors {
xsize*ysize,
#local ypix = 0;
#while (ypix != ysize)
#local xpix = 0;
#while (xpix != xsize)
<fn_deformx(xpix/xsize,ypix/ysize),fn_deformy(xpix/xsize,ypix/ysize),0>,
#local xpix = xpix +1;
#end
#local ypix = ypix +1;
#end
}
texture_list {
xsize*ysize,
#local ypix = 0;
#while (ypix != ysize)
#local xpix = 0;
#while (xpix != xsize)
texture {
pigment {
rgb <fn_image(xpix,ypix,0).x,
fn_image(xpix,ypix,0).y,
fn_image(xpix,ypix,0).z>
}
finish {ambient 1}
}
#local xpix = xpix +1;
#end
#local ypix = ypix +1;
#end
}
face_indices {
(xsize-1)*(ysize-1)*2,
#local ypix = 0;
#while (ypix != (ysize-1))
#local xpix = 0;
#while (xpix != (xsize-1))
<ypix*xsize+xpix, ypix*xsize+xpix+1, (ypix+1)*xsize+xpix>,
ypix*xsize+xpix, ypix*xsize+xpix+1, (ypix+1)*xsize+xpix,
<ypix*xsize+xpix+1, (ypix+1)*xsize+xpix+1, (ypix+1)*xsize+xpix>,
ypix*xsize+xpix+1, (ypix+1)*xsize+xpix+1, (ypix+1)*xsize+xpix,
#local xpix = xpix +1;
#end
#local ypix = ypix +1;
#end
}
scale 2
}
Post a reply to this message
|
![](/i/fill.gif) |