[37] | 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 © 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> > px_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>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> |
---|
| 38 | This function calls: |
---|
| 39 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
| 40 | </ul> |
---|
| 41 | This 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> |
---|
| 49 | 0002 <span class="comment">%</span> |
---|
| 50 | 0003 <span class="comment">% OUPUT:</span> |
---|
| 51 | 0004 <span class="comment">% X,Y: array of coordinates in the image cooresponding to the input physical positions</span> |
---|
| 52 | 0005 <span class="comment">% (origin at lower leftcorner, unit=pixel)</span> |
---|
| 53 | 0006 |
---|
| 54 | 0007 <span class="comment">% INPUT:</span> |
---|
| 55 | 0008 <span class="comment">% Calib: structure containing the calibration parameters (read from the ImaDoc .xml file)</span> |
---|
| 56 | 0009 <span class="comment">% Xphys, Yphys: array of x,y physical coordinates</span> |
---|
| 57 | 0010 <span class="comment">% [Zphys]: corresponding array of z physical coordinates (0 by default)</span> |
---|
| 58 | 0011 |
---|
| 59 | 0012 |
---|
| 60 | 0013 <a name="_sub0" href="#_subfunctions" class="code">function [X,Y]=px_XYZ(Calib,Xphys,Yphys,Zphys)</a> |
---|
| 61 | 0014 X=[];<span class="comment">%default</span> |
---|
| 62 | 0015 Y=[]; |
---|
| 63 | 0016 <span class="comment">% if exist('Z','var')& isequal(Z,round(Z))& Z>0 & isfield(Calib,'PlanePos')&length(Calib.PlanePos)>=Z</span> |
---|
| 64 | 0017 <span class="comment">% Zindex=Z;</span> |
---|
| 65 | 0018 <span class="comment">% planepos=Calib.PlanePos{Zindex};</span> |
---|
| 66 | 0019 <span class="comment">% zphys=planepos(3);%A GENERALISER CAS AVEC ANGLE</span> |
---|
| 67 | 0020 <span class="comment">% else</span> |
---|
| 68 | 0021 <span class="comment">% zphys=0;</span> |
---|
| 69 | 0022 <span class="comment">% end</span> |
---|
| 70 | 0023 <span class="keyword">if</span> ~exist(<span class="string">'Zphys'</span>,<span class="string">'var'</span>) |
---|
| 71 | 0024 Zphys=0; |
---|
| 72 | 0025 <span class="keyword">end</span> |
---|
| 73 | 0026 |
---|
| 74 | 0027 <span class="comment">%%%%%%%%%%%%%</span> |
---|
| 75 | 0028 <span class="keyword">if</span> isfield(Calib,<span class="string">'R'</span>) |
---|
| 76 | 0029 R=(Calib.R)'; |
---|
| 77 | 0030 xc=R(1)*Xphys+R(2)*Yphys+R(3)*Zphys+Calib.Tx; |
---|
| 78 | 0031 yc=R(4)*Xphys+R(5)*Yphys+R(6)*Zphys+Calib.Ty; |
---|
| 79 | 0032 zc=R(7)*Xphys+R(8)*Yphys+R(9)*Zphys+Calib.Tz; |
---|
| 80 | 0033 <span class="comment">%undistorted image coordinates</span> |
---|
| 81 | 0034 Xu=Calib.f*xc./zc; |
---|
| 82 | 0035 Yu=Calib.f*yc./zc; |
---|
| 83 | 0036 <span class="comment">%distorted image coordinates</span> |
---|
| 84 | 0037 distortion=(Calib.kappa1)*(Xu.*Xu+Yu.*Yu)+1; <span class="comment">%A REVOIR</span> |
---|
| 85 | 0038 <span class="comment">% distortion=1;</span> |
---|
| 86 | 0039 Xd=Xu./distortion; |
---|
| 87 | 0040 Yd=Yu./distortion; |
---|
| 88 | 0041 <span class="comment">%pixel coordinates</span> |
---|
| 89 | 0042 X=Xd*Calib.sx/Calib.dpx+Calib.Cx; |
---|
| 90 | 0043 Y=Yd/Calib.dpy+Calib.Cy; |
---|
| 91 | 0044 |
---|
| 92 | 0045 <span class="keyword">elseif</span> isfield(Calib,<span class="string">'Pxcmx'</span>)&isfield(Calib,<span class="string">'Pxcmy'</span>)<span class="comment">%old calib</span> |
---|
| 93 | 0046 X=Xphys*Calib.Pxcmx; |
---|
| 94 | 0047 Y=Yphys*Calib.Pxcmy; |
---|
| 95 | 0048 <span class="keyword">end</span> |
---|
| 96 | 0049 |
---|
| 97 | 0050</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> © 2003</address> |
---|
| 99 | </body> |
---|
| 100 | </html> |
---|