Changes between Version 7 and Version 8 of Tutorial/ParticleImageVelocimetry


Ignore:
Timestamp:
Sep 2, 2013, 11:53:02 PM (8 years ago)
Author:
sommeria
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorial/ParticleImageVelocimetry

    v7 v8  
    4848Similarly, the velocity vectors can be superposed to the vorticity field, selecting '''[vort] ''' in '''[Fields_1]''' instead of '''[image '''.
    4949
    50 = More about PIV =
     50= From pixel displacement to velocity =
     51 So far all PIV results have been expressed as image displacement expressed in pixels. Conversion to velocity requires geometric calibration and timing information. Calibration is described in [wiki:"Tutorial: geometric calibration" Tutorial: geometric calibration]. The result of calibration is stored in an xml file.
    5152
    52 == PIV parameters ==
     53The time interval between the two images, Dt=0.02 s, must be introduced in this xml file by adding a section <Camera>, using a text editor:
     54<ImaDoc>
     55  <Camera>
     56           <TimeUnit>s</TimeUnit>
     57           <BurstTiming>
     58                   <Dti>0.02</Dti>
     59                   <NbDti>1</NbDti>
     60           </BurstTiming>
     61  </Camera>
     62</ImaDoc>
     63This input is preferably introduced automatically by the computer which controls the camera, or for videos, directly encoded in the movie file.
     64
     65When this xml file is present in the image directory, the time of each frame (with t=0 by default at the first frame) is displayed in the box [time] of the Input frame at the top right of the GUI. The velocity field is then displayed in terms of physical velocity. To come back to the image coordinates, use the box [transform_fct] on the left : select to blank or ’px’ instead of ’phys’.
     66
     67Note that the netcdf file has not been by changed by calibration, whose rescaling is introduced after reading the file. This means that calibration can be provided, and possibly updated, after the PIV processing.
     68
     69
     70= The main PIV parameters =
     71The first parameter to adjust is the time interval between images, which should be sufficiently long to provide a displacement of a few pixels. The measurement precision is typically 0.2 pixel, so that a displacement of 4 pixels, as in the example, provides a relative precision of 5 %. A larger displacement would be preferable in terms of precision but may yield to poor image correlation and ’false vectors’.
     72
     73Once the image pair has been chosen, the main parameters are the size of the correlation box in both directions ([Bx], [By]) and the size of the search box, ([SearchX],[SearchY]), expressed in pixels. For each velocity vector, the correlation box is moved within the search box to optimise the image correlation between the two sub-images inside the correlation box. To allow for a displacement of d pixels, the search box size must exceed the correlation box by at least d+2 on both sides, so 2d+4. A systematic shift [ShiftX],[ShiftY] can be also introduced to minimise the search area in the presence of a mean flow.
     74
     75The parameter [Rho(image)] is used to fit the correlation data with a smooth function to obtain the maximum with sub-pixel precision. We generally keep the default value 1.
     76
     77The parameters [Dx] and [Dy] define the mesh of the measurement grid, in pixels. Reduce them to get more vectors, but keep in mind that the spatial resolution is limited by the width of the correlation box.
     78
     79The PIV operation is conveniently visualised by pressing the button [TEST_civ1] in the GUI civ. Then the image appear in a new GUI view_field, in which the mouse motion displays the correlation function, which appears in a secondary window, see figure. The resulting vector is shown as a line pointing to the correlation maximum. The corresponding correlation and search boxes are shown in the image.
    5380Let us run again PIV with Search x,y=(31,31). Many black vectors are obtained...
    5481
    55 == Masks ==
     82= Masks =
     83Spurious vectors are observed outside the fluid domain, which particularly disturbing when spatial derivatives are calculated.
     84
     85This can be avoided by using a mask, which is an image of the same size as the images used for PIV. Grey color in the mask indicate regions excluded from measurement.
     86
     87To produce the mask, first create a polygon by the menu bar command [Projection object/mask polygon]. Draw the mask with the mouse by moving around regions to exclude. Left mouse button to initiate the plot and produce new boundary points, press right hand button to finalise the polygon. By default mask is set inside the polygon, but it can be made outside by selecting the option ’mask_outside’ in the menu [ProjMode] of the GUI set_object.
     88
     89Then the mask itself is produced by the menu bar command [Tools/Make mask]. The corresponding image is then displayed and stored by default in the directory of the initial image. Note that if several mask polygons have been initially created, as listed in [ListObject] (bottom right of the GUI uvmat), they will be merged as dark regions in the resulting mask (useful in case of multiple ’holes’).
     90
     91The mask image can be seen as a mask by selecting [view_mask] at the upper left of the GUI uvmat. For checking purpose, it can be also opened by the browser of uvmat like any image. In the GUI civ, the mask is introduced by the selecting the green check box [Mask]. Vectors under the mask are not calculated in the resulting velocity data.
     92
     93= Refined PIV =
     94
     95To improve the results, come back to the GUI CIV , and follow these successive steps, corresponding to a sequence of operations.
     96Optimizing the Civ1 parameters
     97
     98Select the [CIV1] check box so the corresponding parameters show up. Improve the spatial resolution by selecting smaller correlation boxes in the civ1 menu, for instance [Bx],[By] to 19 and 13 (image pixels). This is possible because of the good image quality and high particle density. The use of a smaller box in y allows to optimize the resolution in this direction, to deal with the strong vertical shear. It is now possible to adjust the search range, using knowledge on extremal velocities, see histograms displayed by uvmat in phys coordinates. We introduce estimated bounds on each velocity component, [min] to -2 and [max] to 6 for ’u’ and (-3, 3) for ’v’, and press the button [Search Range] . The optimum search ranges and shifts are now displayed. In consistency with higher resolution, we set the grid mesh to [Dx] and [Dy] to 10. Finally select the Mask option : the mask name should be displayed in the corresponding edit box, else a browser leads to the appropriate mask file.
     99FIX1
     100
     101Select the ’FIX1’ operation, which eliminates some false vectors using several criteria. Use the default parameters.
     102PATCH1
     103
     104Select the ’PATCH1’ operation, to interpolate the vectors on a regular grid and calculate spatial derivatives. Select a high resolution [nx]=100, [ny]=30, number of grid points in which the velocity will be interpolated. These values correspond to dx=dy=10 pixels for an image 1000x300. Choose the default value 10 for the smoothing parameter ’rho’ . You can later try different values, the smoothing effect increasing with rho. Keep the default values for the other parameters.
     105CIV2
     106
     107Select the ’CIV2’ operation to improve the correlation results, using the information on local image deformation, provided by the previous knowledge on velocity spatial derivatives (calculated in patch1). Use a finer grid dx= dy=5 than for civ1. The spatial resolution can be slightly improved by decreasing the correlation box, using for instance Bx,By=(15,11). The search range is determined automatically using the prior knowledge on velocity, obtained with the civ1 and patch1 operations. Note that ’civ2’ corresponds to a new measurement from the images, the previous civ1 and patch operations being used only as an initial guess for the search of optimal correlations.
     108
     109Then select ’FIX2’ and ’PATCH2’ with the same parameters as ’FIX1’ and ’PATCH1’.
     110Running the calculation
     111
     112Press [RUN] to run the calculation. The results are stored in a new subdirectory, CIV_1, so the previous results are not erased (you can also set the name of the subdirectory in the GUI, by the edit boxes [SubDirCiv1] and [SubDirCiv2]. The existing subdirectories are listed above.
     113
     114The status of the calculation is displayed in a new window which refreshes automatically. Close it to avoid blocking of new Matlab operations. This status window can be opened again by pushing the button [STATUS] in the GUI civ. Do not close civ until the calculation is finished.
     115
     116The parameters of a CIV computation are stored in a xml file with extension ..CivDoc.xml created in the directory containing the velocity files. These parameters can retrieved, opening this xml file with the browser of the GUI civ. Then the image file itself needs to be opened (the select again the check boxes for the operations beyond civ1 hidden by default).
     117
     118The result can be improved again by performing a third civ iteration, civ3. For that purpose, select only the ’civ2’, ’fix2’ and ’patch2’ operations with the same parameters as previously. The previous result is now considered as ’civ1’, so set CIV as the subdirectory in the edit window [SubDirCiv1]. Select a new subdirectory name, for instance ’CIV3’ in the edit window [SubDirCiv2]. Further iterations could be similarly performed, but the improvement becomes negligible.
     119
     120The following figure shows the final vorticity field, in which the vorticity roll up in the wake of the sphere is clearly visible. A zoom near a vortex shows the vorticity superposed with velocity vectors.
    56121
    57122== Fix and patch ==
     
    61126== Civ3 ==
    62127
    63 == From pixel displacement to velocity ==
    64  So far all pIV results have been expressed as image displacement expressed in pixels. Conversion to velocity requires geometric calibration and timing information. Calibration is described in [wiki:"Tutorial: geometric calibration" Tutorial: geometric calibration]. The result of calibration is stored in an xml file. The time interval must be then introduced in this xml file by adding a section, using a text editor.
    65 
    66 
    67