1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/REC-html40/loose.dtd"> |
---|
3 | <html> |
---|
4 | <head> |
---|
5 | <title>Description of phys_XYZ</title> |
---|
6 | <meta name="keywords" content="phys_XYZ"> |
---|
7 | <meta name="description" content="'phys_XYZ':transforms image (px) to real world (phys) coordinates using geometric calibration parameters"> |
---|
8 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
9 | <meta name="generator" content="m2html © 2003 Guillaume Flandin"> |
---|
10 | <meta name="robots" content="index, follow"> |
---|
11 | <link type="text/css" rel="stylesheet" href="../m2html.css"> |
---|
12 | </head> |
---|
13 | <body> |
---|
14 | <a name="_top"></a> |
---|
15 | <div><a href="../index.html">Home</a> > <a href="index.html">.</a> > phys_XYZ.m</div> |
---|
16 | |
---|
17 | <!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td> |
---|
18 | <td align="right"><a href="index.html">Index for . <img alt=">" border="0" src="../right.png"></a></td></tr></table>--> |
---|
19 | |
---|
20 | <h1>phys_XYZ |
---|
21 | </h1> |
---|
22 | |
---|
23 | <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
24 | <div class="box"><strong>'phys_XYZ':transforms image (px) to real world (phys) coordinates using geometric calibration parameters</strong></div> |
---|
25 | |
---|
26 | <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
27 | <div class="box"><strong>function [Xphys,Yphys,Zphys]=phys_XYZ(Calib,X,Y,Z) </strong></div> |
---|
28 | |
---|
29 | <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
30 | <div class="fragment"><pre class="comment">'phys_XYZ':transforms image (px) to real world (phys) coordinates using geometric calibration parameters |
---|
31 | function [Xphys,Yphys]=phys_XYZ(Calib,X,Y,Z) |
---|
32 | |
---|
33 | OUTPUT: |
---|
34 | |
---|
35 | INPUT: |
---|
36 | Z: index of plane</pre></div> |
---|
37 | |
---|
38 | <!-- crossreference --> |
---|
39 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
40 | This function calls: |
---|
41 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
42 | </ul> |
---|
43 | This function is called by: |
---|
44 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
45 | <li><a href="RUN_STLIN.html" class="code" title="function RUN_STLIN(file_A,file_B,vel_type,file_st,nx_patch,ny_patch,thresh_patch,fileAxml,fileBxml)">RUN_STLIN</a> 'RUN_STLIN': combine velocity fields for stereo PIV</li><li><a href="phys.html" class="code" title="function [DataOut,DataOut_1]=phys(varargin)">phys</a> 'phys': transforms image (px) to real world (phys) coordinates using geometric calibration parameters</li><li><a href="phys_polar.html" class="code" title="function [DataOut,DataOut_1]=phys_polar(varargin)">phys_polar</a> transform image coordinates (px) to physical coordinates</li></ul> |
---|
46 | <!-- crossreference --> |
---|
47 | |
---|
48 | |
---|
49 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
50 | <div class="fragment"><pre>0001 <span class="comment">%'phys_XYZ':transforms image (px) to real world (phys) coordinates using geometric calibration parameters</span> |
---|
51 | 0002 <span class="comment">% function [Xphys,Yphys]=phys_XYZ(Calib,X,Y,Z)</span> |
---|
52 | 0003 <span class="comment">%</span> |
---|
53 | 0004 <span class="comment">%OUTPUT:</span> |
---|
54 | 0005 <span class="comment">%</span> |
---|
55 | 0006 <span class="comment">%INPUT:</span> |
---|
56 | 0007 <span class="comment">%Z: index of plane</span> |
---|
57 | 0008 <a name="_sub0" href="#_subfunctions" class="code">function [Xphys,Yphys,Zphys]=phys_XYZ(Calib,X,Y,Z)</a> |
---|
58 | 0009 <span class="keyword">if</span> exist(<span class="string">'Z'</span>,<span class="string">'var'</span>)& isequal(Z,round(Z))& Z>0 & isfield(Calib,<span class="string">'SliceCoord'</span>)&length(Calib.SliceCoord)>=Z |
---|
59 | 0010 Zindex=Z; |
---|
60 | 0011 Zphys=Calib.SliceCoord(Zindex,3);<span class="comment">%GENERALISER AUX CAS AVEC ANGLE</span> |
---|
61 | 0012 <span class="keyword">else</span> |
---|
62 | 0013 <span class="comment">% if exist('Z','var')</span> |
---|
63 | 0014 <span class="comment">% Zphys=Z;</span> |
---|
64 | 0015 <span class="comment">% else</span> |
---|
65 | 0016 Zphys=0; |
---|
66 | 0017 <span class="comment">% end</span> |
---|
67 | 0018 <span class="keyword">end</span> |
---|
68 | 0019 <span class="keyword">if</span> ~exist(<span class="string">'X'</span>,<span class="string">'var'</span>)|~exist(<span class="string">'Y'</span>,<span class="string">'var'</span>) |
---|
69 | 0020 Xphys=[]; |
---|
70 | 0021 Yphys=[];<span class="comment">%default</span> |
---|
71 | 0022 <span class="keyword">return</span> |
---|
72 | 0023 <span class="keyword">end</span> |
---|
73 | 0024 Xphys=X;<span class="comment">%default</span> |
---|
74 | 0025 Yphys=Y; |
---|
75 | 0026 <span class="comment">%image transform</span> |
---|
76 | 0027 <span class="keyword">if</span> isfield(Calib,<span class="string">'R'</span>) |
---|
77 | 0028 R=(Calib.R)'; |
---|
78 | 0029 Dx=R(5)*R(7)-R(4)*R(8); |
---|
79 | 0030 Dy=R(1)*R(8)-R(2)*R(7); |
---|
80 | 0031 D0=Calib.f*(R(2)*R(4)-R(1)*R(5)); |
---|
81 | 0032 Z11=R(6)*R(8)-R(5)*R(9); |
---|
82 | 0033 Z12=R(2)*R(9)-R(3)*R(8); |
---|
83 | 0034 Z21=R(4)*R(9)-R(6)*R(7); |
---|
84 | 0035 Z22=R(3)*R(7)-R(1)*R(9); |
---|
85 | 0036 Zx0=R(3)*R(5)-R(2)*R(6); |
---|
86 | 0037 Zy0=R(1)*R(6)-R(3)*R(4); |
---|
87 | 0038 A11=R(8)*Calib.Ty-R(5)*Calib.Tz+Z11*Zphys; |
---|
88 | 0039 A12=R(2)*Calib.Tz-R(8)*Calib.Tx+Z12*Zphys; |
---|
89 | 0040 A21=-R(7)*Calib.Ty+R(4)*Calib.Tz+Z21*Zphys; |
---|
90 | 0041 A22=-R(1)*Calib.Tz+R(7)*Calib.Tx+Z11*Zphys; |
---|
91 | 0042 X0=Calib.f*(R(5)*Calib.Tx-R(2)*Calib.Ty+Zx0*Zphys); |
---|
92 | 0043 Y0=Calib.f*(-R(4)*Calib.Tx+R(1)*Calib.Ty+Zy0*Zphys); |
---|
93 | 0044 <span class="comment">%px to camera:</span> |
---|
94 | 0045 Xd=(Calib.dpx/Calib.sx)*(X-Calib.Cx); <span class="comment">% sensor coordinates</span> |
---|
95 | 0046 Yd=Calib.dpy*(Y-Calib.Cy); |
---|
96 | 0047 dist_fact=1+Calib.kappa1*(Xd.*Xd+Yd.*Yd); <span class="comment">%distortion factor</span> |
---|
97 | 0048 Xu=dist_fact.*Xd;<span class="comment">%undistorted sensor coordinates</span> |
---|
98 | 0049 Yu=dist_fact.*Yd; |
---|
99 | 0050 denom=Dx*Xu+Dy*Yu+D0; |
---|
100 | 0051 <span class="comment">% denom2=denom.*denom;</span> |
---|
101 | 0052 Xphys=(A11.*Xu+A12.*Yu+X0)./denom;<span class="comment">%world coordinates</span> |
---|
102 | 0053 Yphys=(A21.*Xu+A22.*Yu+Y0)./denom; |
---|
103 | 0054 <span class="keyword">end</span></pre></div> |
---|
104 | <hr><address>Generated on Fri 13-Nov-2009 11:17:03 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address> |
---|
105 | </body> |
---|
106 | </html> |
---|