Changes between Version 24 and Version 25 of Tutorial/ParticleImageVelocimetry
- Timestamp:
- Jan 20, 2015, 11:48:13 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Tutorial/ParticleImageVelocimetry
v24 v25 1 1 [[TracNav(Tutorial/TOC)]] 2 2 3 = [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/). 4 Open again the first example of image pair in UVMAT_DEMO01_pair. (accessible on http://servforge.legi.grenoble-inp.fr/pub/soft-uvmat/). 6 5 7 6 = Starting PIV = 8 9 7 == Visual check == 10 8 Particle 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. … … 15 13 The 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. 16 14 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'''.15 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''', 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. 18 16 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'''.17 The 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'''. 20 18 21 19 [[Image(Civ_1.JPG)]] 22 20 23 21 = Monitoring PIV results = 24 25 22 == 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.23 In '''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. 27 24 28 25 The 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] '''. … … 30 27 The 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'''). 31 28 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.29 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 calculation problems, see below. 33 30 34 31 == 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])32 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]) 36 33 37 34 == 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'''.35 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 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'''. 39 36 40 37 == 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 code s values between the valuies set by '''[!MinVec] ''' and '''[!MaxVec].'''38 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 code extrema are set by '''[num_!MinVec] ''' and '''[num_MaxVec]''', choose for instance 0 and 5 respectively.'''''' 42 39 43 40 == Derived fields == 41 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. 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. 44 42 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. 43 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. 46 44 47 45 [[Image(contours.JPG)]] 48 46 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).47 To 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]'''. 50 48 51 49 == 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]''' .50 It 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]''' . 53 51 54 Similarly, the velocity vectors can be superposed to the vorticity field, selecting ' ''[vort] ''' in '''[Fields_1]''' instead of '''[image'''.52 Similarly, the velocity vectors can be superposed to the vorticity field, selecting 'vort'''' ''' in '''[FieldName_1]''' instead of 'image'''''''. 55 53 56 54 = 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.55 So 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. 58 56 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: 57 First 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 60 59 {{{ 61 60 <ImaDoc> … … 63 62 <TimeUnit>s</TimeUnit> 64 63 <BurstTiming> 64 <Time>0</Time> 65 65 <Dti>0.02</Dti> 66 66 <NbDti>1</NbDti> … … 69 69 </ImaDoc> 70 70 }}} 71 Th is input is preferably introduced automatically by the computer which controls the camera, or for videos, directly encoded in the movie file.71 Then 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]]. 72 72 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’. 73 Now 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 75 To 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’. 74 76 75 77 Note 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 77 78 78 79 = The main PIV parameters = … … 85 86 The 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. 86 87 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... 88 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. Let us run again PIV with Search x,y=(31,31). Many black vectors are obtained... 89 89 90 90 = Masks = … … 100 100 101 101 = Refined PIV = 102 103 102 To improve the results, come back to the GUI '''CIV''', and follow these successive steps, corresponding to a sequence of operations. 104 103 … … 117 116 The 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. 118 117 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).118 The 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). 120 119 121 120 The 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. … … 123 122 The 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. 124 123 125 [[Image(vort_civ3-2.jpg)]] 126 [[Image(vort_vel_zoom.jpg)]] 124 [[Image(vort_civ3-2.jpg)]] [[Image(vort_vel_zoom.jpg)]] 127 125 128 126 == Fix and patch == 129 130 127 == Civ2 == 131 132 128 == Civ3 == 133