fudaa-lspiv version 1.7.3 user manual - inrae · fudaa-lspiv version 1.7.3 user manual authors :...

64
Fudaa-LSPIV Version 1.7.3 User Manual Authors : Magali Jodeau, Alexandre Hauet, Jérôme Le Coz, Jean-Baptiste Faure, Guillaume Bodart Document Version 04/01/2020

Upload: others

Post on 19-Feb-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

  • Fudaa-LSPIV Version 1.7.3 User Manual

    Authors : Magali Jodeau, Alexandre Hauet, Jérôme Le Coz, Jean-Baptiste Faure, Guillaume Bodart

    Document Version 04/01/2020

  • Table of contents 1. General ............................................................................................................................................ 1

    Why the LSPIV?.................................................................................................................................... 1

    Principles of the LSPIV ......................................................................................................................... 1

    Free software Fudaa-LSPIV .................................................................................................................. 2

    2. Start with Fudaa-LSPIV .................................................................................................................... 3

    Fudaa-LSPIV Software Installation ...................................................................................................... 3

    Languages ............................................................................................................................................ 3

    Architecture of the main window ....................................................................................................... 4

    3. Start a Fudaa-LSPIV study ................................................................................................................ 5

    Prerequisites for starting a Fudaa-LSPIV study ................................................................................... 5

    Create a new study .............................................................................................................................. 5

    Open an existing study ........................................................................................................................ 5

    Architecture of a Fudaa-LSPIV project ................................................................................................ 6

    4. Management of source images ....................................................................................................... 7

    Import an image sequence .................................................................................................................. 7

    Import a video and sequence it ........................................................................................................... 9

    Stabilize an image sequence ............................................................................................................. 12

    5. Transformation of the images ....................................................................................................... 17

    Selection of the orthorectification mode .......................................................................................... 17

    Scaling ................................................................................................................................................ 17

    Defining the resolution .................................................................................................................. 18

    Change of real coordinate reference ............................................................................................ 19

    Definition of the orthoimage corners and water level .................................................................. 20

    Complete orthorectification .............................................................................................................. 20

    Principle of orthorectification ....................................................................................................... 20

    Positioning of reference points ..................................................................................................... 21

    Verification of the GRP .................................................................................................................. 22

    Transformation parameters .......................................................................................................... 22

    Transformation of all the images ...................................................................................................... 23

    6. Calculation of the tracers velocities .............................................................................................. 24

    Principles ........................................................................................................................................... 24

    Parameters of displacement calculation ........................................................................................... 24

    Calculation grid .................................................................................................................................. 26

    Calculation of the movement velocities of the tracers ..................................................................... 27

    7. Postprocessing of calculated velocities ......................................................................................... 29

  • Filtering instant results ...................................................................................................................... 29

    Averaging the results ......................................................................................................................... 30

    8. Viewing velocity results ................................................................................................................. 31

    Description of result layers for velocity calculations ........................................................................ 31

    Layer Res. vel. .................................................................................................................................... 31

    9. Calculation of the discharge .......................................................................................................... 34

    Fill in the bathymetry of one or more transects ............................................................................... 34

    Transects parameters ........................................................................................................................ 35

    Discharge calculation ......................................................................................................................... 36

    Export the gauging report ................................................................................................................. 38

    10. Exporting data ........................................................................................................................... 42

    11. Redo the calculations of an existing study ................................................................................ 43

    12. Known bug and solutions .......................................................................................................... 44

    The gauging report is not created ..................................................................................................... 44

    13. Insights ...................................................................................................................................... 45

    Principle of image stabilization ......................................................................................................... 45

    Key points extraction ..................................................................................................................... 45

    Points matching ............................................................................................................................. 46

    Estimation of the transformation .................................................................................................. 47

    Image transformation.................................................................................................................... 47

    Principle of orthorectification ........................................................................................................... 48

    14. Approfondissements ................................................................................................................. 50

    Principe de l’orthorectification ......................................................................................................... 50

    Le modèle sténopé et sa résolution : cas général 3D .................................................................... 50

    Le modèle sténopé et sa résolution : cas particulier 2D ............................................................... 51

    Création des orthoimages ............................................................................................................. 51

    Principes de la mesure de la vitesse de déplacement des traceurs .................................................. 53

    Principles of discharge calculation ................................................................................................ 56

    Principes du calcul de débit ............................................................................................................... 57

    Définition et interpolation du profil bathymétrique ..................................................................... 57

    Estimation de la vitesse moyenne en chaque point du transect .................................................. 58

    Calcul du débit à travers chaque transect ..................................................................................... 59

    15. References ................................................................................................................................. 60

  • 1

    1. General

    Why the LSPIV? The scientist studying rivers under aspects of liquid flow or sediment flow often encounters a mismatch

    between available hydrometric measurements and needs. These needs have evolved, in parallel with

    the development of numerical modeling, towards a demand for spatialised data, with a high temporal

    frequency, and for various flow conditions. In particular, the measurement of velocity and streamflow

    during floods is often impossible with traditional gauging techniques (current meters, aDcp, tracer

    dilution), when high velocities and numerous floating debris endanger operators and equipment. In

    addition, the measurement time inherent to these techniques is often inadequate with the unsteady

    nature of the flood flows. The development of 2D or 3D modeling tools for the understanding of flows,

    in the natural environment and in the laboratory physical model, requires, for validation, other

    measurements in addition to water levels or flow rates. The spatialised velocity results of these models

    require a corresponding hydrometric measurement, that is to say a velocity field. Again, traditional

    velocity measurement techniques do not fully meet these needs.

    Hydrometry by image sequence analysis is an interesting alternative that allows access to the

    measurement of instantaneous surface velocities on surfaces up to the hectare, in a non-intrusive way.

    The technique is called Large Scale Particle Image Velocimetry (LSPIV). For a detailed description of the

    method, one can refer for example to the thesis of A. Hauet (2006).

    Principles of the LSPIV The analysis of image sequences makes it possible to measure the 2D field of velocity on the surface

    of a flow provided that visible tracers, such as solid particles (plant debris, small floats, etc.), bubbles

    or turbulence patterns are advected with the flow, while remaining recognizable from one image to

    another. This technique is derived from the Particle Image Velocimetry (PIV) used in the laboratory,

    but for a study on large river-scale objects, hence the name Large-Scale PIV (LSPIV, Fujita et al., 1998).

    An LSPIV measure comprises (i) recording a sequence of timestamped images of the flow, (ii) a

    geometric correction of the images to overcome perspective distortion effects (orthorectification) and

    (iii) a calculation displacement of the tracers of the flow through a statistical correlation of the reasons.

    In practice, the seeding of the flow by adding tracers is often not necessary for flooded rivers: if the

    movement of the water is visible in a sequence of images, in general it will be possible to extract the

    velocities. This gives a "nearly instantaneous" 2D field (at the sampling frequency of the image pairs,

    limited by the acquisition frequency of the camera and the amplitude of the movements). Knowing the

    bathymetry of a cross section and assuming a model of vertical velocity distribution, one can arrive at

    the estimation of the flow rate from the LSPIV velocity field.

    The LSPIV has been used to estimate river flows of very different scales, from low to high floods (see,

    for example, Creutin et al., 2003, Hauet et al., 2008 or Jodeau et al., 2008) and for improvement.

    calibration curves in normal hydraulic regimes (Le Coz et al., 2010 or Dramais et al., 2011). The LSPIV

    has also been applied to flood films shared by the public on the internet (Le Boursicaud et al 2016, Le

    Coz et al 2016). A review of LSPIV applications for streamflow estimation has been proposed by Muste

    et al. (2008). LSPIV has also been used to study the dynamics of complex flows (Le Coz et al 2010b,

    Hauet et al., 2009) as well as debris flows (Theule et al., 2018) and physical models of mobile bottom

    laboratories (Piton et al., 2018). The LSPIV has also proved to be an effective tool for the study of runoff

  • 2

    runoff (North et al., 2009, Legout et al 2012) where intrusive instruments can not be used because of

    the very weak tie rods. water considered (millimeters).

    Free software Fudaa-LSPIV Fudaa-LSPIV is a software for processing flow image sequences to calculate surface velocity fields and

    flow rates across cross sections. The method is based on the Large-Scale Particle Image Velocimetry

    (LSPIV) technique, with the following main steps:

    • Source images: import a sequence of images or sampled images from a video clip

    • Orthorectification: Correct images from perspective distortion and assign a metric size to pixels

    • PIV analysis: calculate surface velocities from statistical analysis of tracer movement

    • Post-processing: apply filters to the velocity results, calculate the time average, calculate the

    streamlines

    • Discharge: calculate discharge through a bathymetric transect using a velocity correction

    coefficient

    The Fudaa-LSPIV software is a Java interface that calls Fortran executables. The development of

    Fudaa-LSPIV has been executed by DeltaCAD since August 2010 with financing and under the direction

    of EDF and Irstea. This development is part of the Fudaa free software project for hydraulic

    applications. The supported languages are French and English and the software can be used with

    Windows or Linux operating systems. The conditions of diffusion are those of free GPL licenses, and

    the software is the intellectual property of EDF and Irstea.

  • 3

    2. Start with Fudaa-LSPIV

    Fudaa-LSPIV Software Installation

    The Fudaa-LSPIV software installation file is available in the following software development forge:

    https://forge.irstea.fr/projects/fudaa-lspiv/

    Unzip the contents of the archive.zip file beforehand. The installation file is a java .jar file named fudaa-

    lspiv-xxx-setup.jar, where xxx is the version number. The setup and executables are specific to the

    target OS (Windows, Linux, 32/64 bits). Start the installer (double-click) and follow the procedure. The

    software installs in the chosen directory, with the following architecture:

    bin folder: contains the executable fudaa-lspiv.bat, which is used to launch the application;

    doc folder: Contains this User Guide;

    examples folder: contains an example of a Fudaa-LSPIV project;

    exes folder: contains the Fortran executables called for the LSPIV analysis steps;

    icons folder: contains the icons;

    lib folder: contains the Java libraries required for the Fudaa-LSPIV application;

    templates folder: contains the Excel template for the Streamgauging report export;

    uninstaller folder: contains the uninstall executable.

    Languages The default language of the Fudaa-LSPIV software is French or English depending on the choice made

    during the installation. It is possible to switch to English thanks to the Edit Preferences menu. In

    the Accessibility Language tab choose english [en], then restart the software.

    https://forge.irstea.fr/projects/fudaa-lspiv/

  • 4

    Architecture of the main window The Fudaa-LSPIV software consists of 5 panels as described in the figure below:

    • The menus (panel 1 in the figure) to access the creation or opening of files, or the launch of

    LSPIV treatments.

    • The quick access bar (panel 2 in the figure) allowing shortcuts to the main functions of the

    menus.

    • The graphical toolbar (panel 3 in the figure) allowing selections and modifications on the

    graphic display of the views.

    • The layers (panel 4 in the figure) showing the different layers available and allowing them to

    be selected or deselected.

    • The graphic display of the views (panel 5 in the figure) allowing to visualize the source or

    orthorectified images as well as the results of the calculations.

    Important!

    Fudaa-LSPIV works on a logic of layers (like a GIS software for example): to work on a data, an image

    or a result or to modify the display of a data, an image or a result , you must first select the layer

    considered.

  • 5

    3. Start a Fudaa-LSPIV study

    Prerequisites for starting a Fudaa-LSPIV study Before starting a Fudaa-LSPIV study, you must have the necessary input data:

    • Images of a flow, in the form of a video or sequence of images (all images in the sequence

    must be spaced by the same time interval, and this time interval must be known precisely).

    The taking of images must be done without movement. If spurious movements affect the

    images, it will be useful to align the images using the Stabilization step.

    • When acquiring the films, care must be taken with regard to the possible reflections, the good

    visibility of the tracers and the good distribution of the tracers in the image. When the flow

    does not have patterns naturally, clearly visible tracers can be added. However, it must be

    ensured that they move well at the velocity of flow.

    • A geometric description of the image area, such as visible reference points on the images and

    known real coordinates, or scaling elements, to drive orthorectification.

    • For discharge measurement applications, reference may be made to the imaging requirements

    made during the FloodScale project or by the USGS.

    Create a new study

    To create a new study, click on the Create icon in the quick access bar.

    Otherwise, follow the File Create menu. The corresponding keyboard shortcut is Ctrl + N

    Open an existing study

    To open an existing study, click the Open icon in the quick access bar.

    Otherwise, follow the File Open menu. The corresponding keyboard shortcut is Ctrl + O. The File

    Reopen menu allows you to search for one of the last saved studies.

  • 6

    Architecture of a Fudaa-LSPIV project

    Fudaa-LSPIV projects are saved by the File Save menu as an extension file .lspiv.zip. The

    architecture of a Fudaa-LSPIV project is composed of:

    • img_pgm folder: contains source images in .pgm format used for processing;

    • img_transf folder: contains a cache folder of orthorectified images in .gif format, less large in

    size (optimization of the display); orthorectified images in .pgm format are not saved (.pgm

    files are empty).

    • outputs.dir folder: contains the calculation files and LSPIV parameters;

    • transects file: contains the projected and interpolated bathymetric transects data;

    • vel_filter folder: contains the results files of the filtered instantaneous LSPIV velocities, in

    image coordinates;

    • vel_raw folder: contains raw instantaneous LSPIV velocity results files, in image coordinates;

    • vel_real folder: contains the results files of the filtered instantaneous LSPIV velocities, in real

    coordinates;

    • vel_scal folder: contains the scalar result files (velocity norm, correlation) computed from

    filtered instantaneous LSPIV velocities, in real coordinates.

  • 7

    4. Management of source images

    The calculations performed in Fudaa-LSPIV are performed on consecutive image sequences with a

    known and fixed time interval. The user can:

    - Import an image sequence

    - Import a video and sequence it in Fudaa-LSPIV

    Import an image sequence The Images Source Image Management menu opens the image management window. The Add

    button launches an explorer to select the sequence of images to be analyzed. All standard

    image formats are managed (png, tif, pgm, jpg, tiff, jpeg, gif, bmp ...). The selected images appear in

    the image management window.

    The Add button allows you to add new images of the same sequence. The Remove

    button allows you to remove one or more selected images. The Up and Down

    buttons change the order of the images in the sequence.

    The user here specifies either the time interval between two images or the number of frames per

    second.

    Once the selection is validated, the images are displayed in the Source Image Space.

  • 8

    The source images can be viewed with the scroll list:

    Among the images thus imported, some may be used only for the orthorectification step (check the

    background box) or only for the velocity calculation.

  • 9

    Import a video and sequence it

    The Images Import images from video menu opens the window for importing videos:

    The button launches an explorer to select the video to be sequenced. All the standard video

    formats are managed (avi, mov, mpeg ...). A preview of the video is displayed, which allows to optimize

    the image sampling parameters. The current image in the preview can be selected using the cursor.

    The rank of the current image out of the total number of images in the video is displayed along with

    basic information on the the video: duration, framerate and corresponding time interval in seconds.

  • 10

    In the Sampling area, enter the sequencing parameters of the video:

    - The image sampling rate: keep 1 image every N images

    - Or the time interval between two images. This number must be greater than the initial time

    interval.

    - If the entire video is not to be analyzed, enter the start and end times of the sequence of

    interest, in seconds. The start and end times can be made equal to the time of the current

    image in the preview by pushing the button.

    The button pops up a tooltip providing recommendations on the image sampling parameters.

    By pushing Validate, we start the sequencing. The .png image sequence can be displayed in the image

    management window.

  • 11

    The Add button allows you to add new images of the same sequence. The Remove

    button allows you to remove one or more selected images. The Up and Down

    buttons change the order of the images in the sequence.

    The button pops up a tooltip providing recommendations on the image sampling parameters.

    Once the selection is validated, the images are displayed in the Source Image Space.

    The source images can be viewed with the scroll list:

  • 12

    Among the images thus imported, some may be used only for the orthorectification step (check the

    background box) or only for the velocity calculation.

    Stabilize an image sequence The Images Images Stabilization Parameters menu gives access to a source image stabilization

    module, which eliminates the effects of possible camera movement. For more technical details on

    the algorithm and its parameters, see Section 12. Insights.

    In this panel, the Activate the stabilization module checkbox activates or deactivates the

    stabilization of source images.

  • 13

    It is then necessary to delimit the footprint of the flow area by clicking on the Interactive input

    button and by entering the positions of the vertices of a polygon on a source image. This flow area

    corresponds to moving patterns that should not be used as points of interest by the stabilization

    algorithm. A Flow area layer is added in the 2D view Source image space.

    By default, the density of the points of interest is Average and the transformation model is Similarity.

    Two models are proposed: Similarity and Perspective. Selection depends on the shakiness intensity of

    the camera and on the “quality” of the river banks.

  • 14

    Weak shakiness (10 pixels) : Perspective model preferred

    By “quality” of the river banks we mainly denote their texture and contrast. A highly textured and

    contrasted environment with a lot of edges/corners will be considered as a good one, as per our

    definition of “quality”. A smooth concrete slab without bumps will have a bad “quality” whereas banks

    composed of vegetation + stones + trees + shadows will have a very good “quality”.

    Poor “quality”: Select High density of points

    Good “quality”: Select Low density of points

    The banks/flow ratio is an important parameter to consider. The example shown above is an ideal case

    study: the river flow occupies a third of the image. The area covered by the river banks is then large

    enough. Moreover the environment is highly textured and shows lots of edges. In such a case a Low

    density could be used.

    To ensure a good stabilization river banks should cover at least a quarter of the image on each side of

    the flow (so 50% flow and 50% banks overall).

    It isn’t recommended to use a Low density of points with the Perspective transformation model. Errors

    may occur since it is more sensitive to lack of points.

    You must then Validate or Cancel the settings thus defined. The Apply button is useless here.

    The Images Stabilize the images command starts the calculation of the stabilized images, which

    will then be used for orthorectification (see next section).

    The stabilized images can be viewed one by one in 2D View Source Image Space by first clicking on

    the "Shaky Hand" icon .

  • 15

    The File Export Export Stabilized Images command allows you to export the stabilized images.

  • 16

  • 17

    5. Transformation of the images

    Selection of the orthorectification mode Fudaa-LSPIV offers two modes of orthorectification:

    - Scaling: when images are not distorted by perspective effects (vertical viewpoint with no lens

    distortion), a simple scaling in metres per pixel can be sufficient;

    - Complete Orthorectification: when images are distorted by perspective effects, a complete

    orthorectification based on reference points must be done.

    These modes can be accessed via the Orthorectification → Orthorectification Mode menu.

    These two modes of image transformation allow for a 2D or 3D orthorectification, or a simple scaling

    of the pixels of the image. These three types of transformation and their requirements are summarised

    in the following diagram and described in the following sections.

    Scaling When the point of view of the camera is vertical (seen from the sky), we can often neglect the

    perspective effects, at least in the centre of the image. Orthorectification of the images is not

    necessary. Scaling simply consists of specifying the physical size of a pixel.

    The Orthorectification Scaling Parameters menu brings up the window for setting the scaling

    parameters:

  • 18

    Defining the resolution In the Resolution tab, three methods are proposed to specify the resolution of the images (the physical

    size of the pixels in metres):

    Direct input of the resolution if it is known: enter the resolution in m/pix in the dedicated box.

    Entering pairs of points defining segments of known size: click on the positions of the ends of

    the first segment in the image; the image coordinates (I1, J1) and (I2, J2) of the two points then

    appear in the array; indicate opposite the length of the segment (distance between the two

    points) in metres; the corresponding resolution is calculated. You can re-iterate the operation

    for as many segments of known size. The average of the resolutions thus calculated is displayed

    and will be the one used for the image transformation.

    Alternatively, the real-world coordinates of the ends of the segments can be filled in, instead

    of the lengths of the segments. Select Coordinates instead of Distance from the drop-down

    menu.

  • 19

    Change of real coordinate reference The Transformation tab is used to define the translation/rotation parameters that can be applied to

    the actual orthoimage reference. This is particularly useful if the velocity field is to be compared to

    other data, or if a bathymetric transect measured in this particular reference is then used for the

    calculation of the discharge.

    By default, the option "no translation/rotation" is selected and no reference change will be applied.

    The lower left corner of the image is the origin of coordinates (0,0) and the X and Y axes are the

    horizontal and vertical axes of the original image.

    Otherwise, it is possible to define the change of reference to be applied by entering the real

    coordinates (X1,Y1) and (X2,Y2) of two points previously positioned (by clicking) in the image: their

    image coordinates (I1,J1) and (I2,J2) are displayed in the table.

  • 20

    Definition of the orthoimage corners and water level The Others tab allows you to define the coordinates of the corners of the orthoimage: it is simply a

    sub-selection (crop) of the original image. The proposed Default values are the positions of the left-

    bottom and top-right corners of the total image, calculated by multiplying the image dimensions (in

    pixels) by the previously calculated resolution (in m/pix). This amounts to keeping all the original

    images for the transformation.

    It is also possible to enter in this Others tab the water level (in m) that will not be used for the

    transformation of the images or for the calculation of velocities but will be used for the calculation of

    discharge.

    The Apply button runs the transformation of the first image using the specified parameters, in order

    to get an idea of the result. The Validate button saves the scaling parameters, displays the first

    transformed image and allows you to proceed to the next step (Transform all images).

    Complete orthorectification

    Principle of orthorectification Orthorectification consists of creating a corrected image of the perspective and scaling effects of the

    real world for a given plane. Full details on the Principles of Orthorectification page.

  • 21

    Positioning of reference points Two methods are possible for positioning reference points:

    • The Orthorectification Orthorectification Reference Points New ones menu brings

    you to the GUI for positioning reference points. Enter the terrain coordinates (real X, real Y

    and real Z) of the first point, then click on the pixel of the image locating the GRP, the image

    coordinates I and J are then filled. It is possible to zoom to better see a point. Repeat the

    operation for all reference points (at least 4 for 2D orthorectification, at least 6 for 3D

    orthorectification, see the orthorectification principles for more details). The Input finished

    button closes the operation and creates a file in the project architecture outputs.dir\GRP.dat.

    The Orthorectification Orthorectification Reference points Import menu allows you

    to load a GRP.dat file. This file must be a text file, with the following format:

    o The first line contains only the text “GRP”

    o The second line is an integer specifying the number of reference points used

    o The third line contains the titles of the data: X Y Z i j; let X, Y, Z be the field coordinates

    of the points and i, j the image coordinates of the points.

    o The following lines are the data.

    It is important to note that the reference points must be entered in metric units (this defines the units

    for further processing).

  • 22

    Verification of the GRP The Orthorectification Orthorectification Verification of the reference points menu makes it

    possible to ensure the quality of the correspondence of the GRP field and image coordinates. The

    orthorectification matrix (see Principles of orthorectification) is calculated, and the land position (X, Y

    and Z) of the landmarks is calculated from their image coordinates (I and J). The true terrain

    coordinates and the calculated terrain coordinates are then compared. The distance between these

    true and calculated coordinates, called Gaps, is presented in a table and graphically.

    Transformation parameters There are two methods for entering transformation parameters:

    The Orthorectification Orthorectification Transformation Parameters Define menu

    opens the Transformation Parameters management window. The study area is defined by a

    rectangle whose position of the corners in the real coordinate system (Xmin, Xmax, Ymin,

    Ymax) is indicated. This framework makes it possible to reduce the orthorectification to the

    area of interest and thus limit the calculation times. The resolution, in meters per pixel,

    corresponds to the size of a pixel in the orthorectified image. The resolution must be adjusted

    so that the details of the plotters remain visible in the orthoimage, without generating

    orthoimages of too large sizes (the orthoimage must have approximately the same dimensions

    as the raw image). The button is used to automatically enter the Xmin,

    Xmax, Ymin, Ymax and Resolution fields. Finally, the Water Level, in the real reference, must

    be filled in. The orthoimage will only be valid for this height (see the principles for creating

    orthoimages). Clicking Apply will produce an orthorectified image. Adjust the setting as

    necessary, then Validate. The transformation parameters are stored in the

    outputs.dir\img_ref.dat file.

  • 23

    The Orthorectification Orthorectification Transformation parameters Import menu

    allows you to load the orthorectification parameters of an existing study using an img_ref.dat

    file. This file has the following format:

    Transformation of all the images The Orthorectification Transform images menu starts the orthorectification of all selected images.

    Orthorectified images are stored in the img_transf folder.

    The cache folder contains the same .gif images, which are smaller in size.

    The creation of these images can take time, especially if a large number of high-resolution images need

    to be transformed. As an option, it is possible to disable the creation of cache images, except the first

    in the series, via the Edit Preferences General Calculation menu. Only the first image will then

    be available in the 2D Views Real Space and Transformed Image Space.

  • 24

    6. Calculation of the tracers velocities

    Principles LSPIV uses a cross correlation statistical method on orthorectified images to determine the

    displacement of tracers visible on the surface. The principles are detailed on the Principles of tracer

    velocity measurement.

    Parameters of displacement calculation Two methods are possible to define the parameters of the tracer displacement calculation:

    The LSPIV Analysis Calculation parameters Define menu launches the interface for the

    tracer motion Calculation Parameters. Several parameters are to be entered:

    o the Interrogation Area (IA) size, in meters or in pixels (linked units), see the Principles

    of tracer velocity measurement for details. This area must be large enough to

    incorporate tracers, but small enough to be representative of the flow (velocity

    gradients in an AI must be negligible). As a good practice, it should be noted that the

    IA must have a metric size in adequacy with the size of the tracers to follow and the

    scale characteristic of the measured flow, while keeping a sufficiently small size to

    allow a calculation in a reasonable time . A size of about 30 pixels is preferred (the size

    must be an even number). The Apply button allows a graphic display of the size of the

    IA on an orthorectified image. The user can choose the location of the center of the

  • 25

    window by entering their coordinates in Center position or by clicking on a pixel in the

    image after activating the Position button.

    o the Search Area (SA) size in meters or pixels (linked units), see the Principles of Tracer

    Velocity Measurement page for more details. The search area is a rectangle defined

    around the center of the interrogation area. It corresponds to the zone in which the

    patterns are searched on the successive images. When the flow has a preferred

    direction, the search area can be extended in this direction. The SA is defined by 4

    parameters, Sim, Sip, Sjm and Sjp. The Apply button allows a graphical visualization of

    the size of the SA on an orthorectified image.

    o The parameters of the calculation of the tracer movements are stored in the file

    outputs.dir\PIV_param.dat after the validation.

    o The button pops up a tooltip providing recommendations on the velocity

    calculation parameters.

    • The LSPIV Analysis Calculation Parameters Import menu allows you to load the calculation

    parameters of the displacements of an existing study thanks to a file PIV_param.dat. This file has the

    following format:

  • 26

    Calculation grid The calculation grid represents all the points for which a velocity will be calculated, see the Principles

    of tracer velocity measurement for more details. Two methods are possible to define the calculation

    grid:

    The LSPIV Analysis Grid points Define menu launches the interface for the Grid outline.

    The outline of the grid is a quadrilateral defined by its four corners thanks to clicks on the

    orthoimage. The density of the grid is defined by a spacing pitch on the opposite segments of

    the quadrilateral. The Apply button allows a graphical display of the grid on the orthoimage.

    The calculation grid is stored in the outputs.dir\grid.dat file and the grid parameters are stored

    in the outputs.dir\grid_param.dat file during validation.

  • 27

    The LSPIV Analysis Grid Points Import menu allows you to load a grid from an existing

    study using a grid.dat file. This text file is a list of the I, J coordinates of all the grid nodes in

    the orthoimage frame.

    Calculation of the movement velocities of the tracers The LSPIV analysis Calculation of instantaneous results menu launches the statistical analysis of

    plotter displacements for all image pairs in the sequence. See the Principles of Measuring Tracer

    Movement Velocity for more details. An "instantaneous" velocity field (at the step of the time interval

    between two images) is obtained for all consecutive image pairs. Thus, for N selected images, we

    obtain N-1 velocity fields, stored in the vel_raw folder.

    The layer group Raw inst. surf. vel. (for raw instantaneous surface velocities) is created.

  • 28

    It allows to visualize the calculated velocities for the image pairs in the form of a vector field (Raw inst.

    res. vel.), streamlines (Raw inst. res. part., see how to compute it here) or isocontours (Raw inst. res.

    iso.). More details on the visualization and setting of velocity layers here. The graphical interface makes

    it possible to link the visualization of the images and velocities calculated thanks to the

    button to Link/Unlink the images and the velocities.

  • 29

    7. Postprocessing of calculated velocities

    The post-processing step includes filtering and averaging the velocity results.

    Filtering instant results The Post-Processing Instantaneous results filtering menu launches the filtering interface. Two tabs

    are available:

    The Velocity tab allows you to filter on standard values or Vx or Vy components. To use this

    filter, select the Filter velocities check box and enter the minimum and maximum values for

    the different filters. By default, the minimum velocity threshold is set to a value corresponding

    to 2 pixels of displacement.

    The Correlation tab allows the calculated velocities to be kept within a certain range of

    correlation values, see the Tracer Motion Velocity Measurement Principles page for more

    details. To use this filter, select the Filter correlations check box and enter the minimum and

    maximum values for the correlation range for which the velocities are to be maintained. The

    minimum value depends on the quality of the tracers and their temporal conservation. For

    non-deformable tracers (hard objects, artificial tracers) high correlations (of the order of 0.7)

    may be required. For deforming tracers (turbulence figures, foam), we will ask for a lower

    minimum threshold (of the order of 0.4. By fixing a maximum bound at 0.98, we will avoid

    artifices if the calculation grid overflows the flow and encroaches on static areas (bank, edge

    image). The default correlation thresholds are set as 0.4 (min) and 0.98 (max).

    Filtered instant velocity fields are stored in the vel_filter folder. The layer group Filtered inst. surf. vel.

    (for filtered instantaneous surface velocities) is created.

  • 30

    It makes it possible to visualize the calculated velocities for the image pairs in the form of a vector field

    (Filt. inst. res. vel.), Of lines of current (Filt. inst. res. part., see how to calculate it here (see how to

    calculate it here) or isocontours (Filt. inst. res. iso.) More details on the visualization and the

    parameterization of the velocity layers here. The graphical interface makes it possible to link the

    visualization of the images and velocities calculated thanks to the

    button to Link/Unlink the images and the velocities.

    Averaging the results The Post-Processing Filtered average instantaneous results menu launches the average field

    calculation interface.

    We select the filtered velocity fields to be averaged (a priori, all the filtered results are selected) and

    the validation button is used to calculate the averaged velocity field on all the image pairs of the

    sequence.

    The averaged velocity field is stored in the file outputs.dir/average_vel.out. The layer group Average

    surf. vel. (for averaged surface velocities) is created.

    It makes it possible to visualize the calculated velocities for the image pairs in the form of a vector field

    (Average res. vel.), Of lines of current (Average res. part., see how to calculate it here (see how to

    calculate it here) or isocontours (Average res. iso.) More details on the visualization and the

    parameterization of the velocity layers here. The graphical interface makes it possible to link the

    visualization of the images and velocities calculated thanks to the

    button to Link/Unlink the images and the velocities.

  • 31

    8. Viewing velocity results

    Description of result layers for velocity calculations During each velocity calculation stage (instantaneous, filtered and averaged velocities), a specific layer

    group is created. This group systematically includes 3 types of layers:

    • Res. vel. layers

    • Res. part layers

    • Res. iso layers

    Layer Res. vel. This layer allows the visualization of results as vectors, as shown below.

  • 32

    The following display options are available through the graph toolbar (be sure to select the layer on

    which the display options wish to be applied):

    • Configuration opens the configuration window. This allows

  • 33

  • 34

    9. Calculation of the discharge

    Fudaa-LSPIV can calculate a discharge from averaged velocities if one or more known bathymetry

    transects are filled in, see the Principles of Discharge Calculation page for more details.

    Fill in the bathymetry of one or more transects Two methods are possible to fill one or several bathymetries of transects:

    The Discharge Transect New menu launches the interface to define a bathymetric

    profile. A profile is indicated on a straight line, preferably perpendicular to the discharge. First,

    enter the Z coordinate in the real coordinate system of the edge on the left bank of the

    transect, then click on the corresponding point in the orthorectified image. Repeat for all

    points of the bathymetric transect. The first two points indicated define the orientation of the

    bathymetric profile. The bathymetric profiles are stored in outputs.dir/bathy_p.dat. The

    single velocity coefficient defaults to 0.85 and applies to all points in the transect. By

    unchecking the Velocity single coef. box, it becomes possible to define a coefficient for each

    node of the transect. If coefficient values are missing for some nodes, they will be interpolated

    linearly along the transect, with constant extrapolation to the edges.

    The Discharge Transect Import menu allows you to load an existing bathymetric profile

    as an X, Y, Z text file. If the points of this transect are not perfectly aligned on a straight line,

    they are projected on the right defined by the first and the last point of the transect.

    If the orientation of the transects is not good (right bank and left bank inverted), select the

    Transects layer of the Discharge layer group, select the wrong transect(s) with the selection

    tool and use the Edit Invert transects menu.

  • 35

    Transects parameters Select the Transects layer of the Discharge layer group, select the transect (s) to be set with the

    selection tool , and use the Discharge Transect parameters menu.

    The Interpolation space step of the bathymetry (m) interpolates a bathymetric transect that

    is not sufficiently sampled. Since discharge is calculated using velocities at known bathymetry

    points (see Principles of Discharge Calculation), the transect should have about 20 points in

    the wet zone. The Z interpolation is done linearly from the neighboring data. The graphic

    display shows the effect of the interpolation on the orthorectified image.

    The Velocity searching radii (m) define the ellipsoid area around the known bathymetry point

    in which the calculated LSPIV velocities will be averaged to assign a surface velocity value (see

    Principles of Discharge Calculation). The Rx and Ry search radii define the demi-axes of the

    ellipsoids along the horizontal and vertical axes, respectively. If the Link/Unlink icon is

    checked , then the Rx and Ry values are forced to be equal, i.e. circular search areas are

    defined. The graphic display shows the footprint of the search radii around each bathymetric

    point.

  • 36

    The Velocity coefficient is the ratio of the velocity averaged over the depth to the surface

    velocity. It makes it possible to calculate a velocity averaged over the depth from the surface

    velocity assigned to the bathymetric point (see Principles of discharge calculation).

    Alternatively, the data and parameters of a transect can be edited node by node: select the transect

    then click-right Edit.

    In addition to the aforementioned transect parameters, the XYZ coordinates of the transect nodes can

    be modified. Extra nodes can be added and defined. Selected nodes can be deleted or moved up and

    down in the list.

    If the Velocity single coef. Box is unticked, different velocity coefficients can be specified for each node

    of the transect. If coefficient values are missing for some nodes, they will be linearly interpolated along

    the transect distance, with constant extrapolation to the edges. The same applies in case new nodes

    are created, i.e. if the interpolation step is smaller than the largest distance between two successive

    nodes in the transect. Coefficient interpolation is done when the Apply or Validate buttons are

    pushed. The interpolation results can be seen when the transect edition window opened again.

    Discharge calculation The Discharge Calculation of the discharge menu (shortcut: CTRL+shift+Q) starts the discharge

    calculation for the bathymetric transects present. For details of the discharge calculation, see

    Discharge Calculation Principles. At the end of the calculation, the discharge results window opens.

  • 37

    The Water level used in the computation is displayed for memory (not editable).

    The table (not editable) allows you to see the calculated parameters for all transects (one row per

    transect) and compare each result to the average of all transects (last row): the difference from the

    average is expressed as Gap (%).

    The Vel. Coef. column displays the mean velocity coefficient. In the case of variable coefficients along

    a transect, it is the single constant coefficient that would have yielded the same discharge result. It is

    computed by dividing the total discharge by the virtual discharge computed with a constant coefficient

    equal to 1.

    The Total Q, Wetted area, and Ave. vel. Columns display the discharge, wetted area and bulk velocity.

    The Measured Q / Total Q column displays the ratio of the discharge computed from measured

    velocities only (i.e. interpolated from neighbouring LSPIV velocities) to the total discharge (including

    extrapolation of missing transect velocities). It is a measure of the weight of velocity extrapolation in

    the total discharge result.

    The Discharge Show calculation results menu allows you to review the discharge calculation table

    without restarting the calculation.

    The layer Depth-average vel. (for depth-average velocities) is created and displayed on the

    orthoimage. It makes it possible to visualize the averaged velocities on the depth at each bathymetric

    point.

  • 38

    After selecting the transects of interest, the Discharge Transect(s) 3D View menu allows a 3D

    visualization of the bathymetry of the transects, the height of water and velocities averaged over the

    depth.

    Export the gauging report The Discharge Export gauging report menu allows you to make a gauging report containing all

    study parameters and results. Fill in the fields of the dialog concerning information about the place,

    the date and the realization of the measurement. Also available from the File Export Export

    gauging report menu.

  • 39

    After validation, choose the backup directory of the gauging report. The report is an Excel file printable

    on a double-sided A4.

  • 40

  • 41

  • 42

    10. Exporting data Several export formats are possible from the File Export menu:

    - Current view

    - Raw / transformed / stabilized images

    - Export of velocities in spreadsheet format (Excel...)

    - Export of velocities in TELEMAC Serafin format (.slf) to be imported into another software

    (QGIS, BlueKenue...)

    - Gauging report

    It is also possible to export results in spreadsheet format by selecting the layer and the desired results,

    then clicking on the Values Table icon in the toolbar:

  • 43

    11. Redo the calculations of an existing study

    For convenience, it is possible to restart all or several calculation steps from the File Restart all

    calculations… menu.

    In the Restart all calculations window, the user can select the calculation steps to be redone.

  • 44

    12. Known bug and solutions

    The gauging report is not created At the request of creation of the gauging report, the following message can appear:

    The solution is to copy the templates directory from the software installation source directory to the

    bin directory.

  • 45

    13. Insights

    Principle of image stabilization Stabilization is used to remove the effects of the camera movements on the scene. The movement

    between two frames can be modelled through a geometrical transformation: rotation, translation,

    zooming or other complex models. The idea is then to apply the reverse transformation on the second

    image in order to “cancel” the movement. The main steps are the following:

    Extraction of key points on the two frames

    Points matching

    Estimation of the geometrical transformation

    Correction of the movement

    Key points extraction Remarkable points on an image –“edges” or “corners” – are areas where the variations of intensity

    (gradients) are important. SURF library (Oyallon, 2015) is used to extract key points. The idea is to

    extract only the points where the variations of intensity are substantial in the two directions. The

    determinant of the Hessian matrix (second derivatives) is used to do so. It is defined as:

    𝐷𝑜𝐻 = det

    (

    𝑑²𝐼(𝑥, 𝑦)

    𝑑𝑥²

    𝑑²𝐼(𝑥, 𝑦)

    𝑑𝑥𝑑𝑦

    𝑑²𝐼(𝑥, 𝑦)

    𝑑𝑥𝑑𝑦

    𝑑²𝐼(𝑥, 𝑦)

    𝑑𝑦² )

    With 𝐼 the intensity of the pixel at the point of coordinate (x, y). We finally retain the key points where

    the DoH is above a threshold tH. The value of this threshold is computed automatically to ensure that

    we reach the desired amount of key points. Three intervals are defined:

    Low density of points: Number of points ∈ [300 ; 500]

    Average density of points: Number of points ∈ [1000 ; 2000]

    High density of points: Number of points ∈ [3000 ; 5000]

    To ensure that stabilization is performed on the river banks the user defines a “flow area” that doesn’t

    contain any key points.

  • 46

    Points matching Now that we get the key points we have to match them from one frame to another. To do so we use

    the SURF descriptor which could be seen as the “ID” of each point. It contains information such as:

    Scale of the point (its “size”)

    Orientation

    Distribution of the gradients in its neighborhood

    Neighborhood depends on the “size” of the points and the gradients are expressed relatively to the

    orientation of the point. Thanks to these particularities the SURF descriptor is invariant to rotation,

    translation and zoom. The key points with same descriptor are then matched. The picture below

    emphasizes the matching with a red line. For each point the diameter of the circle represents the size

    of the point and the green line represents its orientation.

    Errors may occur in matching. To avoid these “false match” we use the ORSA method (Moisan 2004).

    They’re identified thanks to a stochastic process applied with epipolar geometry constraint (not

    detailed here).

  • 47

    Estimation of the transformation We now have 2 sets of matched points, which means that we know the position of each point on frame

    1 and 2. Our goal is now to determine the homography 𝐻 between positions 𝑋 and 𝑋′.

    𝑋 = 𝐻 ∙ 𝑋′ = (

    ℎ1 ℎ2 ℎ3ℎ4 ℎ5 ℎ6ℎ7 ℎ8 ℎ9

    ) ∙ ( 𝑥′𝑦′1

    )

    In image processing we usually consider linear transformations: affine or projective models. Linear

    transformations conserve parallelism, angles and ratio. For affine models only parallelism is conserved.

    With the projective model, nothing is conserved so this is the most sensitive one. Nevertheless this is

    the best to represent perspective effects, and so the change of point of view of the camera.

    The similarity and projective models, used in the stabilization module, are defined as:

    𝐻𝑠𝑖𝑚𝑖𝑙𝑎𝑟𝑖𝑡𝑦 = (

    𝑠𝑟11 𝑠𝑟12 𝑡𝑥𝑠𝑟21 𝑠𝑟22 𝑡𝑦0 0 1

    ) 𝐻𝑝𝑟𝑜𝑗𝑒𝑐𝑡𝑖𝑣𝑒 = (

    ℎ11 ℎ12 ℎ13ℎ21 ℎ22 ℎ23ℎ31 ℎ32 ℎ33

    )

    Each point is used as a control point. The values of coefficients on the homography matrix are then

    estimated with them. DLT method (Direct Linear Transform) is used to reorganize equations above and

    estimate 𝐻 coefficients. Indeed we can’t find a unique solution to this system, so we determine the

    “best solution” that fits with the control points.

    Image transformation We use the 𝐻 matrix determined above to transform the images. This scheme is standard in image

    processing, it helps to deal with the spatial discretization on the image (pixels with index as integer):

    We determine the inverse matrix that changes 𝑋′ to 𝑋

    We browse pixels on 𝑋′ image (image to be rectified)

    We apply inverse transformation to the coordinates of the treated pixel (i,j)-integers- to get

    (i’,j’)-real.

    We use a bicubic interpolation (Hermitte splines on 2 dimensions) to determine the intensity

    at the coordinates (i’,j’) as integers.

  • 48

    Principle of orthorectification

    The pinhole model and its resolution: general 3D case

    We consider a pinhole model to move from an object of coordinates X, Y, Z in a real reference to its

    representation i, j in an image reference. The link between these coordinates can be written in the

    form called DLT (for Direct Linear Transformation) as:

    i = (a_1.X + a_2.Y + a_3.Z + a_4) / (a_9.X + a_10.Y + a_11.Z + 1) and j = (a_5.X + a_6.Y + a_7.Z + a_8 ) /

    (a_9.X + a_10.Y + a_11.Z + 1) (1)

    The coefficients ai have no physical meaning but are combinations of the intrinsic and extrinsic

    parameters of the shot. The previous system can be written in matrix form:

    [■ (X & Y @ 0 & 0) ■ (Z & 1 & 0 @ 0 & 0 & X) ■ (0 & 0 & 0 @ Y & Z & 1) ■ (-iX & -iY & -iZ @ -jX & -jY & -

    jZ)] ∙ [■ (a_1 & a_2 & a_3 & a_4 & a_5 & a_6 & a_8 & a_9 & a_10 & a_11)] ^ T = [■ (i @j)]

    It is possible to solve the equation system above if we are in possession of reference points whose

    coordinates in the real marks (X, Y, Z) and image (i, j) are known. These are points visible on the images,

    and whose real coordinates could be measured in the field.

    The equation system above has 11 unknowns (the coefficients ai), and each landmark provides a

    coordinate i and j. At least 6 benchmarks are needed to resolve this system (which will then be

    overdetermined). The measurement of the real coordinates and the pointing of the image coordinates

    being tainted with uncertainty, it is advisable to use more than 6 reference points. For a number N> =

    6 of reference points, the following matrices are defined:

    T = [2N × 11] = [■ (X_1 & Y_1 & Z_1 & 1 & 0 & 0 & 0 & 0 & -i_1 X_1 & -i_1 Y_1 & -i_1 Z_1 @ X_2 & Y_2

    & Z_2 & 1 & 0 & 0 & 0 & -i_2 X_2 & -i_2 Y_2 & -i_2 Z_2 @ ⋮ & ⋮ & ⋮ & ⋮ & ⋮ & ⋮ & ⋮ @ x_n & y_n & Z_N &

    1 & 0 & 0 & 0 & 0 & -i_N x_n & -i_N y_n & -i_1 Z_N @ 0 & 0 & 0 & 0 & X_1 & y_1 & z -1 & 1 & -j_1 X_1

    & -j_1 y_1 & -j_1 z -1 @ 0 & 0 & 0 & 0 & X_2 & Y_2 & Z_2 & 1 & -j_2 X_2 & -j_2 Y_2 & -j_2 Z_2 @ ⋮ & ⋮

    & ⋮ & ⋮ & ⋮ & ⋮ & ⋮ ⋮ ⋮ 0 & & & &-------------------------

    A = [11 × 1] = [■ (a_1 & a_2 & a_3 & a_4 & a_5 & a_6 & a_7 & a_8 & a_9 & a_10 & a_11)] ^ T

    Z = [2N × 1] = [■ (i_1 & i_2 & ... & i_N & j_1 & j_2 & ... & j_N)] ^ T

    And the pinhole model is written:

    TA = Z

    The system being overdetermined calculating the elements of A is done by a least squares regression.

    We search for the solutions of A which minimize the quadratic difference: ‖TA-Z‖ ^ 2, which amounts

    to seeking a solution to

    (∂‖TA-Z‖ ^ 2) / ∂A = 0 → 2T ^ T (TA-Z) = 0 → T ^ T TA-T ^ T Z = 0

    So we have the following solution for matrix A:

    A = (T ^ T T) ^ (- 1) T ^ T Z

    The pinhole model and its resolution: special 2D case

    If one tries to represent a 2D scene in the real world, a simplified model can be deduced from the

    complete model. If we consider that the discharge that we wish to measure is a plane, that all the

    reference points belong to the plane of the river, and that this plane has a coordinate Z = 0 the system

    of equation (1) writes:

    i = (a_1.X + a_2.Y + a_4) / (a_9.X + a_10.Y + 1) and j = (a_5.X + a_6.Y + a_8) / (a_9.X + a_10.Y + 1 )

    We therefore have a solution with 8 coefficients ai, and the system can be solved with at least 4

    reference points.

    Creation of orthoimages

    An orthoimage represents a corrected view of the perspective and scaling effects of the real world, for

    a given plane. In the case of LSPIV analyzes, it is desirable to orthoreject the plane of the surface of the

  • 49

    discharge (it is therefore assumed that our discharge is plane). This plane can be expressed as a

    function of X and Y such that Z = b_1 X + b_2 Y + b_3. Assuming that the longitudinal and transverse

    slopes are negligible at the scale of the shot, or that the actual coordinate system is expressed relative

    to the plane of the river (XY plane parallel to the plane of the river) , we reduce the equation of the

    plane to Z = b_3, where b3 is the free surface height in the real reference, h.

    The system of equation (1) is reduced, in the plane of discharge, to:

    i = (a_1.X + a_2.Y + a_3.h + a_4) / (a_9.X + a_10.Y + a_11.h + 1) and j = (a_5.X + a_6.Y + a_7.h + a_8 ) /

    (a_9.X + a_10.Y + a_11.h + 1) (2)

    The coefficients ai were calculated as presented in the previous parts.

    The method for constructing orthoimages consists of:

    Define the zone to be imaged in the real coordinate system, ie give the coordinates (X, Y) of the 4

    corners of the orthoimage (done in the Orthorectification menu)

    Sample this area with a given resolution in order to create a grid, knowing that each of the nodes of

    this grid will be the center of a pixel of the orthorectified image.

    For each node of the grid, with coordinates (Xi, Yi), the corresponding coordinates in the source image

    (ii, ji) are calculated with equation (2). The coordinates (ii, ji) thus calculated are reals and not integers.

    Each center pixel (Xi, Yi) is assigned a gray level intensity corresponding to the pixel (ii, ji) of the source

    image. Since the coordinates (ii, ji) are real, we use an interpolation on the neighboring pixels to define

    the intensity in gray level, with a cubic convolution:

    𝑓(𝑖𝑖 , 𝑗𝑖) = ∑ ∑ [𝑓(𝑖𝑖+𝑘 , 𝑗𝑖+𝑙)𝐶(𝑖𝑖+𝑘 − 𝑖𝑖)𝐶(𝑗𝑖+𝑙 − 𝑗𝑖)]

    3

    𝑙=−3

    3

    𝑘=−3

    Où 𝑓(𝑖𝑖+𝑘 , 𝑗𝑖+𝑙) est l’intensité du pixel (𝑖𝑖+𝑘, 𝑗𝑖+𝑙) dans l’image source et C prend la forme :

    𝐶(𝑠) = {1 − 2|𝑠|2 + |𝑠|3 𝑠𝑖 0 ≤ |𝑠| ≤ 1

    4 − 8|𝑠| + 5|𝑠|2 − |𝑠|3 𝑠𝑖 1 ≤ |𝑠| ≤ 20 𝑠𝑖𝑛𝑜𝑛

    Où 𝑠 = 𝑘 𝑜𝑢 𝑙

  • 50

    14. Approfondissements

    Principe de l’orthorectification

    Le modèle sténopé et sa résolution : cas général 3D On considère un modèle sténopé permettant de passer d’un objet de coordonnées X,Y,Z dans un

    repère réel à sa représentation i,j dans un repère image. Le lien entre ces coordonnées peut s’écrire

    sous la forme dite DLT (pour Direct Linear Transformation) comme :

    𝑖 =

    𝑎1. 𝑋 + 𝑎2. 𝑌 + 𝑎3. 𝑍 + 𝑎4𝑎9. 𝑋 + 𝑎10. 𝑌 + 𝑎11. 𝑍 + 1

    𝑒𝑡 𝑗 =𝑎5. 𝑋 + 𝑎6. 𝑌 + 𝑎7. 𝑍 + 𝑎8𝑎9. 𝑋 + 𝑎10. 𝑌 + 𝑎11. 𝑍 + 1

    (1)

    Les coefficients ai n’ont pas de sens physique mais sont des combinaisons des paramètres intrinsèques

    et extrinsèques de la prise de vue. Le système précédent peut s’écrire sous forme matricielle :

    [𝑋 𝑌0 0

    𝑍 1 00 0 𝑋

    0 0 0𝑌 𝑍 1

    −𝑖𝑋 −𝑖𝑌 −𝑖𝑍−𝑗𝑋 −𝑗𝑌 −𝑗𝑍

    ]

    ∙ [𝑎1 𝑎2 𝑎3 𝑎4 𝑎5 𝑎6 𝑎7 𝑎8 𝑎9 𝑎10 𝑎11]𝑇 = [𝑖𝑗]

    Il est possible de résoudre le système d’équation ci-dessus si on est en possession de points de

    référence dont les coordonnées dans les repères réel (X,Y,Z) et image (i,j) sont connus. Il s’agit de point

    visibles sur les images, et dont les coordonnées réelles ont pu être mesurées sur le terrain.

    Le système d’équation ci-dessus possède 11 inconnues (les coefficients ai), et chaque point de repère

    apporte une coordonnée i et j. Il faut donc a minima 6 points de repère pour résoudre ce système (qui

    sera dès lors surdéterminé). La mesure des coordonnées réelles et le pointage des coordonnées image

    étant entaché d’incertitude, il est conseillé d’utiliser plus que 6 points de référence. Pour un nombre

    N >= 6 de points de référence, on définit les matrices suivantes :

    𝑇 = [2𝑁 × 11] =

    [ 𝑋1 𝑌1 𝑍1 1 0 0 0 0 −𝑖1𝑋1 −𝑖1𝑌1 −𝑖1𝑍1𝑋2 𝑌2 𝑍2 1 0 0 0 0 −𝑖2𝑋2 −𝑖2𝑌2 −𝑖2𝑍2⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮

    𝑋𝑁 𝑌𝑁 𝑍𝑁 1 0 0 0 0 −𝑖𝑁𝑋𝑁 −𝑖𝑁𝑌𝑁 −𝑖1𝑍𝑁0 0 0 0 𝑋1 𝑌1 𝑍1 1 −𝑗1𝑋1 −𝑗1𝑌1 −𝑗1𝑍10 0 0 0 𝑋2 𝑌2 𝑍2 1 −𝑗2𝑋2 −𝑗2𝑌2 −𝑗2𝑍2⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮0 0 0 0 𝑋𝑁 𝑌𝑁 𝑍𝑁 1 −𝑗𝑁𝑋𝑁 −𝑗𝑁𝑌𝑁 −𝑗1𝑍𝑁]

    𝐴 = [11 × 1] = [𝑎1 𝑎2 𝑎3 𝑎4 𝑎5 𝑎6 𝑎7 𝑎8 𝑎9 𝑎10 𝑎11]𝑇

    𝑍 = [2𝑁 × 1] = [𝑖1 𝑖2 … 𝑖𝑁 𝑗1 𝑗2 … 𝑗𝑁]𝑇

    Et le modèle sténopé s’écrit :

    𝑇𝐴 = 𝑍

    Le système étant surdéterminé calcul des éléments de A se fait par une régression en moindres carrés.

    On cherche les solutions de A qui minimisent l’écart quadratique : ‖𝑇𝐴 − 𝑍‖2, ce qui revient à chercher

    une solution à

  • 51

    𝜕‖𝑇𝐴 − 𝑍‖2

    𝜕𝐴= 0 → 2𝑇𝑇(𝑇𝐴 − 𝑍) = 0 → 𝑇𝑇𝑇𝐴 − 𝑇𝑇𝑍 = 0

    On a donc la solution suivante pour la matrice A :

    𝐴 = (𝑇𝑇𝑇)−1𝑇𝑇𝑍

    Le modèle sténopé et sa résolution : cas particulier 2D Si on cherche à représenter une scène 2D dans le monde réel, un modèle simplifié peut être déduit du

    modèle complet. Si on considère que l’écoulement que l’on souhaite mesurer est un plan, que tous les

    points de référence appartiennent au plan de la rivière, et que ce plan a une coordonnée Z=0 le

    système d’équation (1) s’écrit :

    𝑖 =𝑎1. 𝑋 + 𝑎2. 𝑌 + 𝑎4𝑎9. 𝑋 + 𝑎10. 𝑌 + 1

    𝑒𝑡 𝑗 =𝑎5. 𝑋 + 𝑎6. 𝑌 + 𝑎8𝑎9. 𝑋 + 𝑎10. 𝑌 + 1

    On a donc une solution à 8 coefficients ai, et le système peut être résolu avec a minima 4 points de

    référence.

    Création des orthoimages Une orthoimage représente une vue corrigée des effets de perspective et mise à l’échelle du monde

    réel, pour un plan donné. Dans le cas des analyses LSPIV, on souhaite orthorectifier le plan de la surface

    de l’écoulement (on fait donc l’hypothèse que notre écoulement est plan). Ce plan peut être exprimé

    en fonction de X et Y tel que 𝑍 = 𝑏1𝑋 + 𝑏2𝑌 + 𝑏3. En faisant l’hypothèse que les pentes longitudinales

    et transverse sont négligeables à l’échelle de la prise de vue, ou que le le système de coordonnées réel

    est exprimé par rapport au plan de la rivière (plan XY parallèle au plan de la rivière), on réduit l’équation

    du plan à 𝑍 = 𝑏3, où b3 est la hauteur de surface libre dans le repère réel, h.

    Le système d’équation (1) se réduit, dans le plan de l’écoulement, à :

    𝑖 =

    𝑎1. 𝑋 + 𝑎2. 𝑌 + 𝑎3. ℎ + 𝑎4𝑎9. 𝑋 + 𝑎10. 𝑌 + 𝑎11. ℎ + 1

    𝑒𝑡 𝑗 =𝑎5. 𝑋 + 𝑎6. 𝑌 + 𝑎7. ℎ + 𝑎8𝑎9. 𝑋 + 𝑎10. 𝑌 + 𝑎11. ℎ + 1

    (2)

    Les coefficients ai ont été calculés tels que présenté dans les parties précédentes.

    La méthode pour construire les orthoimages consiste à :

    Définir la zone à imager dans le repère réel, c'est-à-dire donner les coordonnées (X,Y) des 4

    coins de l’orthoimage (fait dans le menu Orthorectification)

    Échantillonner cette zone avec une résolution donnée afin de créer une grille, sachant que

    chacun des nœuds de cette grille sera le centre d’un pixel de l’image orthorectifiée.

    Pour chaque nœud de la grille, de coordonnées (Xi,Yi), on calcule les coordonnées

    correspondantes dans l’image source (ii,ji) avec l’équation (2). Les coordonnées (ii,ji) ainsi

    calculées sont des réels et non des entiers.

    On affecte à chaque pixel de centre (Xi,Yi) une intensité en niveau de gris correspondant au

    pixel (ii,ji) de l’image source. Puisque les coordonnées (ii,ji) sont des réels, on utilise une

    interpolation sur les pixels voisins pour définir l’intensité en niveau de gris, avec une

    convolution cubique :

    𝑓(𝑖𝑖 , 𝑗𝑖) = ∑ ∑ [𝑓(𝑖𝑖+𝑘 , 𝑗𝑖+𝑙)𝐶(𝑖𝑖+𝑘 − 𝑖𝑖)𝐶(𝑗𝑖+𝑙 − 𝑗𝑖)]

    3

    𝑙=−3

    3

    𝑘=−3

  • 52

    Où 𝑓(𝑖𝑖+𝑘 , 𝑗𝑖+𝑙) est l’intensité du pixel (𝑖𝑖+𝑘, 𝑗𝑖+𝑙) dans l’image source et C prend la forme :

    𝐶(𝑠) = {1 − 2|𝑠|2 + |𝑠|3 𝑠𝑖 0 ≤ |𝑠| ≤ 1

    4 − 8|𝑠| + 5|𝑠|2 − |𝑠|3 𝑠𝑖 1 ≤ |𝑠| ≤ 20 𝑠𝑖𝑛𝑜𝑛

    Où 𝑠 = 𝑘 𝑜𝑢 𝑙

  • 53

    Principles of measuring the velocity of movement of tracers

    A cross-correlation statistical analysis is performed on the orthorectified images to determine the

    displacement of the tracers visible on the surface. Fudaa-LSPIV software uses an optimized algorithm

    for large-scale spatial applications with low image resolutions. The correlation between an

    interrogation window (IA for interrogation area) centered on a point aij in an image and the same IA

    centered on a bij point in the next image is calculated, images separated by a time interval of Δt

    seconds. . The size of the query window can be set in Fudaa-LSPIV. The correlation coefficient R (aij,

    bij) is calculated as follows:

    R (a_ (i, j), b_ (i, j)) = (Σ_ (i = 1) ((M_i) ▒Σ_ (j = 1) ((M_j) ▒ [(A_ij- (A_ij) ̅) (B_ij- (B_ij) )̅]) / [Σ_ (i = 1) ^

    Mi▒Σ_ (j = 1) ^ Mj▒ 〖(A_ij- (A_ij) )̅ ^ 2 Σ_ (i = 1 ) ^ Mi▒Σ_ (j = 1) ^ Mj▒ (B_ij- (B_ij) )̅ ^ 2〗] ^ (1/2)

    where Mi and Mj are the sizes of the interrogation window (in pixels) and Aij and Bij are the

    distributions of the intensities of the pixels in the two interrogation windows. This calculation is

    performed only for bij points included in a search window defined by the user, saving computing time.

    It is assumed that the most probable displacement of the discharge from the point aij during the time

    Δt is that corresponding to the correlation maximum, with the possibility of defining a minimal

    correlation required.

    The accuracy of the calculation being at the pixel near, it is interesting to perform a sub-pixel

    interpolation. Let bi be the position of the maximum correlation. In Fudaa-LSPIV, an adjustment of a

    unidimensional Gaussian law is used on the axes i and j to obtain a precision of displacement of the

    order of 0.2 pixels in the form:

    Δi = (ln (b_ (i-1, j)) -ln (b_ (i + 1, j))) / 2 [ln 〖(b_ (i-1, j)) -2ln (b_ (i, j)) + ln 〖(b〗 _ (i-1, j))〗] and

    Δj = (ln (b_ (i, j-1)) -ln (b_ (i, j + 1)) / 2 [ln 〖(b_ (i, j + 1)) -2ln (b_ (i, j)) + ln 〖(b〗 _ (i, j-1))〗]

    The sub-pixel position of the correlation maximum is given as bi + Δi, j + Δj.

    Surface velocities are calculated from displacements bi + Δi, j + Δj.-ai, j divided by Δt. The calculation

    is repeated iteratively over the entire image for each node of the calculation grid. Thus, a surface 2D

    velocity field "instantaneous" (between two successive images) is calculated.

    Fudaa-LSPIV makes it possible to apply filters to eliminate the aberrant velocities resulting from the

    statistical computation. Filters on the minimum value of the correlation coefficient, the amplitude and

    the orientation of the velocities are implemented in the software.

    Finally, Fudaa-LSPIV makes it possible to average the filtered instantaneous velocity fields to calculate

    an averaged velocity field over the duration of the image sequence.

    Principes de la mesure de la vitesse de déplacement des traceurs Une analyse statistique en corrélation croisée est effectuée sur les images orthorectifiées afin de

    déterminer le déplacement des traceurs visibles en surface. Le logiciel Fudaa-LSPIV utilise un

    algorithme optimisé pour les applications de grande échelle spatiale avec des résolutions d'images

    pouvant être faible. On calcule la corrélation entre une fenêtre d'interrogation (IA pour interrogation

    area) centrée sur un point aij dans une image et la même IA centrée sur un point bij dans l'image

    suivante, images séparées par un intervalle de temps de ∆t secondes. La taille de la fenêtre

    d’interrogation est paramétrable dans Fudaa-LSPIV. Le coefficient de corrélation R(aij, bij) est calculé

    ainsi :

  • 54

    𝑅(𝑎𝑖,𝑗, 𝑏𝑖,𝑗) =∑ ∑ [(𝐴𝑖𝑗 − 𝐴𝑖𝑗̅̅ ̅̅ )(𝐵𝑖𝑗 − 𝐵𝑖𝑗̅̅ ̅̅ )]

    𝑀𝑗𝑗=1

    𝑀𝑖𝑖=1

    [∑ ∑ (𝐴𝑖𝑗 − 𝐴𝑖𝑗̅̅ ̅̅ )2∑ ∑ (𝐵𝑖𝑗 − 𝐵𝑖𝑗̅̅ ̅̅ )

    2𝑀𝑗𝑗=1

    𝑀𝑖𝑖=1

    𝑀𝑗𝑗=1

    𝑀𝑖𝑖=1 ]

    1/2

    où Mi et Mj sont les tailles de la fenêtre d'interrogation (en pixel) et Aij et Bij sont les distributions des

    intensités des pixels dans les deux fenêtres d'interrogation. Ce calcul n'est effectué que pour des points

    bij inclus dans une fenêtre de recherche (SA pour Searching Area) définie par l'utilisateur, permettant

    d’économiser du temps de calcul. On suppose que le déplacement le plus probable de l'écoulement à

    partir du point aij pendant le temps ∆t est celui correspondant au maximum de corrélation, avec

    possibilité de définir une corrélation minimale requise.

    La précision du calcul étant au pixel prés, il est intéressant de réaliser une interpolation sub-pixel. Soit

    bi,j la position du maximum de corrélation. Dans Fudaa-LSPIV, un ajustement d’une loi Gaussienne

    unidimensionnelle est utilisé sur les axes i et j pour obtenir une précision de déplacement de l'ordre

    de 0,2 pixels sous la forme :

    ∆𝑖 =ln(𝑏𝑖−1,𝑗)−ln (𝑏𝑖+1,𝑗)

    2[ln(𝑏𝑖−1,𝑗)−2𝑙𝑛(𝑏𝑖,𝑗)+𝑙𝑛(𝑏𝑖−1,𝑗)] et ∆𝑗 =

    ln(𝑏𝑖,𝑗−1)−ln (𝑏𝑖,𝑗+1)

    2[ln(𝑏𝑖,𝑗+1)−2𝑙𝑛(𝑏𝑖,𝑗)+𝑙𝑛(𝑏𝑖,𝑗−1)]

    La position sub-pixel du maximum de corrélation est don calculée comme bi+∆i,j+∆j.

    Les vitesses de surface sont calculées à partir des déplacements bi+∆i,j+∆j.-ai,j divisés par ∆t. Le calcul est

    reproduit de manière itérative sur toute l'image pour chaque nœud de la grille de calcul. On calcule

    ainsi un champ de vitesse 2D de surface, "instantané" (entre deux images successives).

    Fudaa-LSPIV permet d'appliquer des filtres pour éliminer les vitesses aberrantes issues du calcul

    statistique. Des filtres sur la valeur minimale du coefficient de corrélation, sur l'amplitude et

    l'orientation des vitesses sont implémentés dans le logiciel.

    Enfin, Fudaa-LSPIV permet de moyenner les champs de vitesses instantanées filtrées pour calculer un

    champ de vitesses moyennées sur la durée de la séquence d’images.

  • 55

  • 56

    Principles of discharge calculation

    Fudaa-LSPIV can calculate the discharge passing through one or several cross-sections located in the

    area where surface velocities have been computed. The geometry of the cross-sections must be

    provided in the form of the 3-D XYZ coordinates of points of the stream bed, ordered from a bank to

    the other.

    The bathymetric transect can be interpolated at a user-defined pitch, and a surface velocity is

    calculated for each step from the nearest LSPIV velocities (distance weighted). The user also defines a

    coefficient connecting the surface velocity to the averaged velocity over the depth for each calculation

    step. The discharge is then calculated by the method of the median section, the interpolation of the

    velocities towards the edges being done according to the hypothesis of the number of Froude varying

    linearly towards zero at the edge.

    Definition and interpolation of the bathymetric profile

    The bottom points must be ordered from the left bank to the right bank.

    The transect must contain at least one point whose rating is less than that of the water and the points

    at the ends must have a higher rating than that of the water. It is possible to have points above the

    water level (islands) framed by water areas.

    Orthogonal projection on the line defined by the extreme points of the transect (first and last point).

    Linear interpolation by adding points (from the left bank) whenever the specified maximum space step

    is exceeded.

    Estimated average velocity at each point of the transect

    For each transect, the user defines a search radius. In this neighborhood around each node, the

    maximum 3 closest velocity results are searched. If at least one result is found, then the average

    velocity on vertical V_i at node i is computed as the average of neighboring velocities weighted by the

    inverse of distances, multiplied by the user specified surface coefficient α for transect considered:

    V_i = α Σ_ (j = 1) ^ (N_i) ▒ 〖v_ (i, j) / d_ (i, j)〗 / Σ_ (j = 1) ((N_i) ▒ 〖1 / d_ (i, j)〗

    With N_i the number of velocity results v_ (i, j) found in the neighborhood of the node i of the transect

    (N_i≤3); the distance d_ (i, j) is that between the position (x_j, y_j) of the grid node of the velocity

    result v_ (i, j) and the position (x_i, y_i) of the node i with a safety distance fixed to 1 mm:

    d_ (i, j) = max [0.001; (x_j-x_i) ^ 2 + (y_j-y_i) ^ 2]

    When no LSPIV velocity result is found in the neighborhood of a transect node, the average transect

    normal velocity is reconstructed by linear interpolation of local Froude numbers between the two

    nearest nodes, right and left. left, with interpolated velocity. Indeed, in order to optimize the depth

    measurement performed on the bathymetric vertical, it is interesting to use a hydraulic hypothesis of

    linear evolution of the local Froude number, instead of simply correcting the surfaces of the wet

    subsections, or to interpolate the velocities linearly. The linear interpolation of local Froude numbers

    is proposed by several references: Boiten (2000), Despax (2016), Fulford and Sauer (1986), ISO / TR

    9823 (1990), Le Coz et al. (2008, 2012, 2014).

    Either a bathymetric vertical positioned at abscissa xi, whose full verticals (with depth and velocities)

    closest to each side are positioned at xi-1 and xi + 1 (Figure 1).

    In i-1, the full vertical allows to have the depth hi-1 and the average velocity on the depth Vi-1. The

    number of local Froude is calculated:

    〖Fr〗 _ (i-1) = V_ (i-1) / √ (〖g.h〗 _ (i-1)),

    with g the acceleration of gravity on the surface of the Earth (9.81 m · s-2).

  • 57

    In i + 1, the local Froude number is:

    〖Fr〗 _ (i + 1) = V_ (i + 1) / √ (〖g.h〗 _ (i + 1))

    The Froude number of the bathymetric vertical, positioned in i, is calculated by linear interpolation as:

    〖Fr〗 _i = [(x_ (i + 1) -x_i) 〖Fr〗 _ (i-1) + (x_i-x_ (i-1)). 〖Fr〗 _ (i + 1)] / ( x_ (i + 1) -x_ (i-1))

    Knowing the depth in i, hi, we calculate the associated average velocity as:

    V_i = 〖Fr〗 _i.√ (g.h_i)

    Figure 1: Calculation of the average velocity associated with a bathymetric vertical by interpolation of

    the number of Froude local Fri

    In the case of a bathymetric vertical located between the shore and the other verticals, it is advisable

    to make an assumption about the velocity at the bank: it is theoretically null, but a constant

    extrapolation or a fictitious shoreline velocity calculated with a coefficient of bank (case of the Bareme

    software) may be more realistic than a linear extrapolation to zero, in practice.

    The calculation of the discharge can finally be done normally on all the verticals, now all provided with

    an estimated average velocity.

    Calculation of the discharge through each transect

    Median velocity, normal velocity at transect

    Edge discharges?

    Measured discharge rate / extrapolated

    Principes du calcul de débit Connaissant le profil bathymétrique d'au moins une section en travers incluse dans la zone d'analyse,

    Fudaa-LSPIV peut calculer le débit transitant par cette section. Le transect bathymétrique peut être

    interpolé à un pas défini par l'utilisateur, et une vitesse de surface est calculée pour chaque pas à partir

    des vitesses LSPIV les plus proches (pondération en fonction de l'éloignement). L'utilisateur définit

    également un coefficient reliant la vitesse de surface à la vitesse moyennée sur la profondeur pour

    chaque pas de calcul. Le débit est alors calculé par la méthode de la section médiane, l'interpolation

    des vitesses vers les bords se faisant selon l'hypothèse du nombre de Froude variant linéairement vers

    zéro au bord.

    Définition et interpolation du profil bathymétrique Les points du fond doivent être ordonnés depuis la rive gauche jusqu’à la rive droite.

    Le transect doit contenir au moins un point dont la cote est inférieure à celle de l’eau et les points aux

    extrémités doivent avoir une cote supérieure à celle de l’eau. Il est possible d’avoir des points situés

    au-dessus du niveau d’eau (îles) encadrés par des zones en eau.

    Projection orthogonale sur la droite définie par les points extrêmes du transect (premier et dernier

    point).

    Interpolation linéaire en ajoutant des points (depuis la rive gauche) chaque fois que le pas d’espace

    maximum spécifié est dépassé.

  • 58

    Estimation de la vitesse moyenne en chaque point du transect Pour chaque transect, l’utilisateur définit un rayon de recherche. Dans ce voisinage autour de chaque

    nœud, les au maximum 3 résultats de vitesse les plus proches sont recherchés. Si au moins un résultat

    est trouvé, alors la vitesse moyenne sur la verticale 𝑉𝑖 au nœud i est calculée comme la moyenne des

    vitesses voisines pondérée par l’inverse des distances, multipliée par le coefficient de surface α spécifié

    par l’utilisateur pour le transect considéré :

    𝑉𝑖 = α ∑ 𝑣𝑖,𝑗

    𝑑𝑖,𝑗

    𝑁𝑖

    𝑗=1

    / ∑ 1

    𝑑𝑖,𝑗

    𝑁𝑖

    𝑗=1

    Avec 𝑁𝑖 le nombre de résultats de vitesse 𝑣𝑖,𝑗 trouvés au voisinage du nœud 𝑖 du transect (𝑁𝑖 ≤ 3) ;

    la distance 𝑑𝑖,𝑗 est celle entre la position (𝑥𝑗, 𝑦𝑗) du nœud de grille du résultat de vitesse 𝑣𝑖,𝑗 et la

    position (𝑥𝑖 , 𝑦𝑖) du nœud i avec une distance de sécurité fixée à 1 mm :

    𝑑𝑖,𝑗 = max [0.001; (𝑥𝑗 − 𝑥𝑖)2+ (𝑦𝑗 − 𝑦𝑖)

    2]

    Lorsqu’aucun résultat de vitesse LSPIV n’est trouvé dans le voisinage d’un nœud du transect, la vitesse

    moyenne normale au transect est reconstituée par interpolation linéaire des nombres de Froude

    locaux, entre les deux nœuds les plus proches, à droite et à gauche, dotées d’une vitesse interpolée.

    En effet, afin de valoriser au mieux la mesure de profondeur réalisée sur la verticale bathymétrique, il

    est intéressant d’utiliser une hypothèse hydraulique d’évolution linéaire du nombre de Froude local,

    au lie