source: trunk/src/uvmat_doc/FUNCTIONS_DOC/px_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.6 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 px_XYZ</title>
6  <meta name="keywords" content="px_XYZ">
7  <meta name="description" content="'px_XYZ': transform phys coordinates to image coordinates (px)">
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; px_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>px_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>'px_XYZ': transform phys coordinates to image coordinates (px)</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 [X,Y]=px_XYZ(Calib,Xphys,Yphys,Zphys) </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">'px_XYZ': transform phys coordinates to image coordinates (px)
31
32 OUPUT:
33 X,Y: array of coordinates in the image cooresponding to the input physical positions
34                    (origin at lower leftcorner, unit=pixel)</pre></div>
35
36<!-- crossreference -->
37<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
38This function calls:
39<ul style="list-style-image:url(../matlabicon.gif)">
40</ul>
41This function is called by:
42<ul style="list-style-image:url(../matlabicon.gif)">
43<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="geometry_calib.html" class="code" title="function varargout = geometry_calib(varargin)">geometry_calib</a> 'geometry_calib': performs geometric calibration from a set of reference points</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><li><a href="probe_calib.html" class="code" title="function varargout = probe_calib(varargin)">probe_calib</a>     'probe_calib': performs geometric calibration from a set of reference points</li><li><a href="px.html" class="code" title="function [DataOut,DataOut_1]=px(Data,CalibData,Data_1,CalibData_1)%DataIn,Calib)">px</a>     'px': transform fields from physical coordinates (phys) to image (px) coordinates</li><li><a href="set_grid.html" class="code" title="function varargout = set_grid(varargin)">set_grid</a>     'set_grid':produce grid for PIV with one or two images (stereo case)</li><li><a href="uvmat.html" class="code" title="function varargout = uvmat(varargin)">uvmat</a>   'uvmat': function associated with the GUI 'uvmat.fig' for images and data field visualization</li></ul>
44<!-- crossreference -->
45
46
47<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
48<div class="fragment"><pre>0001 <span class="comment">%'px_XYZ': transform phys coordinates to image coordinates (px)</span>
490002 <span class="comment">%</span>
500003 <span class="comment">% OUPUT:</span>
510004 <span class="comment">% X,Y: array of coordinates in the image cooresponding to the input physical positions</span>
520005 <span class="comment">%                    (origin at lower leftcorner, unit=pixel)</span>
530006
540007 <span class="comment">% INPUT:</span>
550008 <span class="comment">% Calib: structure containing the calibration parameters (read from the ImaDoc .xml file)</span>
560009 <span class="comment">% Xphys, Yphys: array of x,y physical coordinates</span>
570010 <span class="comment">% [Zphys]: corresponding array of z physical coordinates (0 by default)</span>
580011
590012
600013 <a name="_sub0" href="#_subfunctions" class="code">function [X,Y]=px_XYZ(Calib,Xphys,Yphys,Zphys)</a>
610014 X=[];<span class="comment">%default</span>
620015 Y=[];
630016 <span class="comment">% if exist('Z','var')&amp; isequal(Z,round(Z))&amp; Z&gt;0 &amp; isfield(Calib,'PlanePos')&amp;length(Calib.PlanePos)&gt;=Z</span>
640017 <span class="comment">%     Zindex=Z;</span>
650018 <span class="comment">%     planepos=Calib.PlanePos{Zindex};</span>
660019 <span class="comment">%     zphys=planepos(3);%A GENERALISER CAS AVEC ANGLE</span>
670020 <span class="comment">% else</span>
680021 <span class="comment">%     zphys=0;</span>
690022 <span class="comment">% end</span>
700023 <span class="keyword">if</span> ~exist(<span class="string">'Zphys'</span>,<span class="string">'var'</span>)
710024     Zphys=0;
720025 <span class="keyword">end</span>
730026
740027 <span class="comment">%%%%%%%%%%%%%</span>
750028 <span class="keyword">if</span> isfield(Calib,<span class="string">'R'</span>)
760029     R=(Calib.R)';
770030     xc=R(1)*Xphys+R(2)*Yphys+R(3)*Zphys+Calib.Tx;
780031     yc=R(4)*Xphys+R(5)*Yphys+R(6)*Zphys+Calib.Ty;
790032     zc=R(7)*Xphys+R(8)*Yphys+R(9)*Zphys+Calib.Tz;
800033 <span class="comment">%undistorted image coordinates</span>
810034     Xu=Calib.f*xc./zc;
820035     Yu=Calib.f*yc./zc;
830036 <span class="comment">%distorted image coordinates</span>
840037     distortion=(Calib.kappa1)*(Xu.*Xu+Yu.*Yu)+1; <span class="comment">%A REVOIR</span>
850038 <span class="comment">% distortion=1;</span>
860039     Xd=Xu./distortion;
870040     Yd=Yu./distortion;
880041 <span class="comment">%pixel coordinates</span>
890042     X=Xd*Calib.sx/Calib.dpx+Calib.Cx;
900043     Y=Yd/Calib.dpy+Calib.Cy;
910044
920045 <span class="keyword">elseif</span> isfield(Calib,<span class="string">'Pxcmx'</span>)&amp;isfield(Calib,<span class="string">'Pxcmy'</span>)<span class="comment">%old calib</span>
930046         X=Xphys*Calib.Pxcmx;
940047         Y=Yphys*Calib.Pxcmy;
950048 <span class="keyword">end</span>
960049
970050</pre></div>
98<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>
99</body>
100</html>
Note: See TracBrowser for help on using the repository browser.