View Single Post
Old 06-15-2016, 10:00 PM   #5
plush2
Human being with feelings
 
Join Date: May 2006
Location: Saskatoon, Canada
Posts: 1,827
Default

So I think I've found a script to help with this at the Google mathmap project. Now, among other things I need to know what sort of transform I need to use to create the desired effect from this math.

I've tried with gfx_blit and I can get panning to work but that's all, no bending or windowing of the image. I know I'm way out of my depth with all this but I'm wanting to see it done.

Code:
//@param1:FoV 'view' 150 15 320 150 1
//@param2:eye 'eye' 1 0 1.5 0.5 0.01
//@param3:pan 'pan' 0 -180 180 0.5 1
//@param4:vsh 'shape' 0 -1 1 0 0.01
img1 = 0;
img2 = input_ismaster();
input_info(src,W,H);
pi = 3.14159265;
//angular scale factors 
Sppr = W / (2*pi); //source pixels/radian 
d = eye + 1; 
wfov = pi * min( FoV, 160 * d ) / 180; //radians 
Drpp = 2*d*tan(wfov/(2*d)) / W; 
W > 0 ? (
  gfx_a = W;
  //destination coordinates in radians 
  xr = x * Drpp; yr = (y - Y * vsh) * Drpp; 
  //project from dest to source 
  azi = d * atan2( xr, d); 
  alt = atan2( yr * (eye + cos(azi)), d ); 
  //source coordinates in pixels 
  sx = Sppr*azi; sy = Sppr*alt; 
  //pan & interpolate 
  sx = sx + W*pan/360;
  gfx_blit(img1, paspect, sx|0, sy|0, W, H);
  );
//if sx > X then sx = sx - W end; 
//if sx < -X then sx = sx + W end; 
//in(xy:[sx, sy])
The basic desire is to have Panini type viewer for equirectangular panoramic video.
__________________
mymusic - http://music.darylpierce.com
mywork - http://production.darylpierce.com

Last edited by plush2; 06-16-2016 at 01:40 PM.
plush2 is offline   Reply With Quote