source: trunk/src/uvmat_doc/FUNCTIONS_DOC/phys_XYZ.html @ 37

Last change on this file since 37 was 37, checked in by sommeria, 14 years ago

create_grid.fig ,
uvmat_doc and all the included files added

File size: 6.0 KB
Line 
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 &copy; 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> &gt;  <a href="index.html">.</a> &gt; phys_XYZ.m</div>
16
17<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
18<td align="right"><a href="index.html">Index for .&nbsp;<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
33OUTPUT:
34
35INPUT:
36Z: 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>
40This function calls:
41<ul style="list-style-image:url(../matlabicon.gif)">
42</ul>
43This 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>
510002 <span class="comment">% function [Xphys,Yphys]=phys_XYZ(Calib,X,Y,Z)</span>
520003 <span class="comment">%</span>
530004 <span class="comment">%OUTPUT:</span>
540005 <span class="comment">%</span>
550006 <span class="comment">%INPUT:</span>
560007 <span class="comment">%Z: index of plane</span>
570008 <a name="_sub0" href="#_subfunctions" class="code">function [Xphys,Yphys,Zphys]=phys_XYZ(Calib,X,Y,Z)</a>
580009 <span class="keyword">if</span> exist(<span class="string">'Z'</span>,<span class="string">'var'</span>)&amp; isequal(Z,round(Z))&amp; Z&gt;0 &amp; isfield(Calib,<span class="string">'SliceCoord'</span>)&amp;length(Calib.SliceCoord)&gt;=Z
590010     Zindex=Z;
600011     Zphys=Calib.SliceCoord(Zindex,3);<span class="comment">%GENERALISER AUX CAS AVEC ANGLE</span>
610012 <span class="keyword">else</span>
620013 <span class="comment">%     if exist('Z','var')</span>
630014 <span class="comment">%         Zphys=Z;</span>
640015 <span class="comment">%     else</span>
650016         Zphys=0;
660017 <span class="comment">%     end</span>
670018 <span class="keyword">end</span>
680019 <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>)
690020     Xphys=[];
700021     Yphys=[];<span class="comment">%default</span>
710022     <span class="keyword">return</span>
720023 <span class="keyword">end</span>
730024 Xphys=X;<span class="comment">%default</span>
740025 Yphys=Y;
750026 <span class="comment">%image transform</span>
760027 <span class="keyword">if</span> isfield(Calib,<span class="string">'R'</span>)
770028     R=(Calib.R)';
780029     Dx=R(5)*R(7)-R(4)*R(8);
790030     Dy=R(1)*R(8)-R(2)*R(7);
800031     D0=Calib.f*(R(2)*R(4)-R(1)*R(5));
810032     Z11=R(6)*R(8)-R(5)*R(9);
820033     Z12=R(2)*R(9)-R(3)*R(8); 
830034     Z21=R(4)*R(9)-R(6)*R(7);
840035     Z22=R(3)*R(7)-R(1)*R(9);
850036     Zx0=R(3)*R(5)-R(2)*R(6);
860037     Zy0=R(1)*R(6)-R(3)*R(4);
870038     A11=R(8)*Calib.Ty-R(5)*Calib.Tz+Z11*Zphys;
880039     A12=R(2)*Calib.Tz-R(8)*Calib.Tx+Z12*Zphys;
890040     A21=-R(7)*Calib.Ty+R(4)*Calib.Tz+Z21*Zphys;
900041     A22=-R(1)*Calib.Tz+R(7)*Calib.Tx+Z11*Zphys;
910042     X0=Calib.f*(R(5)*Calib.Tx-R(2)*Calib.Ty+Zx0*Zphys);
920043     Y0=Calib.f*(-R(4)*Calib.Tx+R(1)*Calib.Ty+Zy0*Zphys);
930044         <span class="comment">%px to camera:</span>
940045     Xd=(Calib.dpx/Calib.sx)*(X-Calib.Cx); <span class="comment">% sensor coordinates</span>
950046     Yd=Calib.dpy*(Y-Calib.Cy);
960047     dist_fact=1+Calib.kappa1*(Xd.*Xd+Yd.*Yd); <span class="comment">%distortion factor</span>
970048     Xu=dist_fact.*Xd;<span class="comment">%undistorted sensor coordinates</span>
980049     Yu=dist_fact.*Yd;
990050     denom=Dx*Xu+Dy*Yu+D0;
1000051     <span class="comment">% denom2=denom.*denom;</span>
1010052     Xphys=(A11.*Xu+A12.*Yu+X0)./denom;<span class="comment">%world coordinates</span>
1020053     Yphys=(A21.*Xu+A22.*Yu+Y0)./denom;
1030054 <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> &copy; 2003</address>
105</body>
106</html>
Note: See TracBrowser for help on using the repository browser.