Back to photostream

DeFish

Lower image is using 8mm Samyang fisheye lens, which is unique in using a STEREOGRAPHIC fisheye projection. Upper image is a rectilinear correction which I achieved in software I wrote myself using the formula r = 2f tan(theta/2), where theta is the original angle of projection. This was a field near Fringford, Oxfordshire from May 2016.

 

Here's the serious number crunching which must be done for each and every pixel in turn in Pentium Assembler code. Took about an hour this afternoon to do the maths and get it right. It basically maps the point (xd, yd) in the rectilinear image to the point (xs, ys) in the fisheye image.

 

finit

fild dword [^xd%]

fld st0

fmulp st1,st0

fild dword [^yd%]

fld st0

fmulp st1,st0

faddp st1,st0

fsqrt

fstp tbyte [^rd]

 

fld tbyte [^rd]

fld tbyte [^f]

fdivp st1,st0

fld tbyte [^b]

fmulp st1,st0

fld1

fpatan

fstp tbyte [^th]

 

fld tbyte [^th]

fild dword [^i2%]

fdivp st1,st0

fptan

fstp tbyte [^dmp]

fld tbyte [^f]

fld st0

faddp st1,st0

fmulp st1,st0

fstp tbyte [^rs]

 

fld tbyte [^f01]

fld tbyte [^rd]

fcompp

fstsw ax

and ah,1

jne near alt

fld tbyte [^rs]

fld tbyte [^rd]

fdivp st1,st0

fld tbyte [^a]

fmulp st1,st0

fstp tbyte [^fac]

jmp over

.alt

fldz

fstp tbyte [^fac]

.over

 

fild dword [^xd%]

fld tbyte [^fac]

fmulp st1,st0

fild dword [^wd2%]

faddp st1,st0

fistp dword [^xs%]

 

fild dword [^yd%]

fld tbyte [^fac]

fmulp st1,st0

fild dword [^hg2%]

faddp st1,st0

fistp dword [^ys%]

 

1,680 views
10 faves
2 comments
Uploaded on February 1, 2017