[go: up one dir, main page]

Menu

[r9]: / common / space_correction.f90  Maximize  Restore  History

Download this file

52 lines (33 with data), 1.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
subroutine space_correction
real:: H1 ! Distance between the camera and the water surface unit : cm
real:: H2 ! Distance between the water surface and the laser sheet unit : cm
real,dimension(2),intent(in):: X0 ! Position on the image ie on the water surface in PIXEL unit
real,dimension(2)::Xi ! Translation for initial calibration :)
real,dimension(2):: X1 ! Position on the image ie on the surface 1 ( water ) INPUT in cm unit
real,dimension(2),intent(out):: X2 ! Position in the real space ie at the laser sheet level OUTPUT
real,dimension(2)::teta,beta ! tmp angles
real::n1,n2 ! indice for the air and the water
integer::KXORD,KYORD,NXOUT,NYOUT
real,dimension(:)::XKNOT,YKNOT,BSCOEFX,BSCOEFY
integer,dimension(2)::sym_flag
!loading spline coefficients
open(unit=9,file='nikon50mm.splinecoef',form='binary',status='replace')
read(9) KXORD,KYORD,NXOUT,NYOUT
allocate(XKNOT(KXORD+NXOUT),YKNOT(KYORD+NYOUT),BSCOEFX(NXOUT*NYOUT),BSCOEFY(NXOUT*NYOUT))
read(9) XKNOT,YKNOT,BSCOEFX,BSCOEFY
close(9)
! Xi is the translation of the relative space for the splined and the center of the image.
Xi(1)=BS2VL(511.5,511.5,KXORD,KYORD,XKNOT,YKNOT,NXOUT,NYOUT,BSCOEFX)
Xi(2)=BS2VL(511.5,511.5,KXORD,KYORD,XKNOT,YKNOT,NXOUT,NYOUT,BSCOEFY)
sym_flag=1
X1(1)=BS2VL(X0(1)-1.,X0(2)-1.,KXORD,KYORD,XKNOT,YKNOT,NXOUT,NYOUT,BSCOEFX)
X1(2)=BS2VL(X0(1)-1.,X0(2)-1.,KXORD,KYORD,XKNOT,YKNOT,NXOUT,NYOUT,BSCOEFY)
X1=X1-Xi
! X1 is now the position in cm from the image center if we were at the bottom of the tank and without water .
X1=X1*H1/466.*20 ! the unit in the spline is 20 cm.
! X1 is now the distance between the image center and the point if it was at the water surface .
teta=atan(X1/H1)
beta=asin(n1/n2*sin(teta))
X2=tan(beta)*H2+X1
deallocate(XKNOT,YKNOT,BSCOEFX,BSCOEFY)
end subroutine space_correction