Changes between Version 24 and Version 25 of Tutorial/ParticleImageVelocimetry


Ignore:
Timestamp:
Jan 20, 2015, 11:48:13 PM (6 years ago)
Author:
sommeria
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorial/ParticleImageVelocimetry

    v24 v25  
    11[[TracNav(Tutorial/TOC)]]
     2
    23= [wiki:Tutorial] / Particle Image Velocimetry =
    3 
    4 Open again the first example of image pair in UVMAT_DEMO01_pair.
    5 (accessible on http://servforge.legi.grenoble-inp.fr/pub/soft-uvmat/).
     4Open again the first example of image pair in UVMAT_DEMO01_pair. (accessible on http://servforge.legi.grenoble-inp.fr/pub/soft-uvmat/).
    65
    76= Starting PIV =
    8 
    97== Visual check ==
    108Particle Image Velocimetry (PIV) measures the displacement of features in a pair of images. Visual evidence of feature displacement between the two images is a prerequisite  for the success of the computation. To observe this motion, write the file indices 1 and 2 in the boxes '''[i1]''' and '''[i2]''' respectively, in the frame '''[File Indices]''' on the left. Then push the red button '''[<-->]''' in the frame '''[Navigate]''', see figure. The image then alternatively switches from 1 to 2. The speed of motion can be adjusted with the slider '''[speed]'''. Press '''[STOP]''' to stop the motion.
     
    1513The PIV computation is accessed from uvmat by the upper bar command '''[Run/PIV]''', or from '''series''' by selecting the function '''civ_series'''. The name 'CIV' means '''C'''orrelation '''I'''maging '''V'''elocity to stress that the method relies on image correlation, which evaluates the displacement of image textures, not necessarily from particles. Note that an older GUI ''''civ'''' is also available, but it is obsolete and not used here.
    1614
    17 A new GUI 'civ_input' now appears. In the menu '''[!ListCompareMode]''', keep the default option 'PIV'. Keep also the default option 'Di=0|1' for the image pair (menu tag '''[!ListPairCiv1]'''). Keep also the default parameters in the frame '''CIV1''' and press '''OK'''.
     15A new GUI '''civ_input''' now appears. In the menu '''[!ListCompareMode]''', keep the default option 'PIV'. Keep also the default option 'Di=0|1' for the image pair (menu tag '''[!ListPairCiv1]'''). Keep also the default parameters in the frame '''CIV1''' and press '''OK''', so the GUI '''civ_input''' desappears.  Then press '''[RUN] ''' in the GUI''' series''' to run the calculation. The button '''[RUN]''' is then colored to yellow until the computation is finished.
    1816
    19 The PIV operation depends on several parameters, but the default values proposed by the GUI provide a good first approach in many cases. Press '''[RUN] ''' to get the result. The button is then colored in grey until the computation is finished. The operation produces a  file with format netcdf, extension '''.nc''', in a subdirectory called ''''CIV' ''' by default. The file name ends with index string '_1-2' indicating that it results from images 1 and 2. The file name and its status is indicated in a new figure '''civ_status'''. Press the file name to open it with uvmat, or use the browser of '''uvmat'''.
     17The operation produces a  file with format netcdf, named with extension '''.nc''', in a folder called ''Images.civ''. This can be viewed by pressing '''[STATUS] '''in the GUI '''series''', which displays the result file ''frame_1-2.nc''. The index string '_1-2' indicates that it results from images 1 and 2. Select the file name and press '''[OPEN]''' to open it directly with '''uvmat''', or use the browser of '''uvmat'''.
    2018
    2119[[Image(Civ_1.JPG)]]
    2220
    2321= Monitoring PIV results =
    24 
    2522== Visualizing  the velocity fields ==
    26 In ''''uvmat' '''velocity vectors are displayed in the central window, while the histograms of each component are in the lower left windows, see Fig. [uvmat_fig]. The arrow length is automatically set by default. It can be adjusted by the edit box '''[!VecScale]''' in the  frame '''[Vectors]''' on the right hand side.
     23In '''uvmat '''velocity vectors are displayed in the central window, while the histograms of each component are in the lower left windows. The arrow length is automatically set by default. It can be adjusted by the edit box '''[num_!VecScale]''' in the  frame '''[Vectors]''' on the right hand side.
    2724
    2825The vector color indicates the quality of the image correlation maximum leading to each vector, blue is excellent, green average, red poor. The thresholds for such color display can be adjusted from 0 to 1 (perfect image correlation)  in the frame''' [Vectors]''', using the boxes '''[!ColCode1] ''' and '''[!ColCode2]''',  or equivalently by the corresponding  sliders '''[Slider1]''' and '''[Slider2] '''.
     
    3027The black color indicates warning in the PIV calculation process. In this example, black vectors are indeed located on the edge, in zones outside the area of flow visualisation (this display can be desactivated by unselecting the box '''hide warn''' (tag '''[!CheckHideWarning]''') in the frame '''Vectors''').
    3128
    32 The position (x,y) and velocity components (U,V) can be displayed in the upper right text display window by moving the mouse over it. The correlation 'C' and warning flag 'F' are also indicated. The warning flag is equal to 0 for good vectors while non-zero values indicate different cases of calculation problems.
     29The position (''x,y'') and velocity components (''U,V'') can be displayed in the upper right text display window by moving the mouse over it. The correlation 'C' and warning flag 'F' are also indicated. The warning flag is equal to 0 for good vectors while non-zero values indicate different calculation problems, see below.
    3330
    3431== Histograms ==
    35 The global histograms of the vector components  are available in the lower left windows. Histograms limited to a sub-region can be extracted by the menu bar tool '''[Projection object]''', selecting either ['''rectangle]''', '''[ellipse]''' or '''[polygon]''' to define the sub-region (see [wiki:Tutorial/ProjectionObjects projection objects])
     32The global histograms of the vector components  are available in the lower left windows. Histograms limited to a sub-region can be extracted by the menu bar tool '''[Projection object]''', selecting either''' [rectangle]''', '''[ellipse]''' or '''[polygon]''' to define the sub-region (see [wiki:Tutorial/ProjectionObjects projection objects])
    3633
    3734== Profiles ==
    38 The velocity profile along a line can be obtained by creating a line with the upper menu bar '''[Projection object/line]''', like for image luminosity (see [wiki:Tutorial/ProjectionObjects projection objects]). Press (and release) the left hand side mouse button, draw the line, and pres it again for the end of the line. The transverse and longitudinal velocity components along this line are then plotted in a new  figure '''view_field'''.
     35The velocity profile along a line can be obtained by creating a line with the upper menu bar '''[Projection object/line]''', like for image luminosity (see [wiki:Tutorial/ProjectionObjects projection objects]). Press (and release) the left hand side mouse button, draw the line, and press it again for the end of the line. The transverse and longitudinal velocity components along this line are then plotted in a new  figure '''view_field'''.
    3936
    4037== Other vector color representations ==
    41 Vector color can also  represent another quantity, as chosen in the menu '''[!ColorScalar] ''' in the frame '''[Vectors]'''. For instance the vector length 'norm(U,V)' can be used. Then a color continuous 64 color code is appropriate, as set in the menu '''[!ColorCode]'''. The color codes values between the valuies set by '''[!MinVec] ''' and '''[!MaxVec].'''
     38Vector color can also  represent another quantity, as chosen in the menu '''[!ColorScalar] ''' in the frame '''[Vectors]'''. For instance the vector length 'norm(U,V)' can be used. Then a color continuous 64 color code is appropriate, as set in the menu '''[!ColorCode]'''. The color code extrema are set by '''[num_!MinVec] ''' and '''[num_MaxVec]''', choose for instance 0 and 5 respectively.''''''
    4239
    4340== Derived fields ==
     41Other field representations are available, selected in the menu '''[Fields]''' at the top of the GUI. For instance the option 'U' provides a (false) color map of the x wise velocity component. The color code can be adjusted by the edit box '''[num_MinA] ''' (saturated blue color below this value) and '''[num_MaxA]''' (saturated red color beyond this value). Choose for instance -1 and 5 respectively.
    4442
    45 Other field representations are available, selected in the menu '''[Fields]''' at the top of the GUI. For instance the option 'u' provides a (false) color map of the x wise velocity component. A contour plot can be obtained instead of a color map by selecting the option 'contour' in the menu '''[!ListContour]''' in the frame''' [Scalar] '''. Then select the contour interval, for instance 0.5. The result is shown in the following figure.
     43A contour plot can be obtained instead of a color map by selecting the option 'contour' in the menu '''[!ListContour]''' in the frame''' [Scalar] '''. Then select the contour interval, for instance 0.5. The result is shown in the following figure.
    4644
    4745[[Image(contours.JPG)]]
    4846
    49 To get the vorticity field, 'vort' , and other spatial derivatives, you need to come back to the GUI CIV, select the check boxes '''[FIX1] ''' and  '''[PATCH1] ''' , and press '''[RUN]'''. This will produce an interpolated velocity field and their spatial derivatives in the same netcdf file.  After this operation vorticity can be visualized in the GUI  '''uvmat''', selecting the option  '''[vort] ''' in the popup  menu '''[Fields]'''. The color code can be adjusted by the edit box '''[MinA] ''' (saturated blue color below this value) and '''[MaxA]''' (saturated red color beyond this value).
     47To get the vorticity field, 'vort' , and other spatial derivatives, you need to come back to the GUI''' series''' with images as input and action civ_series'''. '''In''' civ_input''', select the check boxes '''[FIX1] ''' and  '''[PATCH1] ''' , validate the input with '''[OK]''', then press '''[RUN]''' in the GUI '''series'''. A question box appears to warn about the existence of the result file, answer '''[OK]''' to refresh it with the new data. This will produce an interpolated velocity field and their spatial derivatives in the same netcdf file.  After this operation vorticity can be visualized in the GUI  '''uvmat''', selecting the option 'vort'''' ''' in the popup  menu '''[FieldName]'''. 
    5048
    5149== Superposing image and vectors ==
    52 It can be useful to visually superpose the images to the velocity field. This is done  by selecting the option 'image' in the popup menu '''[Fields_1]''', located just under the popup menu '''[Fields] ''' in the upper frame '''[Input]'''.  To remove the image, select the blank option in '''[Fields_1]''' .
     50It can be useful to visually superpose the images to the velocity field. This is done  by selecting the option 'vec(U,V)'  in the popup menu '''[FieldName] '''and  'image' in the popup menu '''[FieldName_1]''', located just below''' ''' in the upper frame '''[Input]'''.  To remove the image, select the blank option in '''[FieldName_1]''' .
    5351
    54 Similarly, the velocity vectors can be superposed to the vorticity field, selecting '''[vort] ''' in '''[Fields_1]''' instead of '''[image '''.
     52Similarly, the velocity vectors can be superposed to the vorticity field, selecting 'vort'''' ''' in '''[FieldName_1]''' instead of 'image'''''''.
    5553
    5654= From pixel displacement to velocity =
    57 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/GeometricCalibration geometric calibration]. The result of calibration is stored in an xml file.
     55So far all PIV results have been expressed as image displacement expressed in pixels. Conversion to velocity requires timing information and geometric calibration, as described in [wiki:Tutorial/GeometricCalibration geometric calibration]. Both pieces of information must be stored in an xml file named'' 'images.xml''' in the same folder as the folder '''images''' containing the images.
    5856
    59 The 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:
     57First introduce the time interval, Dt=0.02 s, by creating a text file with the following content, using any text editor (with output in plain text), and save it with name '' 'images.xml''' (in Windows system, be carefull to avoid any additional hidden extension).
     58
    6059{{{
    6160<ImaDoc>
     
    6362           <TimeUnit>s</TimeUnit>
    6463           <BurstTiming>
     64                   <Time>0</Time>
    6565                   <Dti>0.02</Dti>
    6666                   <NbDti>1</NbDti>
     
    6969</ImaDoc>
    7070}}}
    71 This input is preferably introduced automatically by the computer which controls the camera, or for videos, directly encoded in the movie file.
     71Then open the image with uvmat. The label 'xml' should appear in the upper right box [[wiki:TimeName !TimeName]] and time value beside it in [[https://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/search?q=wiki%3ATimeName !TimeValue]]. 
    7272
    73 When 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’.
     73Now repeat the PIV operation to include the time information in the result (in the absence of time information the file index is taken as default value).
     74
     75To introduce  the geometric calibration, use the method described in [https://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/search?q=wiki%3ATutorial%2FGeometricCalibration geometric calibration]. 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 instead of ’phys’.
    7476
    7577Note 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.
    76 
    7778
    7879= The main PIV parameters =
     
    8586The 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.
    8687
    87 The 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.
    88 Let us run again PIV with Search x,y=(31,31). Many black vectors are obtained...
     88The 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. Let us run again PIV with Search x,y=(31,31). Many black vectors are obtained...
    8989
    9090= Masks =
     
    100100
    101101= Refined PIV =
    102 
    103102To improve the results, come back to the GUI '''CIV''', and follow these successive steps, corresponding to a sequence of operations.
    104103
     
    117116The 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.
    118117
    119 The 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).
     118The parameters of a CIV computation are stored in a xml file with extension ..[wiki: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).
    120119
    121120The 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.
     
    123122The 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.
    124123
    125 [[Image(vort_civ3-2.jpg)]]
    126 [[Image(vort_vel_zoom.jpg)]]
     124[[Image(vort_civ3-2.jpg)]] [[Image(vort_vel_zoom.jpg)]]
    127125
    128126== Fix and patch ==
    129 
    130127== Civ2 ==
    131 
    132128== Civ3 ==
    133