Vous êtes sur la page 1sur 146

Product-Manual

Imaging Tools
Item-Number(s): 1005xxx

LaVision
We count on Photons

Product-Manual for DaVis 7.2

LaVision GmbH, Anna-Vandenhoeck-Ring 19, D-37081 Gttingen


Produced by LaVision GmbH, Gttingen
Printed in Germany
Gttingen, June 22, 2009

Document name: 1003012_ImagingTools_D72.tex

Contents

Contents
1 Introduction

2 Calibration wizard dialog

2.1

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.1.1

How to open the dialog . . . . . . . . . . . . . . . . . .

10

2.1.2

Concept of the wizard . . . . . . . . . . . . . . . . . . .

10

2.1.3

Where the calibration is stored in your project . . . . .

13

2.2

Choose your calibration mode . . . . . . . . . . . . . . . . . . .

14

2.3

Walkthrough : define scale, no image distortion . . . . . . . . .

17

2.3.1

Step 1 : Define experimental setup . . . . . . . . . . . .

17

2.3.2

Step 2 : Define scale / no image distortion . . . . . . . .

17

Walkthrough : 1 camera system (2D) . . . . . . . . . . . . . . .

23

2.4.1

Step 1 : Define experimental setup . . . . . . . . . . . .

23

2.4.2

Step 2 : Define coordinate system . . . . . . . . . . . . .

23

2.4.3

Step 3 : Select used calibration plate . . . . . . . . . . .

25

2.4.4

Step 4 : Image acquisition . . . . . . . . . . . . . . . . .

26

2.4.5

Step 5 : Mark definition . . . . . . . . . . . . . . . . . .

28

2.4.6

Step 6 : Finding all marks . . . . . . . . . . . . . . . . .

29

2.4.7

Step 7 : Fit mapping function . . . . . . . . . . . . . . .

30

2.4.8

Step 8 : Evaluation of corrected images . . . . . . . . .

33

2.4.9

Finish calibration . . . . . . . . . . . . . . . . . . . . . .

35

Walkthrough : 2 cameras system (independent 2D+2D) . . . .

36

2.5.1

Step 1 : Define experimental setup . . . . . . . . . . . .

36

2.5.2

Step 2 : Define coordinate system . . . . . . . . . . . . .

36

2.5.3

Step 3 : Select used calibration plate(s) . . . . . . . . .

38

2.5.4

Step 4 : Image acquisition . . . . . . . . . . . . . . . . .

39

2.5.5

Step 5 : Mark definition . . . . . . . . . . . . . . . . . .

41

2.5.6

Step 6 : Finding all marks . . . . . . . . . . . . . . . . .

42

2.5.7

Step 7 : Fit mapping function . . . . . . . . . . . . . . .

44

2.5.8

Step 8 : Evaluation of corrected images . . . . . . . . .

46

2.5.9

Finish calibration . . . . . . . . . . . . . . . . . . . . . .

48

Walkthrough : 2 cameras system (mapped, e.g. stereo) . . . . .

50

2.4

2.5

2.6

Contents

2.6.1

Step 1 : Define experimental setup . . . . . . . . . . . .

50

2.6.2

Step 2 : Define coordinate system . . . . . . . . . . . . .

50

2.6.3

Step 3 : Select used calibration plate . . . . . . . . . . .

52

2.6.4

Step 4 : Image acquisition . . . . . . . . . . . . . . . . .

54

2.6.5

Step 5 : Mark definition . . . . . . . . . . . . . . . . . .

56

2.6.6

Step 6 : Finding all marks . . . . . . . . . . . . . . . . .

57

2.6.7

Step 7 : Fit mapping function . . . . . . . . . . . . . . .

59

2.6.8

Step 8 : Evaluation of corrected images . . . . . . . . .

61

2.6.9

Finish calibration . . . . . . . . . . . . . . . . . . . . . .

63

Walkthrough : advanced settings . . . . . . . . . . . . . . . . .

65

2.7.1

Step 1 : Define experimental setup . . . . . . . . . . . .

65

2.7.2

Step 2 : Define coordinate system . . . . . . . . . . . . .

65

2.7.3

Step 3 : Select used calibration plates . . . . . . . . . .

67

2.7.4

Step 4 : Image acquisition . . . . . . . . . . . . . . . . .

69

2.7.5

Step 5 : Mark definition . . . . . . . . . . . . . . . . . .

71

2.7.6

Step 6 : Finding all marks . . . . . . . . . . . . . . . . .

72

2.7.7

Step 7 : Fit mapping function . . . . . . . . . . . . . . .

74

2.7.8

Step 8 : Evaluation of corrected images . . . . . . . . .

76

2.7.9

Finish calibration . . . . . . . . . . . . . . . . . . . . . .

78

Walkthrough : define origin, maintain calibration . . . . . . . .

80

2.8.1

Step 1 : Define experimental setup . . . . . . . . . . . .

80

2.8.2

Step 2 : Define origin / maintain calibration . . . . . . .

80

2.8.3

Finish calibration . . . . . . . . . . . . . . . . . . . . . .

82

Stitching in a side-to-side camera setup . . . . . . . . . . . . . .

84

2.9.1

Preparation . . . . . . . . . . . . . . . . . . . . . . . . .

84

2.9.2

Calibration . . . . . . . . . . . . . . . . . . . . . . . . .

84

2.9.3

Stitching images . . . . . . . . . . . . . . . . . . . . . .

85

2.9.4

Stitching vector fields . . . . . . . . . . . . . . . . . . .

85

2.10 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . .

86

2.7

2.8

2.9

3 Imaging Tools

89

3.1

Mask Definition . . . . . . . . . . . . . . . . . . . . . . . . . . .

89

3.2

Overlay Editor . . . . . . . . . . . . . . . . . . . . . . . . . . .

93

3.3

Adapt existing palette . . . . . . . . . . . . . . . . . . . . . . .

95

3.4

Image correction and distortion . . . . . . . . . . . . . . . . . .

98

3.5

X/Y Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101


3.5.1

Window Manager . . . . . . . . . . . . . . . . . . . . . . 101

3.5.2

Plot mode . . . . . . . . . . . . . . . . . . . . . . . . . . 101

3.5.3

Y - axis . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

Contents

3.6

3.5.4
3.5.5
3.5.6
Strain

X - axis . .
Store mode
Processing .
Gauge . . .

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

4 About Filter Operations


4.1 Filter Operations . . . . . . . . . . . . . . . . .
4.2 Smoothing Filter . . . . . . . . . . . . . . . . .
4.2.1 Smoothing 3x3 . . . . . . . . . . . . . .
4.2.2 Gaussian LowPass . . . . . . . . . . . .
4.2.3 Median Filter . . . . . . . . . . . . . . .
4.3 Sobel Filter . . . . . . . . . . . . . . . . . . . .
4.4 Compass Filter . . . . . . . . . . . . . . . . . .
4.5 Laplace Filter . . . . . . . . . . . . . . . . . . .
4.6 Sharpening Filter . . . . . . . . . . . . . . . . .
4.7 Erosion and Dilation Filter . . . . . . . . . . .
4.8 Fourier Transformation . . . . . . . . . . . . . .
4.8.1 Basic FFT and Inverse FFT on Images .
4.8.2 Fast Fourier Transform . . . . . . . . . .
4.8.3 FFT-Filter . . . . . . . . . . . . . . . .
4.8.4 Using CL to design your own filter . . .
4.8.5 The Art of Filter Design . . . . . . . . .
4.8.6 Mathematical Operation on FFTs . . . .
4.8.7 FFT Data Storage . . . . . . . . . . . .
4.8.8 Correlation and Convolution . . . . . .
4.8.9 Autocorrelation . . . . . . . . . . . . . .
4.8.10 Convolution . . . . . . . . . . . . . . . .
4.8.11 Cyclic versus Non-Cyclic Computations
4.8.12 Literature . . . . . . . . . . . . . . . . .
4.9 Nonlinear Filter . . . . . . . . . . . . . . . . . .
4.9.1 The Math behind NonlinearFilter . . . .
4.10 Dialog for Linear Filter . . . . . . . . . . . . . .
4.10.1 User Filter . . . . . . . . . . . . . . . .
Index

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.

104
104
105
105

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

111
111
111
112
112
112
113
114
115
116
117
117
118
120
123
124
126
128
129
131
132
132
133
135
136
136
139
141
143

Contents

1 Introduction
The Imaging Tools manual describes different dialogs that are available in the
basic DaVis software package.
The biggest part of this manual concerns the perspective image correction.
The Calibration wizard chapter explains how to generate a calibration. The
Image distortion and correction chapter describes how to apply the calculated calibration on a single image. This functionality is also available in the
Batch Processing dialog.
Masks are often used to restrict the area of interest during processing. Theay
are defined in the Mask dialog. Overlays are painted above a image or vecter
view. The XY Plot dialog allows to extract profiles from a single or multiple
vector fields.
The Filter operations chapter explains the different possibilities of image
processing using linear or non-linear filters.

1 Introduction

2 Calibration wizard dialog


2.1

Introduction

The tutorial is based on DaVis 7.1 software package (or later versions) and will
guide you to use LaVision Calibration Wizard dialog.
Doing a calibration is important because:
The results should be shown in scaled units representing the true (world)
dimensions. So the image scale pixel/mm should be determined.
The images usually show some image distortions due to perspective projection and inherent camera lens distortion. This should be corrected
(image dewarping)
for stereo measurements an internal representation for the geometrical
setup of both cameras relative to the sample is needed. This is determined.
Below you will find and example of how the image correction can correct perspective correction and lens errors:

2 Calibration wizard dialog

This chapter will outline the three following topics:

How to choose the correct calibration mode (Define experimental setup)


A walkthrough explaining all calibration wizard dialog steps for the selected calibration mode

Import, export and adaptation of an existing calibration

2.1.1

How to open the dialog

To open the calibration wizard dialog press the calibration button in your
projects tool bar (see bitmap at the page margin). In Davis Classic mode you
can access the calibration wizard dialog through the menu entry Compute
Perspective calibration wizard.
A successful calibration procedure will store all acquired data and the calibration information under the Properties folder of your project in the folder
Calibration. A new calibration (imported or using the wizard) or any additional adaptations of your calibration (setting a new origin) will store the
previously active calibration in the folder Properties/Calibration History
before overwriting the Properties/Calibration files. So it is possible to restore any previous calibration done in your project : do a right mouse click
in the project manager tree view entry of the calibration in question and select import calibration. The Calibration History folder can be deleted
anytime to save up hard disk space, but it will not be possible to restore old
calibrations then (right mouse click : delete). This is not possible for the active
Calibration folder in the project manager and you should never delete the
Calibration folder of a project yourself.
In classic mode a Calibration History folder is not supported and the destination name and path for the Calibration has to be specified every time you
change the calibration.

2.1.2

Concept of the wizard

Below you see the basic outline of the calibration wizard dialog.
10

2.1 Introduction

It consists of the following elements:


the tool bar where you can abort the calibration process and (close)
the dialog, go to the next or the previous step and adapt the currently
active window (zoom factor, color mapping and color palette etc..).
the center dialog area on the left where all interactions are done by setting
check boxes, entering numbers or pressing buttons.
the center dialog area on the right showing all necessary calibration steps
to be done in the wizard to create a new calibration. It also indicated
where you are right now and gives you easy access to all other steps (going
back several steps or skipping various steps you have already done).
below that dialog you find the window manager with selection boxes to
show the image for a specific camera / view combination in the working window or the reference window. The reference window might be
switched on and off.
one or two image windows on the bottom to show camera images for a
specific camera / view combination. The image shown in the working
11

2 Calibration wizard dialog

window is used for all user interactions. The reference window is only
for your convenience to compare two images for different cameras and/or
views and might be switched off without any drawbacks.
Depending on the choices you make the wizard consists of two to eight steps.
Like a program installation for your computers operation system each step
deals only with a special topic e.g. image acquisition or setting up parameters
to calculate the image dewarping function or specifying physical dimensions of
the calibration plate you are using. This should focus your attention to the
important things to be done. When you have specified all necessary selections
and entries for the current step you may proceed to the next step pressing the
next step button depicted to the side of the page or you might go to a previous
step pressing (iteratively) the previous step button also shown aside. If still
some information is missing to proceed to the next step the next step button
is disabled. Please refer to the section of that step to see how to resolve this.
When you are finished with all steps the next button will change to become
a finish button (see image aside)
Alternatively you might just press the corresponding button of the step you
want to go to in the step list labeled You are here:. Please be aware that
this view might not always be visible e.g. when you have a screen resolution
of less than 1280x1024 or when Davis is not maximized or at the minimized
version of some dialog steps to make more space for the displayed images.
Also be aware that the steps depicted might be named differently as the contents varies from calibration mode to calibration mode. Below there are for
two examples for different calibration modes.

Also it might not be possible to go to a later step because you may have to
make additional selections or perform some actions (e.g. clicking of reference
marks) in an earlier step. So it will take you as far down the list as possible and
halt automatically at the step in question. So pressing e.g. the last step will
accept all settings made in the first steps until some additional information is
required e.g. reference marks have to be specified on some images.
12

2.1 Introduction

2.1.3

Where the calibration is stored in your project

In the project a calibration will be stored in the Properties/Calibration


folder of your project. The hierarchical set structure is shown in the following
screen shot:

All views for a camera will be stored in the corresponding set camera1 . . .
camera6. In corrected a number of corrected images are stored that hold
the summed up (corrected) images of all cameras and all views (see step eight
of your calibration mode for further details). Clicking on any of those sets
let you review all images in the data viewer on the right side of the project
manager.
Click on the calibration entry itself to show the parameters of the dewarping
function including the RMS of the fit to check the quality of the mapping
function fit. This check up is only supported for calibration sets created with
Davis 7.1 !
Every time you do a new calibration, import a new calibration or change
the current one the previously active calibration is automatically stored in the
Calibration History folder and given a postfix to its name which holds date and
time of the storage. All of the checking described above (clicking on camera1
. . . camera6, corrected and Calibration set itself) can be done one those
stored calibrations as well to compare different calibrations made.
Click on the Properties folder with the right mouse button or on any Calibration (active or in the Calibration History) to open a context menu (see
following screenshot) with the following entries:
13

2 Calibration wizard dialog

Import a new calibration from outside the project (when chosen on


Properties folder) or Import the selected in the Calibration History
folder and make it the active calibration (when chosen on a calibration
set in Calibration History)
Copy the current calibration to Calibration History
Export selected calibration to your hard disk outside the project
Delete selected calibration (not possible for the active calibration !)
Apply the active calibration to all recordings
Rename selected calibration (not possible for the active calibration !)

2.2

Choose your calibration mode

After you enter the dialog a number of different calibration modes can be
selected: For some systems it is sufficient to specify the scaling of camera
pixel / mm without taking further distortions into account. Other systems
require the calculation of a dewarping function to map of camera images to
a undistorted world coordinate system. Stereo PIV or StrainMaster 3D for
example need the mapping of two cameras to a common coordinate system to
be able to calculate 3D component vectors.
To make the dialog as easy as possible for a basic experiment and still provide
all the functionality needed for complex setups you first have to define what
kind of experiment you are doing. This selection will limit the dialog items /
necessary steps to the ones you will need. The choices are the following:

14

2.2 Choose your calibration mode

define origin, maintain calibration Choose this option if you have already done a calibration but your are not happy with the origin of the
coordinate system. You can adapt the origin without changing the image
dewarping.
define scale, no image distortion Choose this option if you do not need
image dewarping because you do not have perspective projection errors
an small camera lens errors. You specify two points in the image and
the distance in mm between them or enter the pixel / mm ratio directly.
In either case any previously defined image dewarping function will be
overwritten and reset to no dewarping.
1 camera ( 2D ) Choose this option if you just want to calibrate one camera
to correct image distortions due to perspective projection and/or camera
lens errors. A dewarping function is calculated based on an image of
a calibration plate (which LaVision usually provides with your system)
with a regular grid of marks on it.
2 cameras (independent 2D+2D) Choose this option if you just want to
calibrate two independent cameras to correct image distortions due to
perspective projection and/or camera lens errors. A dewarping function
is calculated based on an image of a calibration plate (which LaVision
usually provides with your system) with a regular grid of marks on it.
The two resulting mapping functions are not mapped onto each other
and may have different scalings pixel/mm. So choose this if you either
look at different places of your sample (side-to-side) or if you use different
zoom factors (nested images).
2 cameras (mapped, e.g. stereo ) Choose this option if you just want to
calibrate two mapped cameras looking at the same place to correct image
distortions due to perspective projection and/or camera lens errors. A
dewarping function is calculated based on an image of a calibration plate
(which LaVision usually provides with your system) with a regular grid
of marks on it. In contrast to the previous choice the resulting mapping
functions are mapped onto each other and have the same scalings. Image
points for z=0 fall exactly into the same pixel location in the dewarped
images of both cameras. So choose this if you have a stereo system (e.g.
Stereo PIV, StrainMaster 3D, SurfaceFlow) or locked signals from two
different cameras (e.g. PIV-LIF) that you want to combine afterward.
Also the image stitching routine requires a common pixel/mm scale. to
fit overlapping camera images together.
15

2 Calibration wizard dialog

advanced settings Choose this option if you have a more complex experimental setup (e.g. if you want to calibrate more than two cameras like in
a 2x Stereo PIV system or Stereo PIV-LIF experiment) or if you want a
non standard calibration using cameras other than camera 1 and camera
2.
The following sections provide a step by step walkthrough for all these different
cases.

16

2.3 Walkthrough : define scale, no image distortion

2.3

Walkthrough : define scale, no image distortion

You should use this option if you have (almost) no perspective or camera lens
distortions and a simple pixel/mm scaling is sufficient.

2.3.1

Step 1 : Define experimental setup

To do this kind of calibration you should select the second option - see left
screenshot below.
The list of available step then indicates that the total calibration process consists of two steps - see right screenshot below:

To proceed to the second step either press the next step button in the tool
bar or press the second button in the list of available steps You are here:

2.3.2

Step 2 : Define scale / no image distortion

When you enter the second step the dialog looks like either of the two following
screenshots depending on whether the Maximize button has been pressed or
not see images shown aside.

17

2 Calibration wizard dialog

The goal of the current step is to define conveniently the pixel / mm scale of
the image leaving any distortion untouched. This dialog requires two different
actions:
1. image acquisition or import
2. the interactive definition of the pixel / mm scale by entering numbers
directly or by definition with mouse clicks into the image.
Image acquisition
For the image acquisition you can take a new image directly from the cameras
that are currently connected to your system. To do this press the Take image
or the Grab button in the dialog.
This takes one image of the cameras that are selected in the general device
interface GDI to its right (only visible in the minimized images, maximized
dialog setting - see above). In the GDI you also set up the exposure times,
external trigger, (laser) light sources, step motor positions and other hardware
settings important to your image acquisition.
Changing the average value in the text box on the left to any other value than
1 will result in the averaging of the specified number of images to improve
image quality due to poor lighting conditions. Please make sure that neither
the camera nor the calibration sample is moving !
Import
Another option is to import one or more previously recorded files from your
hard disk by pressing the Load button. You can either load single images or
whole (Davis) sets. This opens a modal dialog that shows a preview of the
image in question (see screenshot below).

18

2.3 Walkthrough : define scale, no image distortion

Here you specify which of the image frames you want to import. For images
originating from Davis you can leave the check box that follows unchecked and
read out the default camera number that is stored in each image (and shown
for the current image). For imported bitmaps (.bmp or .tif files) you have
to specify to which camera the image corresponds. If want to overwrite the
stored camera number you can also specify another (wrong) camera number.
The selection box will turn red (instead of green) to warn you that the program
recognized a discrepancy - so you should really know what you are doing.
Furthermore you need to specify if you want to append the selected file /
files to your selection of images, replace previously imported frames for the
selected camera number or start all over deleting any previously present images
and replace all images with the selected image(s) by the new selection.
Definition of pixel/mm scaling
To define the pixel/mm scale you have two options: either you scale the image interactively using the mouse (see left button shown below) or you enter
numbers directly to define the scale (see right button shown below).

After clicking on the left button in the Instruction group instructions are
given what to do: click on a first then on a second reference point in the
image. After doing so the following dialog will open:

The dialog consists of three parts:


the top group box shows the clicked pixel coordinates.
the center group box let you choose if you are going to specify just horizontal the distance between the two points, just the vertical distance or
the (diagonal) point to point distance in mm.
19

2 Calibration wizard dialog

the bottom group box contains the text field to enter the (known) distance in mm.
After pressing the return key or OK the pixel / mm scaling is calculated and
any present dewarping function is reset to unity (no dewarping).
In any case the first point you clicked will become the new origin of the coordinate system or (if you happen to do so in the Options box) the specified
reference coordinate point.
If on the other hand you select the right Scale button a dialog appears where
you can define the scaling directly:

Either you already know the pixel / mm scale or you give the position of two
reference points and the point to point distance in mm between them.
Again after accepting the new scale any previously defined image dewarping
function will be reset to no dewarping.
Definition of new origin / reference point
If you are happy with the scaling but not with the origin after such a scale
definition, you can redefine a new origin for the (already scaled) image or set
the value of any other reference point (not necessarily the origin).

Clicking into the image interactively using the mouse is done by clicking on the
left button shown above and following the instructions: click into the image to
specify the new origin / reference point.
Or you can enter numbers directly to define the position and coordinates in
the image of the new origin / reference point by clicking on the right button
shown above. This opens the dialog where you specify a pixel position and the
(new) corresponding mm coordinates.
20

2.3 Walkthrough : define scale, no image distortion

After either of the two procedures the pixel / mm scaling is maintained and
only the new origin / reference point reset to the new value. Any present
dewarping function is set to unity (no dewarping).
Reset calibration to pixel scaling
To just switch back to no scaling at all and delete all previous settings press
the Reset button. This will reset the pixel/mm scaling as well as any present
dewarping function and sets the origin to the upper left (default).

When you are content with the achieved calibration press the Finish button
in the tool bar (see image aside) to accept the calibration (image dewarping
function + pixel/mm scaling) which might then be written to your project.
The following dialog opens :

Select the first choice to open a new project with the new calibration
leaving the current project untouched.
Select the second option to overwrite the calibration of the currently active project - be aware that previously recorded images and their derived
results might not be consistent with results that will be calculated with
the new calibration.
21

2 Calibration wizard dialog

Select the third choice to overwrite the calibration of the currently active project and scale all previous recordings present in the root level of
your project to be consistent with the new calibration - be aware that results that have been derived before the changed calibration might not be
consistent with results that will be calculated with the new calibration.
Select the fourth choice if you want to discard everything you have done in
the calibration wizard. Then the old calibration active when you entered
the calibration wizard will be restored. Note that you might have to do
the whole calibration procedure again.
The calibration wizard dialog will close and you return to the project manager.

22

2.4 Walkthrough : 1 camera system (2D)

2.4
2.4.1

Walkthrough : 1 camera system (2D)


Step 1 : Define experimental setup

To do this kind of calibration you should select the third option - see left
screenshot below.
The list of available step then indicates that the total calibration process consists of eight steps - see right screenshot below:

To proceed to the second step either press the next step button in the tool
bar or press the second button in the list of available steps You are here:

2.4.2

Step 2 : Define coordinate system

When you enter the second step the dialog looks like the following screenshot:

In this step you define your coordinate system and the number of views you
provide for your calibration plate in different places to calculate the image
dewarping function.
On the right side in Coordinate system axis orientation you select if you
want a right handed coordinate system (z-axis orientated toward you when
you look at the images) or a left handed coordinate system (z-axis pointing
away from you).
23

2 Calibration wizard dialog

On the left side you specify the number of views you will provide for the
camera defined in this coordinate system. Although in general one view is
enough to find a dewarping function to correct all distortions in your camera
images providing several views makes the result more accurate. In any case
the x yplane (and hence the z-axis ) is always defined by the orientation
of calibration plate of the first view.
In case you want to provide several views you have to specify if they are
coplanar (that is aligned in parallel among them) and if they are placed at
equidistant z- positions. Please be aware that some kind of mapping functions
require coplanar views. In case you have equidistant views you have to specify
the distance dz between two neighbor views.
Below you will find a table with the required and recommended number of
views for your experiment. Depending on the combination of the dewarping
mapping function type, your calibration plate type (2D or 3D) and the number
of mapped cameras in your coordinate system you have different limitations
and recommendations:
System type

Mapping model
for dewarping

1 camera

polynomial
or pinhole

Required
] of views
1

Recommended
] of views
1

Limitations from your experiment might force you to make special choices:
You might be forced to use a 2D calibration plate because no 3D calibration plate is available (e.g. for a microscope).
Looking through a non planar glass window which adds non radial distortions to your images might force you to use polynomial mapping as
the pinhole model does not work well in those conditions.
The measurement itself in most Davis packages implies that the sample is
located at the z = 0 mm position. If you cannot place the calibration plate at
that position you can perform the calibration in front or behind that position.
This can be done only for a pinhole calibration or for a polynomial calibration
with two or more coplanar views. To use this feature please check the option
first view not at origin and specify the z-position of the first view. The
calibration process will then take this offset into account. In any case the
coordinate system is set up so that the calibration plate position of the first
view defines the x y-plane orientation (and hence the z-axis ). To proceed
to the third step either press the next step button in the tool bar or press
the third button in the list of available steps You are here:
24

2.4 Walkthrough : 1 camera system (2D)

2.4.3

Step 3 : Select used calibration plate

When you enter the third step the dialog looks like the following screenshot:

In this step you specify which calibration plate you are using. If you use a
calibration plate from LaVision it is enough to select the plate type labeled
on the plate e.g. Type ]10. This will set all plate parameters to the correct
values (see first screenshot above).
In case you want to use your own calibration plate you have to provide a number
of parameters (see second screenshot above): On the left side in Calibration
plate used you define the calibration type:
calibration plate contains marks in form of crosses or dots. Both black
marks on white background and white marks on black background are
supported and identified automatically.
calibration plate has only 1 plane = type 2D or is a two level plate =
type 3D.
On the right side in Calibration plate parameters you define several of its
parameters (dimension and sizes):
25

2 Calibration wizard dialog

distance between neighbor marks in one plane in mm


size of a single marks in mm
distance dz from plane to plane in mm (for 3D plates only)
To proceed to the fourth step either press the next step button in the tool
bar or press the fourth button in the list of available steps You are here:

2.4.4

Step 4 : Image acquisition

When you enter the fourth step the dialog looks like either of the two following
screenshots depending on whether the Maximize button has been pressed or
not see images shown aside.

In the fourth step you acquire the necessary images of the calibration plate for
all cameras and all views - only then you are allowed to proceed to the next
steps.
For the image acquisition you can take a new image directly from the cameras
that are currently connected to your system. To do this press the Take image
or the Grab button in the dialog.
This takes one image (or in case of Grab continuously images until you press
the stop button in the toolbar or hit the ESC key) of the cameras that are
selected in the dialog for the specified view (check box on). For views that
already contain non empty images the selection box entries are marked with
(ok). If a camera contains valid images for all views the selection box for the
view selection becomes green. If all view entries of all coordinate systems are
green then the next step button will be enabled. Pressing the button with
the red cross will delete the camera image of the selected view.
26

2.4 Walkthrough : 1 camera system (2D)

In the general device interface GDI to its right (only visible in the minimized images, maximized dialog setting - see above) you can set up the exposure times, external trigger, (laser) light sources, step motor positions and
other hardware settings important to your image acquisition.
Changing the average value in the text box on the left to any other value than
1 will result in the averaging of the specified number of images to improve
image quality due to poor lighting conditions. Please make sure that neither
the camera nor the calibration sample is moving !
Another option is to import one or more previously recorded files from your
hard disk by pressing the Load button. You can either load single images or
whole (Davis) sets. This opens a modal dialog that shows a preview of the
image in question (see screenshot below).

Here you specify which of the image frames you want to import. For images
originating from Davis you can leave the check box that follows unchecked and
read out the default camera number that is stored in each image (and shown
for the current image). For imported bitmaps (.bmp or .tif files) you have
to specify to which camera the image corresponds. If want to overwrite the
stored camera number you can also specify another (wrong) camera number.
The selection box will turn red (instead of green) to warn you that the program
recognized a discrepancy - so you should really know what you are doing.
In case you want to load several images at once from an image set you need
to specify which images of a set you want to import (start and end image
number and an increment) and specify the start view to which the images are
added. If during the import more than one image for a camera is found it will
automatically add it to the next view. If all views hold valid camera images
the import stops automatically.
This is a the recommended way to import old calibration images from an old
calibration.set created by Davis 6.2 or Davis 7.0 into the new format.
27

2 Calibration wizard dialog

To proceed to the fifth step either press the next step button in the tool bar
or press the fifth button in the list of available steps You are here:

2.4.5

Step 5 : Mark definition

When you enter the fifth step the dialog looks like the following screenshot:

In the fifth step you define three start marks for the mark search. To start the
process you can either
click All cameras/views which automatically will show you the images
for all camera / view combinations one after another to (re)define the
start marks for all those combination or
you press Shown camera/views to (re)define the start marks in the
currently visible image in the working window or
you press a table entry in the table to the right corresponding to a
camera / view combination to (re)define the start marks for that combination.
When you do any of this instructions will appear in the Instructions field of
the dialog to guide you to the clicking process. First you have to click a start
reference mark which must be the same physical mark in all cameras and all
views ! Then you are asked to click the neighbor mark to the right (to the
left if the camera is looking onto the backside of the calibration plate) and at
last the mark to the top of the first mark you selected. Important: please
make sure that the marks you select are located on the front plane of a 3D
calibration plate ! If you clicked all 3 marks successfully the table entry for
that camera/view combination will show an okay.
You may stop the clicking process any time pressing the Stop button in the
tool bar or by pressing the ESC key on your keyboard which will abort all
further actions.
If you have defined start marks successfully on all images (all table entries show
an okay) you may proceed to the next step. To proceed to the sixth step
28

2.4 Walkthrough : 1 camera system (2D)

either press the next step button in the tool bar or press the sixth button in
the list of available steps You are here:

2.4.6

Step 6 : Finding all marks

When you enter the sixth step the dialog looks like the following screenshot:

In the sixth step you let the program find all other marks for you. This is
an automatic process and requires no user interaction. Just press the button
Start search. Depending on the image quality and the speed of your computer
this might require several minutes, but you should see a screen update once
in a while. Usually it is enough if 20-30 marks could be identified. Please be
aware that due to the nature of the dewarping functions for a polynomial fit
marks have to be found everywhere in the image where you want to derive
result later, for pinhole calibration it is enough if only parts of the image are
covered with found marks.
In case you are not satisfied with the mark search quality you can enhance the
search changing some parameters. First you should check if you selected the
correct calibration plate type (2D or 3D) and the correct mark type (crosses
or dots).
If you think that some marks have not been found that should not pose a
problem for the mark search process you can adapt the search parameters in
the dialog accessible by pressing the button Mark search parameter....

29

2 Calibration wizard dialog

In this dialog (see screenshot above) you can choose in use preset values
your impression of the image quality and ask to find more or less marks with
the slider. On these assumptions the general search parameters are changed.
In advanced settings you might change these values one by one although
this is only advisable for expert users as there are many dependences among
some parameters.
If you think that too many marks have been found e.g. due to reflexes outside
the calibration plate you can eliminate them one by one pressing the button
Delete single mark where you can click iteratively on all marks that you
think should be deleted from the list of found marks (might take a while).
Just click repeatedly very close to the center of a found mark and wait to see
the mark disappear from the display. Then either go on clicking the next mark
or press the Space bar to end this procedure.
Another way to limit the mark search is to limit the search are in the first
place. You add a masked area by pressing the red or the blue button polygon
button of Limit search using a mask. In the Status text there are some
instructions how to proceed. You can click various times to define the angles
of a polygon. Pressing the key d deletes the last point(s) repeatedly, q aborts
the whole process and c closes the polygon and accepts the mask. Using the
blue button enables all pixels inside the polygon masking out all pixels outside,
the red polygon does it the other way round. With the button showing the red
cross you delete the mask from the current camera / view selection.
Please note that a mask is defined for the currently visible image only and that
you can use different masks for images of other camera / view combinations.
In the table to the right the number of marks found in each image is shown.
In case the calibration plate has 2 planes (3D plate) the number of marks for
each plane is shown separately with the plus sign (+). When marks have been
found in all images the next button is enabled and you may proceed to the
next step.
To proceed to the seventh step either press the next step
button in the tool bar or press the seventh button in the list of available steps
You are here:

2.4.7

Step 7 : Fit mapping function

When you enter the seventh step the dialog looks like the following screenshot:
30

2.4 Walkthrough : 1 camera system (2D)

In the seventh step you fit the dewarping mapping function to the marks
found in each image. You can select between pinhole calibration and polygon
calibration. Please note that in case you have more than one view and these
are not coplanar or equidistant the polynomial calibration is not available.
To start the calculation process press the button Start calibration. The
calibration process is automatic and requires no user interaction. The average
deviation of the dewarped mark positions to the ideal regular grid is shown in
the table to the right for each image. A value lower than 1 pixel is good, a value
lower than 0.3 pixel is excellent, Values higher than 2 pixel are questionable.
Please check if you clicked the front plane of a 3D calibration plate as this
is a common source of error. You can check the result of the fit in detail by
pressing the button Show fit parameter... which opens either of the two
following dialogs depending on the kind of mapping function you selected.

In both cases you can check the size of the corrected image and the RMS
of the fit.
In case of the polynomial you can check the coefficients of the mapping function.
In case of the pinhole model you can check the physical parameters that describe your model and compare them to the real world parameters of your
experiment: focal length of your camera lens, distance Tz from camera to calibration plate. Rotation Rx and Ry around X and Y axis indicating the
angle at which the cameras see the calibration plate. All those parameters
31

2 Calibration wizard dialog

should coincide with your experimental setup fairly well. The first and second
radial distortion factors are the extra distortion that are produced by that term
at a distance of 500 pixel to the center of distortion. This center of distortion
is called the principle point as is located where the optical axis of the camera
lens meet the CCD chip of your camera if you use a Scheimpflug adapter
this might not be the center center of your CCD chip! The radial distortion
contribution is usually 1 pixel or below although this strongly depends on
the camera lens you use.
If you are not happy with the fit you can adapt some general parameters of
the fit by pressing the button Fit parameters (pinhole model fit only !). It
will open the following dialog:

Here you can select which parameters should be fitted and which are just set
to fixed (known) values. Switching to default fit will reset all parameters to
their standard values and should work for most purposes (fixing the principle
point to the center of the camera CCD chip and using squared pixels, fitting
the rest starting the fit with focal length of 50 mm and distance Tz of
500 mm).
If you are not happy with this preselection or if you are using a Scheimpflug
adapter (and the assumption that the principle point is at the center of the
CCD chip is not true) you should switch to expert fit. Here you specify for
all cameras used in that coordinate system if you want to fit the focal length
or use a fixed value. In the first case the value is used as a start value for the
fit: the closer you can guess the focal length the easier it will be for the fitting
algorithm.
32

2.4 Walkthrough : 1 camera system (2D)

Furthermore it will help the algorithm if you can provide the rough distance of
camera to calibration plate in mm along the viewing direction of the camera.
At last you specify if your cameras are using a Scheimpflug adapter on your
cameras.
If your cameras have non square pixels you can check that option , but this is
NEVER the case with the cameras LaVision provides and should be switched
on only if you imported images from other cameras. There is the rare case
where additional distortions looking through a glass window can be corrected
by switching on this option. If in doubt you may contact LaVision to advise
you. Usually additional distortions by the optical access to your experiment
strongly suggests to use the polynomial fit.
Then you may switch between various levels of radial distortions which will
switch on the fit of first and second order terms describing radial distortions.
If you have done the fit for all cameras (and coordinate systems) you may
proceed to the last step.
To proceed to the last step either press the next
step button in the tool bar or press the last button in the list of available steps
You are here:

2.4.8

Step 8 : Evaluation of corrected images

When you enter the eighth step the dialog looks like the following screenshot:

In this last step you can evaluate visually your fit results. For that purpose all
camera / view combinations are dewarped - for 3D calibration plates even for
both z positions of the upper and the lower plane. Then also images are created
where the corrected images of all cameras and all views of a coordinate system
are overlayed (summed up) to see if indeed all corrected images coincide. In
addition a grid of the ideal regular grid of marks is overlayed. Here you can
check:
in single camera images if the marks fall to the ideal regular grid
if the marks in the summed up images of different cameras (and one
view) coincide for z=0 mm position
33

2 Calibration wizard dialog

if the marks in the summed up images of different views for one camera
coincide for z=0 mm position
if the marks in the summed up images of all views for all camera coincide
for z=0 mm position
In case you use a 3D calibration plate you can check furthermore:
all of the above for the position of the second plane in case you use a 3D
calibration plate
in case you use more than one camera you can check by how much a
wrong z position will move the corrected images apart. In detail: correcting for the position of the upper plane (z=0) to make the marks of
the upper plane coincide will produce ghost images for the marks in the
lower plane (e.g. at z=1 mm) due to the perspective parallax. This gives
you a direct information of the 3D resolution of a stereoscopic system.
Lets say the ghost images are 6 pixel apart. Then the vector calculation
(which can resolve 0.05 pixel shifts on the CCD images) will detect a
true shift of 1 mm /6 pixel = x mm / 0.05 pixel x = ca. 8 m
in z-direction in this experiment. You can increase this resolution by
increasing the angular separation of your system.
Changing the selection boxed for camera, view and plane (if you have used a
3D calibration plate) shows the corresponding corrected images for evaluation.
The table Fit results to the right summarizes the most important fit parameter. For a more detailed overview of the fit result you can click the button
Show all fit parameter... which opens either of the two following dialogs
which are described in detail in the section above - so please refer to the descriptions in step 7.

34

2.4 Walkthrough : 1 camera system (2D)

2.4.9

Finish calibration

When you are content with the achieved calibration press the Finish button
in the tool bar (see image aside) to accept the calibration (image dewarping
function + pixel/mm scaling) which might then be written to your project.
The following dialog opens :

Select the first choice to open a new project with the new calibration
leaving the current project untouched.
Select the second option to overwrite the calibration of the currently active project - be aware that previously recorded images and their derived
results might not be consistent with results that will be calculated with
the new calibration.
Select the third choice to overwrite the calibration of the currently active project and scale all previous recordings present in the root level of
your project to be consistent with the new calibration - be aware that results that have been derived before the changed calibration might not be
consistent with results that will be calculated with the new calibration.
Select the fourth choice if you want to discard everything you have done in
the calibration wizard. Then the old calibration active when you entered
the calibration wizard will be restored. Note that you might have to do
the whole calibration procedure again.
The calibration wizard dialog will close and you return to the project manager.

35

2 Calibration wizard dialog

2.5

2.5.1

Walkthrough : 2 cameras system (independent


2D+2D)
Step 1 : Define experimental setup

To do this kind of calibration you should select the fourth option - see left
screenshot below.
The list of available step then indicates that the total calibration process consists of eight steps - see right screenshot below:

To proceed to the second step either press the next step button in the tool
bar or press the second button in the list of available steps You are here:

2.5.2

Step 2 : Define coordinate system

When you enter the second step the dialog looks like the following screenshot:

In this step you define your coordinate system and the number of views you
provide for your calibration plate in different places to calculate the image
dewarping function.
You have to do this for all coordinate systems. You change to set up another
coordinate system clicking on the card item labeled Coordinate system 1
to Coordinate system 6 depending on what coordinate systems are used.
36

2.5 Walkthrough : 2 cameras system (independent 2D+2D)

All settings are made independently so you do not have to define them all the
same.
On the right side in Coordinate system axis orientation you select if you
want a right handed coordinate system (z-axis orientated toward you when
you look at the images) or a left handed coordinate system (z-axis pointing
away from you).
On the left side you specify the number of views you will provide for the
camera defined in this coordinate system. Although in general one view is
enough to find a dewarping function to correct all distortions in your camera
images providing several views makes the result more accurate. In any case
the x yplane (and hence the z-axis ) is always defined by the orientation
of calibration plate of the first view.
In case you want to provide several views you have to specify if they are
coplanar (that is aligned in parallel among them) and if they are placed at
equidistant z- positions. Please be aware that some kind of mapping functions
require coplanar views. In case you have equidistant views you have to specify
the distance dz between two neighbor views.
Below you will find a table with the required and recommended number of
views for your experiment. Depending on the combination of the dewarping
mapping function type, your calibration plate type (2D or 3D) and the number
of mapped cameras in your coordinate system you have different limitations
and recommendations:
System type

Mapping model
for dewarping

cameras not mapped


(independent 2D)

polynomial
or pinhole

Required
] of views
1

Recommended
] of views
1

Limitations from your experiment might force you to make special choices:
You might be forced to use a 2D calibration plate because no 3D calibration plate is available (e.g. for a microscope).
Looking through a non planar glass window which adds non radial distortions to your images might force you to use polynomial mapping as
the pinhole model does not work well in those conditions.
The measurement itself in most Davis packages implies that the sample is
located at the z = 0 mm position. If you cannot place the calibration plate at
that position you can perform the calibration in front or behind that position.
This can be done only for a pinhole calibration or for a polynomial calibration
37

2 Calibration wizard dialog

with two or more coplanar views. To use this feature please check the option
first view not at origin and specify the z-position of the first view. The
calibration process will then take this offset into account. In any case the
coordinate system is set up so that the calibration plate position of the first
view defines the x y-plane orientation (and hence the z-axis ). To proceed
to the third step either press the next step button in the tool bar or press
the third button in the list of available steps You are here:

2.5.3

Step 3 : Select used calibration plate(s)

When you enter the third step the dialog looks like the following screenshot:

In this step you specify which calibration plate you are using. If you use a
calibration plate from LaVision it is enough to select the plate type labeled
on the plate e.g. Type ]10. This will set all plate parameters to the correct
values (see first screenshot above).
In case you want to use your own calibration plate you have to provide a number
of parameters (see second screenshot above): On the left side in Calibration
plate used you define the calibration type:
38

2.5 Walkthrough : 2 cameras system (independent 2D+2D)

calibration plate contains marks in form of crosses or dots. Both black


marks on white background and white marks on black background are
supported and identified automatically.
calibration plate has only 1 plane = type 2D or is a two level plate =
type 3D.
On the right side in Calibration plate parameters you define several of its
parameters (dimension and sizes):
distance between neighbor marks in one plane in mm
size of a single marks in mm
distance dz from plane to plane in mm (for 3D plates only)
To proceed to the fourth step either press the next step button in the tool
bar or press the fourth button in the list of available steps You are here:

2.5.4

Step 4 : Image acquisition

When you enter the fourth step the dialog looks like either of the two following
screenshots depending on whether the Maximize button has been pressed or
not see images shown aside.

In the fourth step you acquire the necessary images of the calibration plate for
all cameras and all views - only then you are allowed to proceed to the next
steps.
For the image acquisition you can take a new image directly from the cameras
that are currently connected to your system. To do this press the Take image
or the Grab button in the dialog.
39

2 Calibration wizard dialog

This takes one image (or in case of Grab continuously images until you press
the stop button in the toolbar or hit the ESC key) of the cameras that are
selected in the dialog for the specified view (check box on). For views that
already contain non empty images the selection box entries are marked with
(ok). If a camera contains valid images for all views the selection box for the
view selection becomes green. If all view entries of all coordinate systems are
green then the next step button will be enabled. Pressing the button with
the red cross will delete the camera image of the selected view.
In the general device interface GDI to its right (only visible in the minimized images, maximized dialog setting - see above) you can set up the exposure times, external trigger, (laser) light sources, step motor positions and
other hardware settings important to your image acquisition.
Changing the average value in the text box on the left to any other value than
1 will result in the averaging of the specified number of images to improve
image quality due to poor lighting conditions. Please make sure that neither
the camera nor the calibration sample is moving !
Another option is to import one or more previously recorded files from your
hard disk by pressing the Load button. You can either load single images or
whole (Davis) sets. This opens a modal dialog that shows a preview of the
image in question (see screenshot below).

Here you specify which of the image frames you want to import. For images
originating from Davis you can leave the check box that follows unchecked and
read out the default camera number that is stored in each image (and shown
for the current image). For imported bitmaps (.bmp or .tif files) you have
to specify to which camera the image corresponds. If want to overwrite the
stored camera number you can also specify another (wrong) camera number.
The selection box will turn red (instead of green) to warn you that the program
recognized a discrepancy - so you should really know what you are doing.
40

2.5 Walkthrough : 2 cameras system (independent 2D+2D)

In case you want to load several images at once from an image set you need
to specify which images of a set you want to import (start and end image
number and an increment) and specify the start view to which the images are
added. If during the import more than one image for a camera is found it will
automatically add it to the next view. If all views hold valid camera images
the import stops automatically.
This is a the recommended way to import old calibration images from an old
calibration.set created by Davis 6.2 or Davis 7.0 into the new format.
To proceed to the fifth step either press the next step button in the tool bar
or press the fifth button in the list of available steps You are here:

2.5.5

Step 5 : Mark definition

When you enter the fifth step the dialog looks like the following screenshot:

In the fifth step you define three start marks for the mark search. To start the
process you can either
click All cameras/views which automatically will show you the images
for all camera / view combinations one after another to (re)define the
start marks for all those combination or
you press Shown camera/views to (re)define the start marks in the
currently visible image in the working window or
you press a table entry in the table to the right corresponding to a
camera / view combination to (re)define the start marks for that combination.
When you do any of this instructions will appear in the Instructions field of
the dialog to guide you to the clicking process. First you have to click a start
reference mark which must be the same physical mark in all cameras and all
views ! Then you are asked to click the neighbor mark to the right (to the
left if the camera is looking onto the backside of the calibration plate) and at
last the mark to the top of the first mark you selected. Important: please
41

2 Calibration wizard dialog

make sure that the marks you select are located on the front plane of a 3D
calibration plate ! If you clicked all 3 marks successfully the table entry for
that camera/view combination will show an okay.
You may stop the clicking process any time pressing the Stop button in the
tool bar or by pressing the ESC key on your keyboard which will abort all
further actions.
If you have defined start marks successfully on all images (all table entries show
an okay) you may proceed to the next step. To proceed to the sixth step
either press the next step button in the tool bar or press the sixth button in
the list of available steps You are here:

2.5.6

Step 6 : Finding all marks

When you enter the sixth step the dialog looks like the following screenshot:

In the sixth step you let the program find all other marks for you. This is
an automatic process and requires no user interaction. Just press the button
Start search. Depending on the image quality and the speed of your computer
this might require several minutes, but you should see a screen update once
in a while. Usually it is enough if 20-30 marks could be identified. Please be
aware that due to the nature of the dewarping functions for a polynomial fit
marks have to be found everywhere in the image where you want to derive
result later, for pinhole calibration it is enough if only parts of the image are
covered with found marks.
In case you are not satisfied with the mark search quality you can enhance the
search changing some parameters. First you should check if you selected the
correct calibration plate type (2D or 3D) and the correct mark type (crosses
or dots).
If you think that some marks have not been found that should not pose a
problem for the mark search process you can adapt the search parameters in
the dialog accessible by pressing the button Mark search parameter....
42

2.5 Walkthrough : 2 cameras system (independent 2D+2D)

In this dialog (see screenshot above) you can choose in use preset values
your impression of the image quality and ask to find more or less marks with
the slider. On these assumptions the general search parameters are changed.
In advanced settings you might change these values one by one although
this is only advisable for expert users as there are many dependences among
some parameters.
If you think that too many marks have been found e.g. due to reflexes outside
the calibration plate you can eliminate them one by one pressing the button
Delete single mark where you can click iteratively on all marks that you
think should be deleted from the list of found marks (might take a while).
Just click repeatedly very close to the center of a found mark and wait to see
the mark disappear from the display. Then either go on clicking the next mark
or press the Space bar to end this procedure.
Another way to limit the mark search is to limit the search are in the first
place. You add a masked area by pressing the red or the blue button polygon
button of Limit search using a mask. In the Status text there are some
instructions how to proceed. You can click various times to define the angles
of a polygon. Pressing the key d deletes the last point(s) repeatedly, q aborts
the whole process and c closes the polygon and accepts the mask. Using the
blue button enables all pixels inside the polygon masking out all pixels outside,
the red polygon does it the other way round. With the button showing the red
cross you delete the mask from the current camera / view selection.
Please note that a mask is defined for the currently visible image only and that
you can use different masks for images of other camera / view combinations.
In the table to the right the number of marks found in each image is shown.
In case the calibration plate has 2 planes (3D plate) the number of marks for
each plane is shown separately with the plus sign (+). When marks have been
found in all images the next button is enabled and you may proceed to the
next step.
To proceed to the seventh step either press the next step
43

2 Calibration wizard dialog

button in the tool bar or press the seventh button in the list of available steps
You are here:

2.5.7

Step 7 : Fit mapping function

When you enter the seventh step the dialog looks like the following screenshot:

In the seventh step you fit the dewarping mapping function to the marks
found in each image. You can select between pinhole calibration and polygon
calibration. Please note that in case you have more than one view and these
are not coplanar or equidistant the polynomial calibration is not available.
To start the calculation process press the button Start calibration. The
calibration process is automatic and requires no user interaction. The average
deviation of the dewarped mark positions to the ideal regular grid is shown in
the table to the right for each image. A value lower than 1 pixel is good, a value
lower than 0.3 pixel is excellent, Values higher than 2 pixel are questionable.
Please check if you clicked the front plane of a 3D calibration plate as this
is a common source of error. You can check the result of the fit in detail by
pressing the button Show fit parameter... which opens either of the two
following dialogs depending on the kind of mapping function you selected.

In both cases you can check the size of the corrected image and the RMS
of the fit.
44

2.5 Walkthrough : 2 cameras system (independent 2D+2D)

In case of the polynomial you can check the coefficients of the mapping function.
In case of the pinhole model you can check the physical parameters that describe your model and compare them to the real world parameters of your
experiment: focal length of your camera lens, distance Tz from camera to calibration plate. Rotation Rx and Ry around X and Y axis indicating the
angle at which the cameras see the calibration plate. All those parameters
should coincide with your experimental setup fairly well. The first and second
radial distortion factors are the extra distortion that are produced by that term
at a distance of 500 pixel to the center of distortion. This center of distortion
is called the principle point as is located where the optical axis of the camera
lens meet the CCD chip of your camera if you use a Scheimpflug adapter
this might not be the center center of your CCD chip! The radial distortion
contribution is usually 1 pixel or below although this strongly depends on
the camera lens you use.
If you are not happy with the fit you can adapt some general parameters of
the fit by pressing the button Fit parameters (pinhole model fit only !). It
will open the following dialog:

Here you can select which parameters should be fitted and which are just set
to fixed (known) values. Switching to default fit will reset all parameters to
their standard values and should work for most purposes (fixing the principle
point to the center of the camera CCD chip and using squared pixels, fitting
the rest starting the fit with focal length of 50 mm and distance Tz of
500 mm).
45

2 Calibration wizard dialog

If you are not happy with this preselection or if you are using a Scheimpflug
adapter (and the assumption that the principle point is at the center of the
CCD chip is not true) you should switch to expert fit. Here you specify for
all cameras used in that coordinate system if you want to fit the focal length
or use a fixed value. In the first case the value is used as a start value for the
fit: the closer you can guess the focal length the easier it will be for the fitting
algorithm.
Furthermore it will help the algorithm if you can provide the rough distance of
camera to calibration plate in mm along the viewing direction of the camera.
At last you specify if your cameras are using a Scheimpflug adapter on your
cameras.
If your cameras have non square pixels you can check that option , but this is
NEVER the case with the cameras LaVision provides and should be switched
on only if you imported images from other cameras. There is the rare case
where additional distortions looking through a glass window can be corrected
by switching on this option. If in doubt you may contact LaVision to advise
you. Usually additional distortions by the optical access to your experiment
strongly suggests to use the polynomial fit.
Then you may switch between various levels of radial distortions which will
switch on the fit of first and second order terms describing radial distortions.
If you have done the fit for all cameras (and coordinate systems) you may
proceed to the last step.
To proceed to the last step either press the next
step button in the tool bar or press the last button in the list of available steps
You are here:

2.5.8

Step 8 : Evaluation of corrected images

When you enter the eighth step the dialog looks like the following screenshot:

In this last step you can evaluate visually your fit results. For that purpose all
camera / view combinations are dewarped - for 3D calibration plates even for
both z positions of the upper and the lower plane. Then also images are created
where the corrected images of all cameras and all views of a coordinate system
46

2.5 Walkthrough : 2 cameras system (independent 2D+2D)

are overlayed (summed up) to see if indeed all corrected images coincide. In
addition a grid of the ideal regular grid of marks is overlayed. Here you can
check:
in single camera images if the marks fall to the ideal regular grid
if the marks in the summed up images of different cameras (and one
view) coincide for z=0 mm position
if the marks in the summed up images of different views for one camera
coincide for z=0 mm position
if the marks in the summed up images of all views for all camera coincide
for z=0 mm position
In case you use a 3D calibration plate you can check furthermore:
all of the above for the position of the second plane in case you use a 3D
calibration plate
in case you use more than one camera you can check by how much a
wrong z position will move the corrected images apart. In detail: correcting for the position of the upper plane (z=0) to make the marks of
the upper plane coincide will produce ghost images for the marks in the
lower plane (e.g. at z=1 mm) due to the perspective parallax. This gives
you a direct information of the 3D resolution of a stereoscopic system.
Lets say the ghost images are 6 pixel apart. Then the vector calculation
(which can resolve 0.05 pixel shifts on the CCD images) will detect a
true shift of 1 mm /6 pixel = x mm / 0.05 pixel x = ca. 8 m
in z-direction in this experiment. You can increase this resolution by
increasing the angular separation of your system.
Changing the selection boxed for camera, view and plane (if you have used a
3D calibration plate) shows the corresponding corrected images for evaluation.
The table Fit results to the right summarizes the most important fit parameter. For a more detailed overview of the fit result you can click the button
Show all fit parameter... which opens either of the two following dialogs
which are described in detail in the section above - so please refer to the descriptions in step 7.
47

2 Calibration wizard dialog

2.5.9

Finish calibration

When you are content with the achieved calibration press the Finish button
in the tool bar (see image aside) to accept the calibration (image dewarping
function + pixel/mm scaling) which might then be written to your project.
The following dialog opens :

Select the first choice to open a new project with the new calibration
leaving the current project untouched.
Select the second option to overwrite the calibration of the currently active project - be aware that previously recorded images and their derived
results might not be consistent with results that will be calculated with
the new calibration.
Select the third choice to overwrite the calibration of the currently active project and scale all previous recordings present in the root level of
your project to be consistent with the new calibration - be aware that results that have been derived before the changed calibration might not be
consistent with results that will be calculated with the new calibration.
48

2.5 Walkthrough : 2 cameras system (independent 2D+2D)

Select the fourth choice if you want to discard everything you have done in
the calibration wizard. Then the old calibration active when you entered
the calibration wizard will be restored. Note that you might have to do
the whole calibration procedure again.
The calibration wizard dialog will close and you return to the project manager.

49

2 Calibration wizard dialog

2.6

2.6.1

Walkthrough : 2 cameras system (mapped, e.g.


stereo)
Step 1 : Define experimental setup

To do this kind of calibration you should select the fifth option - see left
screenshot below.
The list of available step then indicates that the total calibration process consists of eight steps - see right screenshot below:

To proceed to the second step either press the next step button in the tool
bar or press the second button in the list of available steps You are here:

2.6.2

Step 2 : Define coordinate system

When you enter the second step the dialog looks like the following screenshot:

In this step you define your coordinate system and the number of views you
provide for your calibration plate in different places to calculate the image
dewarping function.
On the right side in Coordinate system axis orientation you select if you
want a right handed coordinate system (z-axis orientated toward you when
50

2.6 Walkthrough : 2 cameras system (mapped, e.g. stereo)

you look at the images) or a left handed coordinate system (z-axis pointing
away from you).
On the left side you specify the number of views you will provide for all cameras
defined in this coordinate system ! For the N th view you have to provide images
for all involved cameras of the calibration plate in the same position. So either
take images simultaneously later or make sure that the calibration plate will
not move while you take separate images for all cameras. Although in general
one view is enough to find a dewarping function to correct all distortions in
your camera images providing several views makes the result more accurate.
In any case the x yplane (and hence the z-axis ) is always defined by the
orientation of calibration plate of the first view.
In case you want to provide several views you have to specify if they are
coplanar (that is aligned in parallel among them) and if they are placed at
equidistant z- positions. Please be aware that some kind of mapping functions
require coplanar views. In case you have equidistant views you have to specify
the distance dz between two neighbor views.
Below you will find a table with the required and recommended number of
views for your experiment. Depending on the combination of the dewarping
mapping function type, your calibration plate type (2D or 3D) and the number
of mapped cameras in your coordinate system you have different limitations
and recommendations:
System type

Mapping model
for dewarping

Required
] of views

Recommended
] of views

camera mapped (2D


measurements - e.g.
image stitching)

polynomial
or pinhole

camera
mapped
(stereo measurements
- e.g. 3D vectors)

polynomial

2 views must
be coplanar and
equidistant

camera
mapped
(stereo measurements
- e.g. 3D vectors)

pinhole model

2
(with
2D
plates views should
be coplanar and
equidistant

Limitations from your experiment might force you to make special choices:
You might be forced to use a 2D calibration plate because no 3D calibration plate is available (e.g. for a microscope).
51

2 Calibration wizard dialog

Looking through a non planar glass window which adds non radial distortions to your images might force you to use polynomial mapping as
the pinhole model does not work well in those conditions.

Stereo measurements (e.g. Stereo PIV) require a calibration for more


than one plane. So you would need a pinhole calibration or a polynomial
calibration using either a 3D calibration plate or two coplanar views of
a 2D plate.

Volume measurements (e.g. StrainMaster 3D and SurfaceFlow) require


a calibration for more than just the z = 0 mm plane. So you either must
use the pinhole model that by handles the mapping for every point in
space to the CCD chips. Or you need a polynomial mapping for at least
two (coplanar) views at different z-positions better is using a higher
number of planes that cover the whole volume you want to measure.

the use of the self calibration wizard (available in PIV projects) requires
the pinhole calibration. For more details please refer to the corresponding
chapter about self calibration.

The measurement itself in most Davis packages implies that the sample is
located at the z = 0 mm position. If you cannot place the calibration plate at
that position you can perform the calibration in front or behind that position.
This can be done only for a pinhole calibration or for a polynomial calibration
with two or more coplanar views. To use this feature please check the option
first view not at origin and specify the z-position of the first view. The
calibration process will then take this offset into account. In any case the
coordinate system is set up so that the calibration plate position of the first
view defines the x y-plane orientation (and hence the z-axis ). To proceed
to the third step either press the next step button in the tool bar or press
the third button in the list of available steps You are here:

2.6.3

Step 3 : Select used calibration plate

When you enter the third step the dialog looks like the following screenshot:
52

2.6 Walkthrough : 2 cameras system (mapped, e.g. stereo)

In this step you specify which calibration plate you are using. If you use a
calibration plate from LaVision it is enough to select the plate type labeled
on the plate e.g. Type ]10. This will set all plate parameters to the correct
values (see first screenshot above).
In case you want to use your own calibration plate you have to provide a number
of parameters (see second screenshot above): On the left side in Calibration
plate used you define the calibration type:
calibration plate contains marks in form of crosses or dots. Both black
marks on white background and white marks on black background are
supported and identified automatically.
calibration plate has only 1 plane = type 2D or is a two level plate =
type 3D.
On the right side in Calibration plate parameters you define several of its
parameters (dimension and sizes):
distance between neighbor marks in one plane in mm
53

2 Calibration wizard dialog

size of a single marks in mm


distance dz from plane to plane in mm (for 3D plates only)
For stereo camera systems or in case you map several cameras to a common
coordinate system you might look from two different sides to the calibration
plate (and the experiment, e.g. the particles illuminated by a laser sheet in
PIV). In case you do this you have to check the check box using both sides
of plate. In case you do so you have to add two more quantities:
The plate thickness from outer plane to outer plane
in case you have a 3D plate (with 2 planes build in on either side) you
have to specify if the groove on opposite sides are aligned (grooves on one
side meets groove on other side) or displaced (groove on one side meets
land on other side).
This information is then used to calculate the dewarping function taking the
extra shifts into account. To proceed to the fourth step either press the next
step button in the tool bar or press the fourth button in the list of available
steps You are here:

2.6.4

Step 4 : Image acquisition

When you enter the fourth step the dialog looks like either of the two following
screenshots depending on whether the Maximize button has been pressed or
not see images shown aside.

In the fourth step you acquire the necessary images of the calibration plate for
all cameras and all views - only then you are allowed to proceed to the next
steps.
54

2.6 Walkthrough : 2 cameras system (mapped, e.g. stereo)

For the image acquisition you can take a new image directly from the cameras
that are currently connected to your system. To do this press the Take image
or the Grab button in the dialog.
This takes one image (or in case of Grab continuously images until you press
the stop button in the toolbar or hit the ESC key) of the cameras that are
selected in the dialog for the specified view (check box on). For views that
already contain non empty images the selection box entries are marked with
(ok). If a camera contains valid images for all views the selection box for the
view selection becomes green. If all view entries of all coordinate systems are
green then the next step button will be enabled. Pressing the button with
the red cross will delete the camera image of the selected view.
In the general device interface GDI to its right (only visible in the minimized images, maximized dialog setting - see above) you can set up the exposure times, external trigger, (laser) light sources, step motor positions and
other hardware settings important to your image acquisition.
Changing the average value in the text box on the left to any other value than
1 will result in the averaging of the specified number of images to improve
image quality due to poor lighting conditions. Please make sure that neither
the camera nor the calibration sample is moving !
Another option is to import one or more previously recorded files from your
hard disk by pressing the Load button. You can either load single images or
whole (Davis) sets. This opens a modal dialog that shows a preview of the
image in question (see screenshot below).

Here you specify which of the image frames you want to import. For images
originating from Davis you can leave the check box that follows unchecked and
read out the default camera number that is stored in each image (and shown
for the current image). For imported bitmaps (.bmp or .tif files) you have
to specify to which camera the image corresponds. If want to overwrite the
55

2 Calibration wizard dialog

stored camera number you can also specify another (wrong) camera number.
The selection box will turn red (instead of green) to warn you that the program
recognized a discrepancy - so you should really know what you are doing.
In case you want to load several images at once from an image set you need
to specify which images of a set you want to import (start and end image
number and an increment) and specify the start view to which the images are
added. If during the import more than one image for a camera is found it will
automatically add it to the next view. If all views hold valid camera images
the import stops automatically.
This is a the recommended way to import old calibration images from an old
calibration.set created by Davis 6.2 or Davis 7.0 into the new format.
To proceed to the fifth step either press the next step button in the tool bar
or press the fifth button in the list of available steps You are here:

2.6.5

Step 5 : Mark definition

When you enter the fifth step the dialog looks like the following screenshot:

In the fifth step you define three start marks for the mark search. To start the
process you can either
click All cameras/views which automatically will show you the images
for all camera / view combinations one after another to (re)define the
start marks for all those combination or
you press Shown camera/views to (re)define the start marks in the
currently visible image in the working window or
you press a table entry in the table to the right corresponding to a
camera / view combination to (re)define the start marks for that combination.
When you do any of this instructions will appear in the Instructions field of
the dialog to guide you to the clicking process. First you have to click a start
reference mark which must be the same physical mark in all cameras and all
56

2.6 Walkthrough : 2 cameras system (mapped, e.g. stereo)

views ! Then you are asked to click the neighbor mark to the right (to the
left if the camera is looking onto the backside of the calibration plate) and at
last the mark to the top of the first mark you selected. Important: please
make sure that the marks you select are located on the front plane of a 3D
calibration plate ! If you clicked all 3 marks successfully the table entry for
that camera/view combination will show an okay.
You may stop the clicking process any time pressing the Stop button in the
tool bar or by pressing the ESC key on your keyboard which will abort all
further actions.
If you have defined start marks successfully on all images (all table entries show
an okay) you may proceed to the next step. To proceed to the sixth step
either press the next step button in the tool bar or press the sixth button in
the list of available steps You are here:

2.6.6

Step 6 : Finding all marks

When you enter the sixth step the dialog looks like the following screenshot:

In the sixth step you let the program find all other marks for you. This is
an automatic process and requires no user interaction. Just press the button
Start search. Depending on the image quality and the speed of your computer
this might require several minutes, but you should see a screen update once
in a while. Usually it is enough if 20-30 marks could be identified. Please be
aware that due to the nature of the dewarping functions for a polynomial fit
marks have to be found everywhere in the image where you want to derive
result later, for pinhole calibration it is enough if only parts of the image are
covered with found marks.
In case you are not satisfied with the mark search quality you can enhance the
search changing some parameters. First you should check if you selected the
correct calibration plate type (2D or 3D) and the correct mark type (crosses
or dots).
57

2 Calibration wizard dialog

If you think that some marks have not been found that should not pose a
problem for the mark search process you can adapt the search parameters in
the dialog accessible by pressing the button Mark search parameter....

In this dialog (see screenshot above) you can choose in use preset values
your impression of the image quality and ask to find more or less marks with
the slider. On these assumptions the general search parameters are changed.
In advanced settings you might change these values one by one although
this is only advisable for expert users as there are many dependences among
some parameters.
If you think that too many marks have been found e.g. due to reflexes outside
the calibration plate you can eliminate them one by one pressing the button
Delete single mark where you can click iteratively on all marks that you
think should be deleted from the list of found marks (might take a while).
Just click repeatedly very close to the center of a found mark and wait to see
the mark disappear from the display. Then either go on clicking the next mark
or press the Space bar to end this procedure.
Another way to limit the mark search is to limit the search are in the first
place. You add a masked area by pressing the red or the blue button polygon
button of Limit search using a mask. In the Status text there are some
instructions how to proceed. You can click various times to define the angles
of a polygon. Pressing the key d deletes the last point(s) repeatedly, q aborts
the whole process and c closes the polygon and accepts the mask. Using the
blue button enables all pixels inside the polygon masking out all pixels outside,
the red polygon does it the other way round. With the button showing the red
cross you delete the mask from the current camera / view selection.
Please note that a mask is defined for the currently visible image only and that
you can use different masks for images of other camera / view combinations.
In the table to the right the number of marks found in each image is shown.
In case the calibration plate has 2 planes (3D plate) the number of marks for
each plane is shown separately with the plus sign (+). When marks have been
58

2.6 Walkthrough : 2 cameras system (mapped, e.g. stereo)

found in all images the next button is enabled and you may proceed to the
next step.
To proceed to the seventh step either press the next step
button in the tool bar or press the seventh button in the list of available steps
You are here:

2.6.7

Step 7 : Fit mapping function

When you enter the seventh step the dialog looks like the following screenshot:

In the seventh step you fit the dewarping mapping function to the marks
found in each image. You can select between pinhole calibration and polygon
calibration. Please note that in case you have more than one view and these
are not coplanar or equidistant the polynomial calibration is not available.
To start the calculation process press the button Start calibration. The
calibration process is automatic and requires no user interaction. The average
deviation of the dewarped mark positions to the ideal regular grid is shown in
the table to the right for each image. A value lower than 1 pixel is good, a value
lower than 0.3 pixel is excellent, Values higher than 2 pixel are questionable.
Please check if you clicked the front plane of a 3D calibration plate as this
is a common source of error. You can check the result of the fit in detail by
pressing the button Show fit parameter... which opens either of the two
following dialogs depending on the kind of mapping function you selected.

59

2 Calibration wizard dialog

In both cases you can check the size of the corrected image and the RMS
of the fit.
In case of the polynomial you can check the coefficients of the mapping function.
In case of the pinhole model you can check the physical parameters that describe your model and compare them to the real world parameters of your
experiment: focal length of your camera lens, distance Tz from camera to calibration plate. Rotation Rx and Ry around X and Y axis indicating the
angle at which the cameras see the calibration plate. All those parameters
should coincide with your experimental setup fairly well. The first and second
radial distortion factors are the extra distortion that are produced by that term
at a distance of 500 pixel to the center of distortion. This center of distortion
is called the principle point as is located where the optical axis of the camera
lens meet the CCD chip of your camera if you use a Scheimpflug adapter
this might not be the center center of your CCD chip! The radial distortion
contribution is usually 1 pixel or below although this strongly depends on
the camera lens you use.
If you are not happy with the fit you can adapt some general parameters of
the fit by pressing the button Fit parameters (pinhole model fit only !). It
will open the following dialog:

Here you can select which parameters should be fitted and which are just set
to fixed (known) values. Switching to default fit will reset all parameters to
their standard values and should work for most purposes (fixing the principle
point to the center of the camera CCD chip and using squared pixels, fitting
60

2.6 Walkthrough : 2 cameras system (mapped, e.g. stereo)

the rest starting the fit with focal length of 50 mm and distance Tz of
500 mm).
If you are not happy with this preselection or if you are using a Scheimpflug
adapter (and the assumption that the principle point is at the center of the
CCD chip is not true) you should switch to expert fit. Here you specify for
all cameras used in that coordinate system if you want to fit the focal length
or use a fixed value. In the first case the value is used as a start value for the
fit: the closer you can guess the focal length the easier it will be for the fitting
algorithm.
Furthermore it will help the algorithm if you can provide the rough distance of
camera to calibration plate in mm along the viewing direction of the camera.
At last you specify if your cameras are using a Scheimpflug adapter on your
cameras.
If your cameras have non square pixels you can check that option , but this is
NEVER the case with the cameras LaVision provides and should be switched
on only if you imported images from other cameras. There is the rare case
where additional distortions looking through a glass window can be corrected
by switching on this option. If in doubt you may contact LaVision to advise
you. Usually additional distortions by the optical access to your experiment
strongly suggests to use the polynomial fit.
Then you may switch between various levels of radial distortions which will
switch on the fit of first and second order terms describing radial distortions.
If you have done the fit for all cameras (and coordinate systems) you may
proceed to the last step.
To proceed to the last step either press the next
step button in the tool bar or press the last button in the list of available steps
You are here:

2.6.8

Step 8 : Evaluation of corrected images

When you enter the eighth step the dialog looks like the following screenshot:

In this last step you can evaluate visually your fit results. For that purpose all
camera / view combinations are dewarped - for 3D calibration plates even for
61

2 Calibration wizard dialog

both z positions of the upper and the lower plane. Then also images are created
where the corrected images of all cameras and all views of a coordinate system
are overlayed (summed up) to see if indeed all corrected images coincide. In
addition a grid of the ideal regular grid of marks is overlayed. Here you can
check:
in single camera images if the marks fall to the ideal regular grid
if the marks in the summed up images of different cameras (and one
view) coincide for z=0 mm position
if the marks in the summed up images of different views for one camera
coincide for z=0 mm position
if the marks in the summed up images of all views for all camera coincide
for z=0 mm position
In case you use a 3D calibration plate you can check furthermore:
all of the above for the position of the second plane in case you use a 3D
calibration plate
in case you use more than one camera you can check by how much a
wrong z position will move the corrected images apart. In detail: correcting for the position of the upper plane (z=0) to make the marks of
the upper plane coincide will produce ghost images for the marks in the
lower plane (e.g. at z=1 mm) due to the perspective parallax. This gives
you a direct information of the 3D resolution of a stereoscopic system.
Lets say the ghost images are 6 pixel apart. Then the vector calculation
(which can resolve 0.05 pixel shifts on the CCD images) will detect a
true shift of 1 mm /6 pixel = x mm / 0.05 pixel x = ca. 8 m
in z-direction in this experiment. You can increase this resolution by
increasing the angular separation of your system.
Changing the selection boxed for camera, view and plane (if you have used a
3D calibration plate) shows the corresponding corrected images for evaluation.
The table Fit results to the right summarizes the most important fit parameter. For a more detailed overview of the fit result you can click the button
Show all fit parameter... which opens either of the two following dialogs
which are described in detail in the section above - so please refer to the descriptions in step 7.
62

2.6 Walkthrough : 2 cameras system (mapped, e.g. stereo)

2.6.9

Finish calibration

When you are content with the achieved calibration press the Finish button
in the tool bar (see image aside) to accept the calibration (image dewarping
function + pixel/mm scaling) which might then be written to your project.
The following dialog opens :

Select the first choice to open a new project with the new calibration
leaving the current project untouched.
Select the second option to overwrite the calibration of the currently active project - be aware that previously recorded images and their derived
results might not be consistent with results that will be calculated with
the new calibration.
Select the third choice to overwrite the calibration of the currently active project and scale all previous recordings present in the root level of
your project to be consistent with the new calibration - be aware that results that have been derived before the changed calibration might not be
consistent with results that will be calculated with the new calibration.
63

2 Calibration wizard dialog

Select the fourth choice if you want to discard everything you have done in
the calibration wizard. Then the old calibration active when you entered
the calibration wizard will be restored. Note that you might have to do
the whole calibration procedure again.
The calibration wizard dialog will close and you return to the project manager.

64

2.7 Walkthrough : advanced settings

2.7
2.7.1

Walkthrough : advanced settings


Step 1 : Define experimental setup

To do this kind of calibration you should select the sixth option - see left
screenshot below.
To do this kind of calibration you should select the eight option - see left
screenshot below.

To proceed to the second step either press the next step button in the tool
bar or press the second button in the list of available steps You are here:

2.7.2

Step 2 : Define coordinate system

When you enter the second step the dialog looks like the following screenshot:

In this step you define your coordinate system and the number of views you
provide for your calibration plate in different places to calculate the image
dewarping function.
You have to do this for all coordinate systems. You change to set up another
coordinate system clicking on the card item labeled Coordinate system 1
to Coordinate system 6 depending on what coordinate systems are used.
All settings are made independently so you do not have to define them all the
same.
65

2 Calibration wizard dialog

On the right side in Coordinate system axis orientation you select if you
want a right handed coordinate system (z-axis orientated toward you when
you look at the images) or a left handed coordinate system (z-axis pointing
away from you).
On the left side you specify the number of views you will provide for all cameras
defined in this coordinate system ! For the N th view you have to provide images
for all involved cameras of the calibration plate in the same position. So either
take images simultaneously later or make sure that the calibration plate will
not move while you take separate images for all cameras. Although in general
one view is enough to find a dewarping function to correct all distortions in
your camera images providing several views makes the result more accurate.
In any case the x yplane (and hence the z-axis ) is always defined by the
orientation of calibration plate of the first view.
In case you want to provide several views you have to specify if they are
coplanar (that is aligned in parallel among them) and if they are placed at
equidistant z- positions. Please be aware that some kind of mapping functions
require coplanar views. In case you have equidistant views you have to specify
the distance dz between two neighbor views.
Below you will find a table with the required and recommended number of
views for your experiment. Depending on the combination of the dewarping
mapping function type, your calibration plate type (2D or 3D) and the number
of mapped cameras in your coordinate system you have different limitations
and recommendations:
System type

Mapping model
for dewarping

Required
] of views

Recommended
] of views

cameras not mapped


(independent 2D)

polynomial
or pinhole

camera mapped (2D


measurements - e.g.
image stitching)

polynomial
or pinhole

camera
mapped
(stereo measurements
- e.g. 3D vectors)

polynomial

2 views must
be coplanar and
equidistant

camera
mapped
(stereo measurements
- e.g. 3D vectors)

pinhole model

2
(with
2D
plates views should
be coplanar and
equidistant
continued on next page

66

2.7 Walkthrough : advanced settings

Limitations from your experiment might force you to make special choices:
You might be forced to use a 2D calibration plate because no 3D calibration plate is available (e.g. for a microscope).
Looking through a non planar glass window which adds non radial distortions to your images might force you to use polynomial mapping as
the pinhole model does not work well in those conditions.
Stereo measurements (e.g. Stereo PIV) require a calibration for more
than one plane. So you would need a pinhole calibration or a polynomial
calibration using either a 3D calibration plate or two coplanar views of
a 2D plate.
Volume measurements (e.g. StrainMaster 3D and SurfaceFlow) require
a calibration for more than just the z = 0 mm plane. So you either must
use the pinhole model that by handles the mapping for every point in
space to the CCD chips. Or you need a polynomial mapping for at least
two (coplanar) views at different z-positions better is using a higher
number of planes that cover the whole volume you want to measure.
the use of the self calibration wizard (available in PIV projects) requires
the pinhole calibration. For more details please refer to the corresponding
chapter about self calibration.
The measurement itself in most Davis packages implies that the sample is
located at the z = 0 mm position. If you cannot place the calibration plate at
that position you can perform the calibration in front or behind that position.
This can be done only for a pinhole calibration or for a polynomial calibration
with two or more coplanar views. To use this feature please check the option
first view not at origin and specify the z-position of the first view. The
calibration process will then take this offset into account. In any case the
coordinate system is set up so that the calibration plate position of the first
view defines the x y-plane orientation (and hence the z-axis ). To proceed
to the third step either press the next step button in the tool bar or press
the third button in the list of available steps You are here:

2.7.3

Step 3 : Select used calibration plates

When you enter the third step the dialog looks like the following screenshot:
67

2 Calibration wizard dialog

In this step you specify which calibration plate you are using. If you use a
calibration plate from LaVision it is enough to select the plate type labeled
on the plate e.g. Type ]10. This will set all plate parameters to the correct
values (see first screenshot above).
In case you want to use your own calibration plate you have to provide a number
of parameters (see second screenshot above): On the left side in Calibration
plate used you define the calibration type:
calibration plate contains marks in form of crosses or dots. Both black
marks on white background and white marks on black background are
supported and identified automatically.
calibration plate has only 1 plane = type 2D or is a two level plate =
type 3D.
On the right side in Calibration plate parameters you define several of its
parameters (dimension and sizes):
distance between neighbor marks in one plane in mm
68

2.7 Walkthrough : advanced settings

size of a single marks in mm


distance dz from plane to plane in mm (for 3D plates only)
For stereo camera systems or in case you map several cameras to a common
coordinate system you might look from two different sides to the calibration
plate (and the experiment, e.g. the particles illuminated by a laser sheet in
PIV). In case you do this you have to check the check box using both sides
of plate. In case you do so you have to add two more quantities:
The plate thickness from outer plane to outer plane
in case you have a 3D plate (with 2 planes build in on either side) you
have to specify if the groove on opposite sides are aligned (grooves on one
side meets groove on other side) or displaced (groove on one side meets
land on other side).
This information is then used to calculate the dewarping function taking the
extra shifts into account. To proceed to the fourth step either press the next
step button in the tool bar or press the fourth button in the list of available
steps You are here:

2.7.4

Step 4 : Image acquisition

When you enter the fourth step the dialog looks like either of the two following
screenshots depending on whether the Maximize button has been pressed or
not see images shown aside.

In the fourth step you acquire the necessary images of the calibration plate for
all cameras and all views - only then you are allowed to proceed to the next
steps.
69

2 Calibration wizard dialog

For the image acquisition you can take a new image directly from the cameras
that are currently connected to your system. To do this press the Take image
or the Grab button in the dialog.
This takes one image (or in case of Grab continuously images until you press
the stop button in the toolbar or hit the ESC key) of the cameras that are
selected in the dialog for the specified view (check box on). For views that
already contain non empty images the selection box entries are marked with
(ok). If a camera contains valid images for all views the selection box for the
view selection becomes green. If all view entries of all coordinate systems are
green then the next step button will be enabled. Pressing the button with
the red cross will delete the camera image of the selected view.
In the general device interface GDI to its right (only visible in the minimized images, maximized dialog setting - see above) you can set up the exposure times, external trigger, (laser) light sources, step motor positions and
other hardware settings important to your image acquisition.
Changing the average value in the text box on the left to any other value than
1 will result in the averaging of the specified number of images to improve
image quality due to poor lighting conditions. Please make sure that neither
the camera nor the calibration sample is moving !
Another option is to import one or more previously recorded files from your
hard disk by pressing the Load button. You can either load single images or
whole (Davis) sets. This opens a modal dialog that shows a preview of the
image in question (see screenshot below).

Here you specify which of the image frames you want to import. For images
originating from Davis you can leave the check box that follows unchecked and
read out the default camera number that is stored in each image (and shown
for the current image). For imported bitmaps (.bmp or .tif files) you have
to specify to which camera the image corresponds. If want to overwrite the
70

2.7 Walkthrough : advanced settings

stored camera number you can also specify another (wrong) camera number.
The selection box will turn red (instead of green) to warn you that the program
recognized a discrepancy - so you should really know what you are doing.
In case you want to load several images at once from an image set you need
to specify which images of a set you want to import (start and end image
number and an increment) and specify the start view to which the images are
added. If during the import more than one image for a camera is found it will
automatically add it to the next view. If all views hold valid camera images
the import stops automatically.
This is a the recommended way to import old calibration images from an old
calibration.set created by Davis 6.2 or Davis 7.0 into the new format.
To proceed to the fifth step either press the next step button in the tool bar
or press the fifth button in the list of available steps You are here:

2.7.5

Step 5 : Mark definition

When you enter the fifth step the dialog looks like the following screenshot:

In the fifth step you define three start marks for the mark search. To start the
process you can either
click All cameras/views which automatically will show you the images
for all camera / view combinations one after another to (re)define the
start marks for all those combination or
you press Shown camera/views to (re)define the start marks in the
currently visible image in the working window or
you press a table entry in the table to the right corresponding to a
camera / view combination to (re)define the start marks for that combination.
When you do any of this instructions will appear in the Instructions field of
the dialog to guide you to the clicking process. First you have to click a start
reference mark which must be the same physical mark in all cameras and all
71

2 Calibration wizard dialog

views ! Then you are asked to click the neighbor mark to the right (to the
left if the camera is looking onto the backside of the calibration plate) and at
last the mark to the top of the first mark you selected. Important: please
make sure that the marks you select are located on the front plane of a 3D
calibration plate ! If you clicked all 3 marks successfully the table entry for
that camera/view combination will show an okay.
You may stop the clicking process any time pressing the Stop button in the
tool bar or by pressing the ESC key on your keyboard which will abort all
further actions.
If you have defined start marks successfully on all images (all table entries show
an okay) you may proceed to the next step. To proceed to the sixth step
either press the next step button in the tool bar or press the sixth button in
the list of available steps You are here:

2.7.6

Step 6 : Finding all marks

When you enter the sixth step the dialog looks like the following screenshot:

In the sixth step you let the program find all other marks for you. This is
an automatic process and requires no user interaction. Just press the button
Start search. Depending on the image quality and the speed of your computer
this might require several minutes, but you should see a screen update once
in a while. Usually it is enough if 20-30 marks could be identified. Please be
aware that due to the nature of the dewarping functions for a polynomial fit
marks have to be found everywhere in the image where you want to derive
result later, for pinhole calibration it is enough if only parts of the image are
covered with found marks.
In case you are not satisfied with the mark search quality you can enhance the
search changing some parameters. First you should check if you selected the
correct calibration plate type (2D or 3D) and the correct mark type (crosses
or dots).
72

2.7 Walkthrough : advanced settings

If you think that some marks have not been found that should not pose a
problem for the mark search process you can adapt the search parameters in
the dialog accessible by pressing the button Mark search parameter....

In this dialog (see screenshot above) you can choose in use preset values
your impression of the image quality and ask to find more or less marks with
the slider. On these assumptions the general search parameters are changed.
In advanced settings you might change these values one by one although
this is only advisable for expert users as there are many dependences among
some parameters.
If you think that too many marks have been found e.g. due to reflexes outside
the calibration plate you can eliminate them one by one pressing the button
Delete single mark where you can click iteratively on all marks that you
think should be deleted from the list of found marks (might take a while).
Just click repeatedly very close to the center of a found mark and wait to see
the mark disappear from the display. Then either go on clicking the next mark
or press the Space bar to end this procedure.
Another way to limit the mark search is to limit the search are in the first
place. You add a masked area by pressing the red or the blue button polygon
button of Limit search using a mask. In the Status text there are some
instructions how to proceed. You can click various times to define the angles
of a polygon. Pressing the key d deletes the last point(s) repeatedly, q aborts
the whole process and c closes the polygon and accepts the mask. Using the
blue button enables all pixels inside the polygon masking out all pixels outside,
the red polygon does it the other way round. With the button showing the red
cross you delete the mask from the current camera / view selection.
Please note that a mask is defined for the currently visible image only and that
you can use different masks for images of other camera / view combinations.
In the table to the right the number of marks found in each image is shown.
In case the calibration plate has 2 planes (3D plate) the number of marks for
each plane is shown separately with the plus sign (+). When marks have been
73

2 Calibration wizard dialog

found in all images the next button is enabled and you may proceed to the
next step.
To proceed to the seventh step either press the next step
button in the tool bar or press the seventh button in the list of available steps
You are here:

2.7.7

Step 7 : Fit mapping function

When you enter the seventh step the dialog looks like the following screenshot:

In the seventh step you fit the dewarping mapping function to the marks
found in each image. You can select between pinhole calibration and polygon
calibration. Please note that in case you have more than one view and these
are not coplanar or equidistant the polynomial calibration is not available.
To start the calculation process press the button Start calibration. The
calibration process is automatic and requires no user interaction. The average
deviation of the dewarped mark positions to the ideal regular grid is shown in
the table to the right for each image. A value lower than 1 pixel is good, a value
lower than 0.3 pixel is excellent, Values higher than 2 pixel are questionable.
Please check if you clicked the front plane of a 3D calibration plate as this
is a common source of error. You can check the result of the fit in detail by
pressing the button Show fit parameter... which opens either of the two
following dialogs depending on the kind of mapping function you selected.

74

2.7 Walkthrough : advanced settings

In both cases you can check the size of the corrected image and the RMS
of the fit.
In case of the polynomial you can check the coefficients of the mapping function.
In case of the pinhole model you can check the physical parameters that describe your model and compare them to the real world parameters of your
experiment: focal length of your camera lens, distance Tz from camera to calibration plate. Rotation Rx and Ry around X and Y axis indicating the
angle at which the cameras see the calibration plate. All those parameters
should coincide with your experimental setup fairly well. The first and second
radial distortion factors are the extra distortion that are produced by that term
at a distance of 500 pixel to the center of distortion. This center of distortion
is called the principle point as is located where the optical axis of the camera
lens meet the CCD chip of your camera if you use a Scheimpflug adapter
this might not be the center center of your CCD chip! The radial distortion
contribution is usually 1 pixel or below although this strongly depends on
the camera lens you use.
If you are not happy with the fit you can adapt some general parameters of
the fit by pressing the button Fit parameters (pinhole model fit only !). It
will open the following dialog:

Here you can select which parameters should be fitted and which are just set
to fixed (known) values. Switching to default fit will reset all parameters to
their standard values and should work for most purposes (fixing the principle
point to the center of the camera CCD chip and using squared pixels, fitting
75

2 Calibration wizard dialog

the rest starting the fit with focal length of 50 mm and distance Tz of
500 mm).
If you are not happy with this preselection or if you are using a Scheimpflug
adapter (and the assumption that the principle point is at the center of the
CCD chip is not true) you should switch to expert fit. Here you specify for
all cameras used in that coordinate system if you want to fit the focal length
or use a fixed value. In the first case the value is used as a start value for the
fit: the closer you can guess the focal length the easier it will be for the fitting
algorithm.
Furthermore it will help the algorithm if you can provide the rough distance of
camera to calibration plate in mm along the viewing direction of the camera.
At last you specify if your cameras are using a Scheimpflug adapter on your
cameras.
If your cameras have non square pixels you can check that option , but this is
NEVER the case with the cameras LaVision provides and should be switched
on only if you imported images from other cameras. There is the rare case
where additional distortions looking through a glass window can be corrected
by switching on this option. If in doubt you may contact LaVision to advise
you. Usually additional distortions by the optical access to your experiment
strongly suggests to use the polynomial fit.
Then you may switch between various levels of radial distortions which will
switch on the fit of first and second order terms describing radial distortions.
If you have done the fit for all cameras (and coordinate systems) you may
proceed to the last step.
To proceed to the last step either press the next
step button in the tool bar or press the last button in the list of available steps
You are here:

2.7.8

Step 8 : Evaluation of corrected images

When you enter the eighth step the dialog looks like the following screenshot:

In this last step you can evaluate visually your fit results. For that purpose all
camera / view combinations are dewarped - for 3D calibration plates even for
76

2.7 Walkthrough : advanced settings

both z positions of the upper and the lower plane. Then also images are created
where the corrected images of all cameras and all views of a coordinate system
are overlayed (summed up) to see if indeed all corrected images coincide. In
addition a grid of the ideal regular grid of marks is overlayed. Here you can
check:
in single camera images if the marks fall to the ideal regular grid
if the marks in the summed up images of different cameras (and one
view) coincide for z=0 mm position
if the marks in the summed up images of different views for one camera
coincide for z=0 mm position
if the marks in the summed up images of all views for all camera coincide
for z=0 mm position
In case you use a 3D calibration plate you can check furthermore:
all of the above for the position of the second plane in case you use a 3D
calibration plate
in case you use more than one camera you can check by how much a
wrong z position will move the corrected images apart. In detail: correcting for the position of the upper plane (z=0) to make the marks of
the upper plane coincide will produce ghost images for the marks in the
lower plane (e.g. at z=1 mm) due to the perspective parallax. This gives
you a direct information of the 3D resolution of a stereoscopic system.
Lets say the ghost images are 6 pixel apart. Then the vector calculation
(which can resolve 0.05 pixel shifts on the CCD images) will detect a
true shift of 1 mm /6 pixel = x mm / 0.05 pixel x = ca. 8 m
in z-direction in this experiment. You can increase this resolution by
increasing the angular separation of your system.
Changing the selection boxed for camera, view and plane (if you have used a
3D calibration plate) shows the corresponding corrected images for evaluation.
The table Fit results to the right summarizes the most important fit parameter. For a more detailed overview of the fit result you can click the button
Show all fit parameter... which opens either of the two following dialogs
which are described in detail in the section above - so please refer to the descriptions in step 7.
77

2 Calibration wizard dialog

2.7.9

Finish calibration

When you are content with the achieved calibration press the Finish button
in the tool bar (see image aside) to accept the calibration (image dewarping
function + pixel/mm scaling) which might then be written to your project.
The following dialog opens :

Select the first choice to open a new project with the new calibration
leaving the current project untouched.
Select the second option to overwrite the calibration of the currently active project - be aware that previously recorded images and their derived
results might not be consistent with results that will be calculated with
the new calibration.
Select the third choice to overwrite the calibration of the currently active project and scale all previous recordings present in the root level of
your project to be consistent with the new calibration - be aware that results that have been derived before the changed calibration might not be
consistent with results that will be calculated with the new calibration.
78

2.7 Walkthrough : advanced settings

Select the fourth choice if you want to discard everything you have done in
the calibration wizard. Then the old calibration active when you entered
the calibration wizard will be restored. Note that you might have to do
the whole calibration procedure again.
The calibration wizard dialog will close and you return to the project manager.

79

2 Calibration wizard dialog

2.8

2.8.1

Walkthrough : define origin, maintain calibration

Step 1 : Define experimental setup

To do this kind of calibration you should select the first option - see left screenshot below.
The list of available step then indicates that the total calibration process consists of two steps - see right screenshot below:

To proceed to the second step either press the next step button in the tool
bar or press the second button in the list of available steps You are here:

2.8.2

Step 2 : Define origin / maintain calibration

When you enter the second step the dialog looks like either of the two following
screenshots depending on whether the Maximize button has been pressed or
not see images shown aside.
80

2.8 Walkthrough : define origin, maintain calibration

Once you have done a calibration to calculate a dewarping function you may
want to change the origin of the coordinate axis while maintaining the image
dewarping itself. You can do this here.
For the image acquisition you can take a new image directly from the cameras
that are currently connected to your system. To do this press the Take image
or the Grab button in the dialog.
This takes one image of the cameras that are selected in the general device
interface GDI to its right (only visible in the minimized images, maximized
dialog setting - see above). In the GDI you also set up the exposure times,
external trigger, (laser) light sources, step motor positions and other hardware
settings important to your image acquisition.
Changing the average value in the text box on the left to any other value than
1 will result in the averaging of the specified number of images to improve
image quality due to poor lighting conditions. Please make sure that neither
the camera nor the calibration sample is moving !
If you have acquired the images of all cameras for which you want to change
the origin you can proceed to the Action group of buttons: Pressing one of the
five buttons on the right sets the origin on the corrected images to the center
or one of the corners. Pressing one of the user defined buttons lets you select
any pixel with a mouse click into the image or by entering a specific location
manually. In that case the following dialog appears:
81

2 Calibration wizard dialog

If you chose one of the 7 ways to change the origin a dialog might appear asking
you if you want to take over the changed origin for other cameras in the coordinate system. Usually you want to do this (e.g. stereoscopic measurements)
as the measurement takes place in a common coordinate system. only in the
case where you first mapped the cameras into a common coordinate system
but looking at different places you might want to define the origin separately
to be able to stitch the images together later using that scale information.

Press YES to take over the origin to all other cameras (if there are any), NO
if you do not want to do this and STOP if you want to abort this action and
do not change the origin for no camera image at all.

2.8.3

Finish calibration

When you are content with the achieved calibration press the Finish button
in the tool bar (see image aside) to accept the calibration (image dewarping
function + pixel/mm scaling) which might then be written to your project.
The following dialog opens :

82

2.8 Walkthrough : define origin, maintain calibration

Select the first choice to open a new project with the new calibration
leaving the current project untouched.
Select the second option to overwrite the calibration of the currently active project - be aware that previously recorded images and their derived
results might not be consistent with results that will be calculated with
the new calibration.
Select the third choice to overwrite the calibration of the currently active project and scale all previous recordings present in the root level of
your project to be consistent with the new calibration - be aware that results that have been derived before the changed calibration might not be
consistent with results that will be calculated with the new calibration.
Select the fourth choice if you want to discard everything you have done in
the calibration wizard. Then the old calibration active when you entered
the calibration wizard will be restored. Note that you might have to do
the whole calibration procedure again.
The calibration wizard dialog will close and you return to the project manager.

83

2 Calibration wizard dialog

2.9
2.9.1

Stitching in a side-to-side camera setup


Preparation

If you plan to stitch images or vector fields make sure that the images of both
cameras have an overlapping of at least 10% of the image area and the zoom
factors are almost the same (see sketch below). It is not necessary that the
cameras look from a perpendicular direction to the experiment, although it
helps to keep the interpoaltion errors small (smoothing effect on the images).
Refer to the following setup. It is important though that you use a continuous
calibration plate that covers the area of both images. You can NOT use two
different calibration plates that you arrange side by side in front of the cameras.

2.9.2

Calibration

To apply image or vector field stitching it is important to do a proper calibration. You choose the calibration 2 mapped cameras (e.g. stereo) (please
refer to he chapter 2.6). In step 5 you have to click the cross which are almost at the same apparent location in the camera images taken with camera
1 and 2 (e.g. the mark in the center of the image), as if the cameras were
looking at the same place of the calibration plate (like in a stereo system) - do
NOT choose the physically identical cross in the overlapping area ! Proceed
as indicated in chapter 2.6 and Finish the last step.
Now you reenter the dialog and choose the calibration define origin - maintain calibration and select the cross you first clicked in camera image 2 and
now specify its real coordinate (which is not 0,0 but maybe 200,0 if 200mm to
the right of the first physical cross you clicked in camera 1). Please refer to the
setup of the previous section. Proceed as indicated in chapter 2.8 and Finish
the last step.
84

2.9 Stitching in a side-to-side camera setup

Now you have successfully done the calibration necessary to stitch images or
vector fields.

2.9.3

Stitching images

To stich images select the set with a series of double frame images and apply
the image correction (raw->world) batch processing operation in the image mapping group. This takes out the image distortion due to perspective
distortion and camera lense errors of each camera
Then apply the shift and intensity correction batch processing operation
in the time series group which stitches the images together. In the card
General Parameter deselect all options but shift correction and go to the
card Shift and rotation correction. In this card you define a common point
in both images to help the computer find the shift automatically. You might
want to use a subpixel shift which enters another image interpolation of camera
image 2 but does not has stair artefact in the boundary region. Or deselect
the subpixel option which just copies the camera image 2 to the side of camera
image 1 to the best integral pixel shift without entering any further smoothing
artefacts. If cameras are fixed you should use the Calculate shift = relative
to first image.
Then if you want to make furhter evaluations (e.g. vector calculation) keep in
mind that the images have been already corrected so switch off any "use iamge
correction" switches if available.

2.9.4

Stitching vector fields

As the vector field calculation implies image interpolation in the multi pass
process, stitching images is a bad idea as the information is degrading by
subsequent sinterpolations. To avoid additional interpolation you should interpolate vector fields instead. The recommended procedure is the following:
Do NOT do image stitching, but select sequential cross correlation mode
frame 0-1, 2-3 this time switching on the "use image correction". This implies
a vector calculation of multi pass window deformation and image correction
interpolation in one step, so the iamge quality is maintained. ! The result of
this operation is a series of doulbe frame vector fields corresponding to camera
1 and 2.
On these results apply the merge vector function in the vector mapping
group which has no parameters to set. The result is a stitched vector field
where in the overlapping region the vectors are interpolated to give a smooth
transition.

85

2 Calibration wizard dialog

2.10

Troubleshooting

Step 4
The go to next step
button is not enabled

Check if you have taken images for all camera / view


combinations. Those selection boxes that are not green
still require more images. Check their entries for missing (ok) texts. Otherwise you can go back and reduce
the number of views. Be aware that when you take additional images for a certain view all cameras in that
coordinate system need to see the calibration plate in
the same location.

Camera
dark.

are

Check the exposure time in the GDI . If you have a


system with a laser or any other triggered light source:
For safety reasons the light sources are switched off when
you enter the calibration dialog. So either switch them
on again or choose a higher exposure time to take images
with day light.

Camera images are still


too dark.

If not enough light is available you might add up several


images to improve the signal to noise ratio further. Make
sure the calibration plate is not moving during the image
acquisition !

images

Step 5
The go to next step
button is not enabled

Check you clicked on all images. All table entries on


the right should hold an okay entry. If you click an
entry that does not hold an entry labeled okay the corresponding image is shown and you are asked to click
again follow the instructions shown in the dialog. Or
just click All cmaeras/ views or the Shown camera/view button.
continued on next page

86

2.10 Troubleshooting

Step 6
The go to next step
button is not enabled

Check you clicked on all images. All table entries on


the right should hold the number of found marks in the
form a or a + b. After adapting the search parameters
and checking the next two tips below you can click on
the table entry with the missing number of marks and
the search will be redone for this camera / view. Or just
lick the Start search button to find the marks in the
images for all camera / views.

Not all marks could be


found

Before changing the mark search parameters make sure


that you have specified the correct calibration plate type
(step 3). A wrong type or wrong entries for a user defined
plate are a common source of problems. Then you should
check if you really clicked on the start marks on the top
plane (in a 3D plate) and close enough to the center of
the marks on the plate. Only if all of this fails you should
adapt the search parameters.

Too many marks have


been found

You can limit the search by defining a mask or just delete


single marks from the list of found marks. Only if all of
this fails you should adapt the search parameters.

Step 7
The go to next step
button is not enabled

Check you clicked on all images. All table entries on


the right should hold the RMS of the fit (a number well
below 2)

The RMS of the fit is


still very high

check if you really clicked your start marks on the top


plane of a 3D plate. Then check if all marks have been
found. Another common problem is that the camera
images for a certain view do not show the calibration
plate at the same position. This might happen easily if
you retake images (step 4) for only one of several cameras
in coordinate system with a calibration plate in another
position (calibration plate was moving in the meantime).
Or it might have happened if you mixed up single images
when importing them from file (e.g. two identical images
are provided for view one and two for camera 1 and two
different images for camera 2).
Furthermore there might be the case that you selected
the pinhole model and you have non radial distortions in
your images (e.g. when looking through a glass window).
Then you should try the polynomial fit.
continued on next page

87

2 Calibration wizard dialog

Step 8

88

The red grid does not


meet the corrected
mark positions

This is the case if the RMS of the fit is too high. Please
see troubleshooting tips for step 7.

In the sum of all cameras / sum of all views


display the corrected
camera images do not
match.

Other than in the pinhole model fit in the polynomial


fit you have to be aware that the correction is optimized
only for the places where marks have been found. So
if for example marks are seen only in the left side of
the image the right side might show huge discrepancies.
Retake your images with a full screen view of the calibration plate and make sure that all marks are found or
use the pinhole model for your fit.

3 Imaging Tools
3.1

Mask Definition

A mask is used for specifying an arbitrary region in the image where something
should be computed. A mask buffer may be an image or a vector field. In both
cases only then a pixel or a vector is accepted or computed, if the value in the
mask buffer is non-zero at the corresponding position.
In some projects it is possible to pass any displayed image to the mask dialog
by selection of the send to mask dialog entry in the send to submenu of
the context (accessable with a click of the right mouse button in the displayed
image). If a vector file is passed via send to first the vector length will be
extracted and the resulting scalar field passed to the mask dialog.

Figure 3.1: Dialog for mask definition.


The upper part of the mask dialog (see figure 3.1) shows the parameter settings
while the lower part displays the source image on the left and the masked
image on the right. The displayed width of both images can be changed by the
slider below the images. To load another source image, please press the load
89

3 Imaging Tools

image button on the upper right of the dialog. The display parameters can
be easily changed after pressing the right mouse button in the image window
and selecting Display Properties in the context menu.
There are three possible operation modes to create a mask:
load fixed mask from file simply loads a previously calculated mask
from a file. The mask can be loaded pressing the Load button
user defined mask allows to define the masked area with geometrical
elements (rectangle, circle, ellipse, polygon) In this mode the user can
create a number of objects by mouse and then use either the inside of a
single object or the outside as valid region. The intersection of all these
masked areas is defines the final masked area.
create algorithmic mask with operation pipeline taking the current image and use digital filters on it. After all operations had been
applied all the pixels with a value of 0 counts are masked out. A typical
procedure would be to smooth the image sufficiently before subtracting
a threshold, which sets all unwanted regions to zero. This can be done
easiliy using the dialog described further down in figure 3.3
create user defined + algorithmic mask first the geometrical mask
is applied to reduce the masked area to a certain region then on the
remaining pixels further pixels can be sorted out using tha algoritmic
operation pipeline.
When finishing the mask creation, the current mask can be save current
mask to file as fixed mask into a file and reloaded at the next program
start. Additionally the current dialog settings of the dialog can be stored or
loaded by the buttons near dialog settings on the upper right and reloaded
e.g. to retrieve good settings for the algorithmic operation pipeline.

Figure 3.2: Parameter settings for user defined mask in the Mask
dialog.
90

3.1 Mask Definition

To create a user defined mask you may add new elements to refine your mask
by pressing first one of the blue or red buttons representing the graphical
elements rectangle, circle, ellipse and polygon and then click into the (left)
image displayed to define the object. For a rectangle two opposite angles are
be given. For circle / ellipse the center position and the radius are defined. For
a polygon any number of points can be added. Pressing "c" closes the polygon
and ends the point adding. "d" deletes the last entry and "q" quits the entry
and discards the polygon.
Pressing the buttons Clear last item (of X) deletes the last defined objects
in the list of X itmes (may be pressed several times to undo all changes) and
Clear all items clear the whole list to start all over again with an empty list.
The text next to it informs on the number of objects defined so far.
To create a mask in algorithmic mode a number of different operations can
be selected in the list on the right. Press button Recalculate now to use the
image on the left side as source for the calculation and display the new mask
on the right side.

Figure 3.3: Parameter settings for algorithmic mask in the Mask


dialog.

Eliminate all 0 counts: It is strongly recommended that this option is


selected initially, so that zero pixels in the original image do not lead to
unwanted masked out pixels. Pixel with intensity 0 are not used during
an operation.
Invert image I(x,y)=Imax-I(x,y)+N and add an intensity offset N.
Smoothing over N N pixel.
Sliding average/maximum/minimum filter over N N pixel.
91

3 Imaging Tools

Median filter over N N pixel. The median filter is a non-linear filter


not working with the simple matrix equation above. The median filter
takes a N N area and sorts all elements according to their intensity.
Then the middle element is stored back as the new center pixel. Just like
the other smoothing filter, it will eliminate high frequency noise. As an
advantage it does not eliminate sharp edges as much as the other filters.
On the other hand this filter is non-linear, i.e. the average intensity of
the image may change. The median filter works mathematically very
similar to the erosion and dilatation filter discussed below, which have a
very different behavior.
Above/below threshold sets the intensity above or below a given
threshold to 0 counts.
Erosion: Just like the median filter this filter will sort the pixels of a
3x3-area according to their intensity. But instead of taking the middle
element, the erosion will take the element before. The effect is a kind of
erosion, valley become deeper and finally the image will be eroded away
toward the background level.
Dilate: The dilatation filter does exactly the opposite of the erosion. It
will take the next element after the middle one in the sorting list. The
effect is that edges become sharper while plateaus flatten and become
more even.
Binarize image to 0, 10000 counts: will set all pixels to either 0 if they
were 0 before or to 10000 otherwise. This options is useful to distinguish
low-count pixels from 0. The image may also be inverted afterwards.
Note that sometimes it is easier to define the areas which must not be
used e.g. for vector calculation.
Local RMS: Any pixel value is replaced with the local RMS deviation
to the average of its neighbours. This is a useful filter operation to mask
out areas with high particle seeding for example. Image areas without or
with poor particle seeding show a homogenoues (low) count distribution
while areas with many particles have high local contrast (count value
variations). The same applies to probes with speckle pattern.
Replace value: to 0, 10000 counts: will set all pixels of the specified
value to 0. This options is useful to use masks with a mask out value
different from 0. Note that sometimes it is easier to define the areas
which must not be used e.g. for vector calculation.
92

3.2 Overlay Editor

User function: A CL macro of the form macro(int inputoutputbuffer,


int parameter) can be specified that is called with the image in the currently active state of the operation pipeline and the given parameter
value. The macro should return the changed buffer. This way it is possible to write your own filters.
Sometimes an image already has very low count pixels. In the displayed mask
on the right these counts are very difficult to distinguish from masked out pixels
(which by definition have 0 counts). To make this easier you can "binarize" the
image (as explained in the algorithmic mask) , but then the image structure
is lost, that is you do not "see" if all the pixels you wished to mask out
actually are. To remedy this select the check box labeled add 100 counts
offset to masked area. This will add 100 counts to the image in those areas
that are not masked out and let the masked out area its 0 count value. This
way the masked out area is clearly visible and the image structure are still
displayed e.g. outline of probe, particle seeding, experiment setup. Be aware
that this display mode shows 100 count to high pixel values. Algorithmic mask
parameters (threshholds) are calculated always from the original image.
Automatic display update updates the mask every time a parameter is
changed. This may slow down the work flow severly depending on the selected
mask creation mode. Recalculate now creates the mask when pressed just
one time to test the current parameters.
When using the mask in a Batchprocessing dialog operation (like vector calculation) the Recalculation mode can be set here: Or the mask is calcaalted
one time for the first image and then used for the rest of the set, or the mask
is recreared for all the images in the set (possible for algorithmic mask only)
or the mask is created for the first image and then moved with the deforming
object (useful ony for time series images).

3.2

Overlay Editor

Overlays are user defined painting structures (lines, polygons, ellipses, texts),
which are connected to buffers or cameras and automatically painted above the
2D-image display of a buffer. The overlay display can be enabled or disabled
in the Data and Display Attributes dialog (see page ??). For information about programming overlays with CL macros please read the Command
Language manual.
Overlays are connected to a buffer as buffer attributes, and they are stored
together with the buffers raw data in file types IM7, IMG, IMX, VEC and VC7.
93

3 Imaging Tools

The Overlay Editor dialog of figure 3.4 can be opened from the batch processing function add overlay in group attributes and from the Buffer menu
in DaVis Classic.

Figure 3.4: Overlay Editor dialog


An overlay is painted either in every frame of a buffer or in a single frame only.
In the upper left line of the dialog the active frame can be selected, starting
with index 0, or the all frames definition.
The list below includes all defined objects for the active frame. When selecting an object, the type, position and other parameters are displayed and the
overlay object itself is painted in the buffer view on the right.
To paint all overlay objects of the active frame and get a test view, please press
the view all button. Button copy will create a complete copy of the selected
object, but changes the objects name. A single object can be deleted, and
the complete frame objects can be destroyed by button Delete All. Note:
There is no possibility to undo the last changes!
To define a new object, press on one of the bitmap buttons with symbols
text, rectangle, polygon, ellipse, circle and line. After pressing the button,
the mouse cursor is activated to wait for the user input and the status line on
bottom of the DaVis main window gives information about the requested input:
For a text object the upper left corner of the text area must be selected with
the left mouse button. For a rectangle or line the first and second position
must be selected, for a circle or ellipse the center and a radius position. For
a polygon all positions must be selected, and when finishing the user has to
press a key: q to quit the definition, c to close the object or o to get an open
polygon.
94

3.3 Adapt existing palette

Each object parameter can be changed manually after definition: the name,
pencolor and fillcolor, the penwidth and the positions. With the Set button
each position can be redefined by a mouse click in the buffer view. For a text
object the text itself and some style settings are available.
By default each object is visible and painted on screen. If the mode is disabled,
the object is not painted but available for a later enabling without deleting and
recreating the parameters.
With the file items in the lower left part of the dialog, open file and save
file, the active overlay can be stored or reloaded. This is an easy way to save
an overlay and later use it again in the same or another buffer.
The overlay can be exported to the mask buffer, either the active overlay
or the complete buffer overlay. During the export the intensity values of the
pixels inside the objects and outside of all objects can be defined. Also the
export can be done to another buffer or even to a camera: Each camera can
use an individual overlay definiton, which is copied into the buffer at the end
of image acquisition automatically.
Press the Back button in the toolbar to return to the last dialog or to the
DaVis screen in Classic mode.

3.3

Adapt existing palette

This wizard allows to adapt existing color lookup palettes by adding extra
color entries at specific positions to produce the effect of equipotential lines in
a scalar field.
The dialog is opend via the Window menu entry set palette adapt
existing palette, which can be reached from any dialog at any time.
When you select this entry a dialog will open that looks like this:

Figure 3.5: Dialog to adapt existing Color Lookup Palettes.


Unless you tell to do so no color palettes are changed. So you can take your
time to experiment before taking over the changes you made to the build in
95

3 Imaging Tools

palettes. Furthermore you can undo all changes before leaving the dialog.
Anyway all palettes are restored to their original state when restarting Davis.
In the dialog you select the following parameters:
Source palette is the palette used as basis for the adaptation. You can
either change the palette number in the text box directly or press the
button ... to select the palette from the palette selection window (see
following screenshot).
Destination palette is the palette that will be overwritten by the source
palette colors plus some extra color entries. Again you can either change
the palette number in the text box manually or press the button ...
to select the palette from the palette selection window (see following
screenshot).
min: / max: is the minimum and maximum (arbitrary) range of the
intensity to color mapping you set in your scalar field. Relative to this
mapping the extra color entries are placed inside the adapted palette to
reflect the specified intensities.
Additional color entries: adds up to 10 extra color entries with the
specified colors at the position of the specified intensity values. Only the
intensity levels of the the selected check boxes are added to the palette.
On the right you see an online preview of the palette.
... : pressing this button opens the color selection dialog (see following
screenshot) to choose a new color for this intensity level.
Restore all original palettes (but current) undo all changes to the
state before you entered the dialog, but let you continue to work on the
current palette.
Restore all original palettes and close dialog undo all changes to
the state before you entered the dialog (including the current destination
palette) and closes the dialog.
Take over changes in current palette Takes over the current destination palette (only) to the list of color lookup palettes in Davis. You
can now continue to work on further palettes adapting iteratively several
palettes in a row e.g. for different min/max values.
Take over all changes and close dialog Takes over the current destination palette (and all others you changed) to the list of color lookup
palettes in Davis and leaves the dialog.
96

3.4 Image correction and distortion

In the following screenshot you see the dialog to select a new source or destination palette number with a preview of what they look like (before you make
the selection). Just press the button with number of the palette you want to
select above the palette or the close button X in the upper right corner of the
window to leave the dialog without changing the palette number:

Figure 3.6: Dialog to select a new palette


In the following screenshot you see the dialog to select a new color. Either you
press on of the seven set color button to select a standard color in the bottom
row or you set up a custom color using the RGB (Red /Green / Blue) levels
and press the button slider to take over that color or you press the button
None to leave the dialog without selecting a new color:

Figure 3.7: Dialog to select a new color

3.4

Image correction and distortion

The dialog is used to check the image dewarping function on images as well as
the effect of the vector preshift used in the vector multi pass calculations.
The Image Reconstruction dialog can be reached clicking on an image window with the right mouse button and selecting send to->image correction
and distortion.
97

3 Imaging Tools

The dialog that now opens should look similar to this: (in this example a
calibration plate image is shown to illustrate the dewarping):

The left image holds the source image you started the dialog with the right
image window will hold the result of the correction. If you select the parameters
as shown in the screenshot above and you press Apply correction you should
see something like the following result (which might differ in your experiment
due to the currently active calibration):

You can clearly see that all distortions due to the perspective distortion as
wellas camera lens errors are taken out, placing the crosses on a regular grid.
98

3.4 Image correction and distortion

You can do this for the standard case of z = 0 mm height or for any other fixed
height above the calibration plate position of view 1 used in the calibration
process. Alternatively you can provide a height map holding the z-position for
each pixel (as used in the StrainMaster 3D or SurfaceFlow package).

Of course you can do it the other way round providing a corrected image and
distorting it by pressing the button Apply distortion:

Both source and result images can be saved and loaded pressing the corresponding load and save button.

In the dewarping process a bilinear interpolation is used to access image information at subpixel positions. You can select Whittaker reconstruction with
the specified filter length (e.g. 7 pixels) which is significantly slower but might
provide sharper images.

A second mode is to shift the image contents as specified in a reference vector


field. Please deselect use image correction and select use vector buffer
and press Apply correction as shown in the example below:
99

3 Imaging Tools

With this you can check if the vector results of your vector calculation really
describe well the shifts of the image: If two frames are present for a camera
you might select further if you want to apply the whole shift to the second
frame only (as recommended in time series images) or distribute the half of
the vector shift evenly to both frames (with opposite sign as recommended for
double frame images).
When you switch between frames the patterns of both frames should match
exactly now. If there are still shifts present in the corrected image it indicates
that hte vector field still does not describe the shifts in those regions well
enough. Yu should try using more (multi pass) iterations and/or a finer grid.
For vector calculations where image correction has been used you can combine
both use image correction and use vector buffer of course.
Last but nor least yo can choose to correct / distort only frames for a specific
camera or all frames for which CameraNameX buffer attributes exist (auto
mode = recommended).

100

3.5 X/Y Plot

3.5

X/Y Plot

The X/Y Plot dialog can be reached using the X/Y Plot button in the
Project Manager. The dialog can be used to create a user defined x/y plot of
a vector dataset.

The dialog is subdivided into a right part with the views of the source and
result and a left part with the window manager and the x/y plot parameter.

3.5.1

Window Manager

In the top left corner you find the Window Manager that may be used for
image display configuration of the right part of the dialog. A suitable array
of images (vertical horizontal) may be selected using the Layout textbox
within the range 1 1 up to 2 2. The following types can be displayed:
Source: The selected vector dataset which is used to create the x/y plot.
X/Y Plot: The resulting x/y plot.

3.5.2

Plot mode

Before selecting the data for the x- and y-axis the user has to choose a Plot
mode.
101

3 Imaging Tools

The dialog provides the following modes:

x value / y value (1 profile): This mode gets from each source vector
field 1 data point (the selected x and y value) to create one profile with
n (number of vector fields) data points.

Example: Average strain Eyy over 9 vector fields.

x line / y line (n profiles): This mode gets from each source vector
field 1 profile (the selected x data line over the y data line) to create one
plot with n (number of vector fields) profiles.

Example: Vector component Vx along a specified line for 9 vector fields.

Note: Depending on the selected Plot mode the dialog supports different
groups/functions for the y- and x-axis.
102

3.5 X/Y Plot

3.5.3

Y - axis

Here you can select the data source for the y-axis. You can choose between a
scalar field operation (all available scalar field operations which are described
in the Batch Processing chapter) and device data which are used to store
additional data like analog values from a A/D converter.

extract scalar field: ...: Choose the group and function of the data
you want to use for the y axis. Depending on the Plot mode you have
different possibilities for the Data range: In the x value / y value
mode you can choose between the average value of the whole vector field
or the average of a user defined rectangle which can be set with the Rect
button. The x line / y line mode expects a data line with n (>1) values.
For this you can choose between:

arbitrary line: Select an arbitrary line in the source vector field.


The operation extracts the selected scalar values along this line.
horizontal line: The scalar values of the selected horizontal line.
horizontal line n-m (average): Select a range of horizontal lines.
The operation calculates an average line between the selected range.
vertical line: The scalar values of the selected vertical line.
vertical line n-m (average): Select a range of vertical lines. The
operation calculates an average line between the selected range.

device data: Choose one of the available device data you want to use
for the y-axis. If the Device data box shows - no device data - there
are no data in the current source dataset. In the x value / y value
mode the operation extracts the average of the selected device data for
each vector field. In the x line / y line mode the operation gets the
complete device data line.
103

3 Imaging Tools

3.5.4

X - axis

Here you can select the data for the x-axis. Depending on the selected Plot
mode and the data for the y-axis you can choose between one or several of
the following groups:

extract scalar field: ...: Choose the group and function of the data
you want to use for the x-axis. If you choose extract scalar field... for
the y- and x-axis both axis are using the data range of the y-axis.
device data: Choose one of the available device data you want to use
for the x-axis. If the Device data box shows - no device data - there
are no data in the current source dataset. In the x value / y value
mode the operation extracts the average of the selected device data for
each vector field. In the x line / y line mode the operation gets the
complete device data line.
file number: Uses the file number of each source file for the x-axis (only
available for x value / y value mode).
time: Extracts from each source file the stored acquisition time (only
available for x value / y value mode).
values along line: This option is only for the x line / y line mode
available.

3.5.5

Store mode

The Store mode determines if and how the resulting X/Y Plot is stored:
off: The result is not stored in the current project (but temporary on
your harddisk).
default: The result is stored in the current project with a default name
in the subfolder of the source dataset.
specify: The result is stored in the current project with the specified
name in the subfolder of the source dataset.
104

3.6 Strain Gauge

3.5.6

Processing

The Start Processing button creates the X/Y Plot using the selected file
range (Source groupbox), the Plot mode, Y-axis and X-axis parameter.
The result is automatically shown in the right part of the dialog.

3.6

Strain Gauge

The Strain Gauge dialog can be reached clicking in the project manager on a
vector field set with right mouse button and selecting the Strain Gauge entry
in the context menu that appears or by pressing the Strain Gauge button in
the toolbar of the project manager (see image shown aside):
The dialog that now opens should look similar to this:

The dialog is used to simulate a virtual strain gauge device attached to any
two points you select on the sample and record the strain development over
time. Alternatively you can extract the local strain (Exx or Eyy ) at a point or
averaged over a rectangular region. Simultaneously the analog signal can be
plotted (usually the force applied by the pulling machine) to compare cause
and effect of the applied force on the sample.
On the top of the dialog next to the displayed images the group Window
Manager allows you to change the number of visible windows as well as to
change the contents of the currently active window (examples are shown further
down).
Below that group another group labeled Settings allows you to define which
values should be extracted and to let you choose how they are calculated.
105

3 Imaging Tools

At the dialog bottom in the Actions group the calculation of the profile results
can be started or any previously calculated profiles deleted from the images.
Furthermore you have an easy access to the export of all profiles as ASCII text
files or a summary table of all magnitudes as ASCII text file.
In the group Analog data choice the analog channel can be selected from
which the data should be extracted. Depending in on the acquisition rate of
the stored analog signal and the camera images there might be a more than
one analog value per image. This raw value trace is plotted as (raw) force
profile. To suppress thermal noise of the analog signal you can filter it first
using a gaussian filter function before extracting the analog value at the time
of image acquisition. The only parameter is the filter length describing the
width of the gaussian curve. This value influences the weight of the neighbor
values Ai (at a temporal distance dt that are included to calculate the filtered
value A(t) at time t.

An (t) = 1/n

+n
X

Ai (t + dt i)

i=n

If the analog signal is noisy, the filtered signal represents a more accurate value
for the force at time t. You can select if you want to use either the (linearly
interpolated) raw force at time t for the strain/force plot or these filtered values
as displayed in green in the (raw) force plot at the bottom of the dialog. Please
refer to the following screenshot:

106

3.6 Strain Gauge

Settings
Here the basic settings how to extract strain values and which units should be
used are selected. The first choice you make is the Extraction mode which
is one of the following:
strain gauge line
Eyy point
Exx point
Eyy area
Exx area
Choosing the first option allows to follow two points on the probe (virtual
extensometer) and calculate the global strain, The next two options calculate
the local strain Exx or Eyy at one ore more specific points only, Choosing the
last two options extract the average local strain Exx or Eyy inside a rectangular
area to improve the signal to noise ratio.
Directly below you find the button labeled Select line, Select point or Select
area depending on the chosen extraction mode. Clicking it the first image of
the recording is shown to select
either two point of a line on the sample that should be followed
or up to ten points on the sample that should be followed. Please stop
the clicking by pressing the SPACE key
or the corner points of a rectangular region on the sample where the
corresponding strain value should be calculated.
Clicking e.g. on the button Select line: you can set two arbitrary points of
your virtual strain gauge on the sample that are followed over time to extract
the profiles. After you have clicked the button the first image of your series
(in most experiments this is the sample at rest) is automatically shown in the
upper left window. Then you select two points by clicking with the left mouse
button on two locations of your sample.
Then you can select the formula that is used to calculate strain. This is:
ELL (t) =

dL(t)
Lo

dL(t)Lo
Lo

( engineering strain )

ELL (t) = log(L(t) Lo ) ( true strain )


107

3 Imaging Tools

Only for large deformations there is a significant difference between so called


engineering strain and the so called true strain or Hencky strain.
Below this selection box you find a number of items which let you specify the
units of extracted values to make the scales of the profiles and the table entries
more readable. The options are as folllows:
Strain Scaling: %=percent, s=strain, ms=milistrain, s=microstrain
Time Scaling: s=seconds, ms=miliseconds, s=microseconds
Length Scaling: m=meter, mm=milimeter, m=micrometer
The other items allow to adjust color and size of the displayed text and the
line width for the arrows shown on each displayed vector field of the set.
There are two more options in the Settings group: One allows to include the
trivial profile point for the first image where implicitly there is no deformation
at all as all deformations are calculated relative to that image.
The other is only available when selecting a line and allows to calculate the
deformation only along the line defined by the two entered points (e.g. vertical). So if you not interested in the dL outside that projection you may check
the corresponding option Projection along selected line. Otherwise dL is
just calculated as the difference of the vectorial lengths |L(t)| |Lo |.
Last but not least you can specify the cross section of the sample (width
and depth) which is used to calculate stress (force/area) over time using as a
function of force, strain and this original cross section. This function is only
available for the extraction modes Eyy point and Eyy area.
Actions
Once you have selected two virtual markers, (or one or several points or a
rectangular area) and set all parameters according to your needs you may
proceed to the bottom part of the dialog to extract the profiles for the chosen
parameter over time. If available also the analog value stored in each image
are extracted as a profile over time. If more than one channel contains data
you may select the analog channel at the bottom in the group Analog data
choice
To (re)create all profiles press the button Calculate new profiles. Then all
vector filed of the set are scanned and the following profiles are put together
with the selected units as well as a summary table containing all data:
L(t), P os(t) over time
dL(t) = dP os(t) over time
108

3.6 Strain Gauge

analog value over strain


strain over time
f orce over time
f orce(raw) over time
f orce over strain
stress over time
stress over strain
spreadsheet view (=table containing all available data)
Here L(t) is the length of the selected line over time which might become longer
as the sample is deforming. dL(t) is the change in length over time L(t)L(0).
If you are using a point or a rectangular area then instead of L(t) the position
P os(t) of the center of the rectangle or the location of the point in each image
is plotted. In this case dP os(t) is the change of the position P os(t) P os(0).
The result can be displayed and arranged to your needs as you can see in the
following screenshots:

If you are happy with the results and want to save the results permanently to
the project press Save results to project. You are asked to provide a name
for the result set. Just press OK if you want to use the default name which
contains the date and time stamp to provide a unique name.
To delete all previously calculated results in the windows press the corresponding button Delete profiles. If you do not delete them the shown overlay will
stay with the images even if you leave the dialog to allow the export with the
Davis Export dialog together with other samples (or the same sample but
other display settings). For further details how to do this please refer to the
chapter about the Export dialog.
109

3 Imaging Tools

Pressing the button in the group Export profiles let you save the profile
or the table selected in the selection box underneath to a text file (*.PRM)
for further evaluation with other programs (for example with a spread sheet
program like Excel). The PRM files contain a header describing the magnitude
and unit for each column then a list of all values is given seperated by blank
space and new lines.
When you are finished press the Close button in the toolbar. Then you will
come back to the project manager.

110

4 About Filter Operations


4.1

Filter Operations

Filter operations play an important role in image processing. They are used for
smoothing, edge detection, texture or contrast enhancement, and many other
special tasks. There are numbers of filters, especially the NxN-filters, which
only operate on the close neighborhood of a pixel. On the other hand, the filter
operations done using the fourier transform are nonlocalized and operate on
frequencies, i.e. structures like sharp edges are analysed in the realm of their
frequency representation.
The FFT-filter are described in an extra chapter. In this chapter the linear
and non-linear neighborhood filters are described.
Among them the most often used ones are the ones, which calculate the new
value of a pixel from a linear combination of the surrounding 8 pixel values and
the value of the center pixel itself. Mathematically this can be represented as
a 3x3-matrix, which is sort of moved over the image to calculate a new center
pixel each time it is applied to a 3x3 area:

a1 fi1,j1 a2 fi,j1 a3 fi+1,j1

0 =
fi,j
b2 fi,j
b3 fi+1,j /divisor
b1 fi1,j
c1 fi1,j+1 c2 fi,j+1 c3 fi+1,j+1
where

a1 a2 a3

b1 b2 b3 /divisor
c1 c2 c3
is the filter matrix. divisor is the final division factor of the sum. Only if
divisor is the sum over the filter matrix elements, the average image intensity
stays the same. For example, if all of the filter elements are 1 (=smoothing)
then divisor is set to 9 in order not to change the average image intensity.

4.2

Smoothing Filter

Smoothing filters are used to eliminate high frequency noise by taking an average over the neighborhood of a pixel.
111

4 About Filter Operations

4.2.1

Smoothing 3x3

1 1 1

1 1 1 /9
1 1 1
This is the simplest smoothing filter and it works well. Function smoothing k
x k is the same matrix, but using up to 99 pixels. Of course, any smoothing
filter will also smooth-out any sharp edges, which are not noise, but physically
real.

Figure 4.1: Original image (left) and 9x9-smoothed image (right).

4.2.2

Gaussian LowPass

This is another good smoothing filter. It takes the center pixel more into
account than the simple smoothing-3x3-filter. Mathematically it is more like
a gaussian curve. Viewed in the frequency realm, the gaussian low-pass filter
is smoother than the simple 1-1-1-filter.

1 2 1

2 4 2 /16
1 2 1

4.2.3

Median Filter

The median filter is a non-linear filter not working with the simple matrix
equation above. The median filter takes a k x k-area (k = 3, 5 or 7) and
sorts all elements according to their intensity. Then the middle element is
stored back as the new center pixel. Just like the other smoothing filter, it will
eliminate high frequency noise. As an advantage it does not eliminate sharp
edges as much as the other filters. On the other hand this filter is non-linear,
112

4.3 Sobel Filter

Original Image

7x7 Gaussian Low-pass

Smoothing 3 x 3

Smoothing 9 x 9

Figure 4.2: Gaussian and Smoothing filters on an example image.

i.e. the average intensity of the image may change. The median filter works
mathematically very similar to the erosion and dilation filter discussed below,
which have a very different behaviour.

4.3

Sobel Filter

The sobel filter will enhance edges. There are four different ones, each one
preferring a different direction. The effect is one of introducing a pseudo-3D
representation of the data.
All of the sobel filters do not use any divisor (=1). The pixels are simply
multiplied with the filter matrix and summed up.
113

4 About Filter Operations

Figure 4.3: Median filter on 3 x 3 area and on 7 x 7 area.

1 0 1

Sobel 1 vertical: 2 0 2
1 0 1

1
2
1

Sobel 2 horizontal: 0
0
0
1 2 1

0 1 2

Sobel 3 diagonal: 1 0 1
2 1
0

2 1 0

Sobel 4 diagonal 1 0 1
0
1 2

4.4

Compass Filter

The compass filters are also edge detection filters. They are named according
to their preferred direction N, NE, E, ... .

1
1
1

Compass-N: 1 2 1
1 1 1

1
1 1

Compass-NE: 1 2 1
1 1 1
114

4.5 Laplace Filter

Figure 4.4: Example for Sobel-1 vertical filter.

1 1 1

Compass-E: 1 2 1
1 1 1
and so on...

4.5

Laplace Filter

Laplace filter will detect edges in any direction. Simply try out the three
different laplacian filter. Laplace-3 is a laplacian of a gaussian filter, i.e. it
incorporates a second derivative to provide a noise-independent edge detection
filter.
Just like the sobel filter the divisor is 1.

0 1 0

Laplace-1: 1 4 1
0 1 0

1 1 1

Laplace-2: 1 8 1
1 1 1

1 2 1

Laplace-3: 2 4 2
1 2 1

115

4 About Filter Operations

Figure 4.5: Example of the Laplace filter.

4.6

Sharpening Filter

These filters enhance the contrast of the image, i.e. the image is sharpened.
Mathematically this is done by adding the original image to the laplacian. The
factor a determines the addition of the edge-enhancing second derivative to the
image. For a = 1 this is a 50% addition.

0
1
0

Sharpness-1: 1 4 + a 1 /a
0

1 1 1

Sharpness-2: 1 8 + a 1 /a
1 1 1

Figure 4.6: Example of Sharpness filter.

116

4.7 Erosion and Dilation Filter

4.7

Erosion and Dilation Filter

Just like the median filter this filter will also sorts the pixels of a 3x3-area
according to their intensity. But instead of taking the middle element, the erosion will take the element before. The effect is a kind of erosion, valley become
deeper and finally the image will be eroded away toward the background level.
The dilation filter does exactly the opposite. It will take the next element after
the middle one in the sorting list. The effect is that edges become sharper and
plateaus flatten and become more even.

Figure 4.7: Examples of erosion (left) and dilation filter (right).

4.8

Fourier Transformation

The Fourier transformation is a linear transformation from space or time to the


frequency domain. Instead of displaying the data in the way it was measured,
after applying the Fourier transform it is viewed as signal strengths of certain
frequencies. Since the base functions of the Fourier transform are orthogonal
and complete, there is no information lost in the transformation. Applying the
inverse Fourier transformation will recover the original data again.
The Fourier transform (FT) is defined using integrals on continuous types of
data. On the other hand, a computer stores digitized values at regular intervals
in space. Here, the Discrete Fourier Transformation (DFT), defined as the sum
over discrete values, must be used. Finally, the Fast Fourier Transformation
(FFT) is just a fast algorithm for computing the DFT, which reduces the
time for calculation tremendously. Due to the fast FFT-algorithm the FFT
became so widely spread as a processing tool for all kinds of data in numerous
applications.
117

4 About Filter Operations

For N-data points there are about NN numerical calculations necessary using
the DFT. Using the FFT this is reduced to Nlog2 (N) which for typical data
sizes like 512 reduces the calculation time by a factor of 57!
The main application of FFTs are in performing filtering techniques, since in
the frequency space many filters can be done by simple multiplication. Most
of the times a low-pass filter is used to eliminate high-frequency noise, or a
high-pass filter may suppress unwanted slow changes in the background.
FFTs are also used as a fast method for computing correlation between two
data ranges, or to compute convolution and deconvolution of signals.

4.8.1

Basic FFT and Inverse FFT on Images

The LaVision DaVis software uses the basic butterfly algorithm enhanced
by the possibility of using arbitrary long arrays of data. Instead of using the
standard 128, 256, 512,... data length, any length of data points can be used (it
must be even, though) while still leading to a very fast algorithm (Singleton).
The time of computation is dependent on how N (the number of data points)
can be separated into factors. If N is close to a prime number (e.g. 2137)
the time of computation is not much faster than in the slow DFT-way of
calculation. If N can be separated into low prime numbers (e.g. 2233)
the algorithm is very fast. Fortunately, the number of pixels used in CCDcameras is most of the times ideal for applying the FFT.
If you take a part of an image for the FFT, simply be aware that some lengths
of data points might require longer times.
The formula for calculating the FFT on some data array xj is:
Fk =
=

1
N
1
N

NP
1
j=0
NP
1

xj ei 2 j k/N
(4.1)
xj (cos(i 2 j k/N ) + i sin(i 2 j k/N ))

j=0

where i is the imaginary number (i2 = 1). The inverse FFT is defined as:
Fk =

NP
1

xj ei 2 j k/N

(4.2)

j=0

The FFT can be applied to 2D-image data horizontally or vertically or both


vertically and horizontally, which is called 2D-FFT.
The horizontal-FFT takes each row of the image and calculates the FFT from
this data array. So, when applied to an image of size NM (N-columns and
M-rows) the resulting image is also of size NM and the first row of the FFTimage is the Fourier transform of the first row of the original image. All rows
118

4.8 Fourier Transformation

are still independent. Spoken in terms of frequencies, the original image is


analyzed, in what respect there are horizontal frequencies (may be visualized
as horizontal arrows) in each of the rows of the original image. The wavelengths
corresponding to the FFT-frequencies correspond to the range of 1 pixel up to
N pixel. The vertical-FFT works the same on columns of the image.
Since the FFT is linear, both the horizontal- and the vertical-FFT can be executed one after the other to yield the 2D-FFT, which is a measure of frequencies
in arbitrary directions. The formula for the 2D-FFT is:

Fnm =

1
NM

M
1 NP
1
P

xjk ei 2 k m/M ei 2 j n/N

(4.3)

k=0 j=0

Since the FFT works in principle on complex numbers and gives as a result
almost always also complex numbers, even if the original data is real, we need
to be concerned about the storage of the FFT-data in the buffers of the DaVisprogram.
First of all, the FFT-operation only works on FLOAT-buffers and it always
stores the result as a FLOAT-buffer. But since the result of the FFT is complex,
we would need to store the result in two buffers, one for the real part and one
for the imaginary part of the data. This would be true in general, but the
software makes use of a feature which is true when the input data is just real
instead of the general complex case.
When the input data is real, then the output data is symmetric in the real
part and anti-symmetric in the imaginary part of the output-data. So only
half the data needs to be stored, the other half is simply the same or negative.
Exactly how the software stores the result of the FFT in a buffer is explained
in an extra section, because it is not so simple to explain and, in general, it is
of no high interest.
What is important, though, is the way where the software stores the low frequencies and where it stores the high frequencies:
Rule:

low frequencies are in the middle of the image,


high frequencies are at the outside.

This is different than what is expected from equation 4.1, where the lowest
frequencies are (k=0,1,...) at the beginning of the output data array, and
the higher frequencies are to the right. The reason why the storage is done
according to the above rule becomes apparent, when standard filters are applied
to the FFT-images, since then the filters are always symmetric around the
center, which makes them very easy to generate.
119

4 About Filter Operations

The lowest frequency (k=0 in equation 4.1), stored at the center, is the average
over all pixels (cos(..) = 1, sin(...) = 0). This average value is stored at the
location N/2-1. For example, if N is 384, then the average is at pixel 384/2-1
= 191 (the first pixel is pixel 0). Or, if the 2D-FFT is used on an image of size
384286 pixel, then the center with the average value is at position (191/142).
The inverse-FFT, of course, takes the storage details into account before using
equation 4.2. The result of the inverse-FFT is only real, since we started with
a real image. Even after applying symmetric filters to FFT-data, the result of
the inverse-FFT will always be real again.

4.8.2

Fast Fourier Transform

The Fast Fourier Transform dialog (see figure 4.8) can be found in DaVis
Classic in the Compute menu. Here it can be easily checked how the Fast
Fourier Transform works on single images.

Figure 4.8: Fast Fourier Transform dialog


Enter the number of your source image in Image buffer on top of this dialog.
You will need three temporary buffers for the resulting FFT (FFT buffer),
the Amplitude and the Phase.
When you press button Do FFT you are asked to enter the number of a
rectangular area to calculate the Fast Fourier Transform of a part of your source
image. The result is shown in the FFT buffer. Enter rectangle number 0 to
use the whole source image. Use menu Rectangle Set to define a rectangular
area. A rectangular region has to be at least 44 pixel.
Calculate the Inverse FFT (button Do IFFT) from your FFT buffer and
store the result in the Image buffer.
120

4.8 Fourier Transformation

Calculate the Amplitude and Phase part of the FFT buffer and show
them on screen.

Figure 4.9: FFT, Amplitude and Phase for an given image.

Button Combine will use the amplitude and phase buffers to recalculate the
FFT buffer.
The FFT computation mode can be horizontal, vertical or 2-dimensional.
Press button Compute Power-FFT, then enter the buffer number of the
result, which will be shown on screen immediately.
Multiply FFTFFT calculates the product of to FFT buffers. You have
to enter the numbers of both source buffers and of the resulting buffer in the
following question boxes.
Multiply FFT(FFT*) works like before, but calculates the conjugatecomplex of the second FFT buffer.
FFT Filter: Apply the active filter (first profile in the profile buffer) to the
image buffer or to the FFT buffer.
Press button Correlation to open the following dialog:

Figure 4.10: Setting the Correlation and Convolution modes for


the FTT dialog.

Select the computation mode and press a button for Correlation or Convolution calculation. Button Close closes the dialog without calculation.
121

4 About Filter Operations

Exercise
Lets use the basic FFT and IFFT functions in the DaVis software. Note that
the FFT functions are only available if you login as Classic user.

1. Load an image into buffer 1.

2. Change buffer 1 into a FLOAT-buffer by making using the Batch Processing in the Compute menu. Use the Group: basic image arithmetic and Operation: word to float. Remember that the FFT only
works on FLOAT buffers.

3. Open the Fast Fourier Transform dialog from the Compute menu.

4. Set the FFT computation mode to 2D. You may also try horizontal
or vertical to see the differences in the output.

5. Run the FFT using the Do FFT button, use all pixels of the image
(enter 0 for rectangle) and store the result in buffer 2.

6. Display buffer 2. Probably you dont see much. Go to resolution 64 or


even multiply buffer 2 by 100 or 1000 using the F7 key and b2=b2*100
in order to see more details.
Notice how most of the image energy is in the center at the low frequencies and at the outer rim of the image, where the high frequency noise is
stored.
122

4.8 Fourier Transformation

7. Run the IFFT using the Do IFFT to convert the image back to normal.
Store the result in buffer 3. If you have multiplied buffer 2 by 100 before,
then the image is 100 times higher in intensity.
Notice that the original image and buffer 3 are for all practical purposes
exactly the same. Differences only appear in some minor digit due to
rounding errors.
8. Run the amplitude calculation using the Calc.Amplitude button and
run the phase calculation using the using the Calc.Phase button.

4.8.3

FFT-Filter

Once the data has been Fourier-transformed, it is easy to apply a standard


frequency filter to it by simple multiplication of the Fourier data with an
equal-length vector, which suppresses or enhances certain frequencies:
Fk0 = Fk Ck k = 0, 1, ..., N 1

(4.4)

where Ck is a frequency dependent filter function usually in the range of 0.0


to 1.0.
There are numerous ways of generating filters. For example, a low-pass filter is
1.0 for low frequencies and goes to 0.0 for high frequencies. A high-pass filter
will be 0.0 for low frequencies and goes to 1.0 for high frequencies.
Translated to our way of storing the FFT-data with low frequencies in the
middle, this means, for example for a low-pass filter, that the value of the filter
function is 1.0 in the middle of the image and goes to 0.0 toward the outer rim
of the image. So a very crude low-pass filter will simply set all pixels outside
an inner rectangle to 0.0 (using the function SetOutsideRectConstant = C).
123

4 About Filter Operations

A filter needs to be defined only over half the image length, since it is symmetric
around the center. For example, if the image size is 200 pixels (in either
dimension) then it is sufficient to define the filter up to pixel 100.
In case the filter function length does not correspond with the image size, or
in case a 2D-filter-function is applied to an image, where the width is not the
same as the height (the standard case), the filter function is extended properly
or cut to length if necessary.
For example, if the FFT has been computed in the 2D-mode, and the image
size is 384286 pixels, and the filter length is two times 100 as in the above
example, then all pixels beyond the end of the filter (100) are set the last value
of the filter function at point N/2, which is 0 in the above example. This
simply means that the low-pass filter is set to 0 for the very high frequencies.
To be more precise, the center of the image is at 191/142, and in horizontal
direction all pixels before pixel 191-100=91 and beyond pixel 191+100=291
are set to 0 and in vertical direction all pixels before 142-100=42 and beyond
pixel 142+100=242 are set to 0.
In the 2D-case the image is multiplied with the filter function vertically and
also horizontally. In the 1D-case, the image is only multiplied once either
horizontally or vertically.
If the filter function is longer than the image data array it is simply cut to
length. Of course, the program always centers the filter function correctly.
Applying a high pass filter it is very important to use the correct filter length,
since cutting the filter to length or extending the filter in length may produce
unwanted results. In the 2D-case it becomes necessary to use two different
filters, vertically and horizontally, of different lengths to account for the fact
that the image height is different from the image width.
Function FFT Filter in the Fast Fourier Transform dialog (see figure 4.8)
will use the first profile of the profile buffer. In the 1D-case the filter is only
applied horizontally or vertically, in the 2D-case it is done in both directions.
Finally you can open the Buffer Operations dialog and use functions
SetInsideRectConstant = C and SetOutsideRectConstant = C for a fast
low-pass or high-pass filter. We advise not to use these functions, though,
since very crude filters will introduce extra noise into the source image as we
show later on.

4.8.4

Using CL to design your own filter

You are not limited to the filter design menu to manipulate the FFT-data.
Since the FFT-data is a standard FLOAT-buffer, it can be processed in any
other way the program allows. Specifically you may design your own filter
124

4.8 Fourier Transformation

function (stored in a profile) and then multiply the FFT-image with the filter
function. Or you may create a complete 2D-buffer to multiply the FFT-data
with.
All functions in the filter design menu are actually CL-macros. The filters are
generated using subroutine MakeFFTFilter() (profile 19), copied to profiles
17 (horizontal) and 18(vertical) and also processed further to account for the
actual image size. Finally, the FFT-data is multiplied with profiles 17 and 18,
either or both vertically and horizontally.
Below is a short CL-programming sequence to show how to use CL to apply a
simple low-pass filter:
// simple horizontal low-pass filter
// let us assume the source image is in buffer 1
GetBufferSize( 1, nx, ny, type )
// check image size
FFT( 1, 0, 0, nx-1, ny-1, 2, 0 )
// horizontal FFT on whole image
// FFT is now in buffer 2
// here comes the definition of the filter function:
SetProfileBoundary( 19, 0, nx-1 )
// set length of profile 19
for ( i = nx/2-1; i<nx-1; i++ )
// right side of filter function
F[ 19, i ] = 1.0 - ( i - nx/2 + 1 ) / ( nx /2 );
// simple straight line to 0.0
for ( i = 0; i<nx/2-2; i++ )
// fill left side of profile symmetrically
F[ 19, i ] = F[ 19, nx - i - 2 ] // center = nx/2 - 1
// pixel 0 = pixel nx-2, 1 = nx-3, ...
B[2] = B[2] * P[19] // apply filter horizontally
IFFT( 2, 3, 0 ) // horizontal IFFT

The next example shows how to multiply a buffer vertically with a profile.
This is not so straight forward, since multiplication of a buffer with a profile
is always done vertically. The trick is to generate a column, which is then
multiplied with the FFT-data.
// Vertical multiplication of buffer 1 with profile 19.
// The result is stored in buffer 2.
B[2] = B[1] // copy buffer 1 to buffer 2
// the important side effect is that buffer 2
// has the same size as buffer 1.

125

4 About Filter Operations

C[2,0] = P[19] // copy profile 19 to column 0 of buffer 2


B[2] = B[1] * C[2,0] // this is the vertical multiplication

4.8.5

The Art of Filter Design

The important rule in defining FFT-filter is that the filter function should be
as smooth as possible. There are only very few exceptions to this rule, for
example, in case it is necessary to filter out a well known frequency, and only
this one.
The transition functions in the filter design menu are chosen so that there is a
smooth transition from one segment to the next.
To illustrate what the effect is of using a crude filter with sharp edges, a sample
image is taken and filtered both with a crude filter and a smooth filter. The
sample image has inside itself a rectangle of intensity 100 while the background
is at 20 counts.

Figure 4.11: Original image wth a small rectangle (top), the FFT
(left) and PowerFFT (right).
126

4.8 Fourier Transformation

First of all we transform the image into Fourier space. Note that the Fourier
transform of a square has the highest value in the center while decreasing
progressively toward the outside. A sharp edge is the superposition of a series
of progressively higher frequencies with progressively decreasing amplitude.
Smoothing is the elimination of the higher frequencies so that the transition
at the edge will be smoother.
Then a crude low-pass filter is applied with function SetOutsideRectConstant
= C in menu Buffer Operation, setting all pixels to zero, which are roughly
more than 10 pixels away from the center. After transforming back with IFFT
we note an interesting effect in the final image. While the edges have been
smoothed as we expected there is also a reverberation of the square in the
rest of the image. The background does not stay constantly at intensity 200,
but is now swinging around 200. The reason for this is that the low frequencies
are now no longer compensated by higher frequencies to produce a stable background. This means that our crude FFT-filter actually introduced additional
noise into the image!
Let us compare it with a smooth filter designed with the filter design menu.
Higher frequencies are not simply set to zero, but fade out toward zero. The
result is that the background is now much smoother than before. Note that
also the top region of the square is also now much more constant at intensity
100.

Figure 4.12: Crude low-pass filter (left) versus smooth filter (right).

127

4 About Filter Operations

4.8.6

Mathematical Operation on FFTs

There are some useful functions in menu FFT math operations to work with
FFT data in more detail.
First of all since the complex FFT data is stored in a kind of scrambled way
to fit into a FLOAT buffer, it is useful to be able to separate the complex FFT
buffer into two buffers where one is the amplitude part of the complex numbers
and the other one is the phase. Mathematically every complex number can be
expressed not only as a real part and an imaginary part, but also in terms of
amplitude and phase, which in case of the FFT data is a much more useful
representation of the real and imaginary values.
Any complex number Fk can be expressed as
Fk = Rk + iIk = Ak ei Pk

= Ak (cos Pk + i sin Pk )

(4.5)

with
Ak =

Rk Rk + Ik Ik

(4.6)

and
Pk = tan RIkk

(4.7)

where Rk and Ik are the real and imaginary part of Fk and Ak and Pk are the
amplitude and the phase of Fk .
The Cal.Amplitude button computes the amplitude image of the FFT image,
the Calc.Phase button computes the phase. Again the low frequencies are
toward the center of the image and the high frequencies are toward the outside.
In the section on data storage there is more detail about where exactly every
Fk of our fundamental Fourier equation (4.1) is stored. The Combine button
will recombine an amplitude and phase image to an FFT-image, which can
then be transformed back using IFFT. Note that these three function must
know the type of FFT-data, whether it is a horizontal, vertical or 2D-FFT,
because in each case the storage of the FFT-data is differently. For example,
when the original image has been transformed using the 2D-FFT mode, then
all subsequent operations must also been done in the 2D-mode, i.e. the FFT
computation mode must stay the same.
The separation of an FFT-image into amplitude and phase can be used to do
some special filtering on the phase. In the standard case, when we apply a
filter to the complete FFT-image, this is the same as if we apply the filter
to the amplitude image only. But there are some special filtering techniques,
which require, for example, to enhance or change the phase separately. There
128

4.8 Fourier Transformation

a number of good books on this topic. See the literature list for references
(page 135).
The most often used application for the computation of the amplitude image
is the computation of the power spectra, which is simply the square of the
amplitude. Function Power-FFT simply computes the amplitude of the FFTimage and then squares the buffer.
Mathematically squaring the amplitude is the same as multiplying a complex
number with its complex-conjugate counterpart. Complex conjugate means
that the imaginary part is changed in sign.
Fk Fk = (Rk + iIk )(Rk iIk )
(Rk Rk iRk Ik + iRk Ik i2 Ik Ik )
(Rk Rk + Ik Ik )

(4.8)

In general the complex multiplication to two different numbers, function multiply A B will compute the complex multiplication between two FFT-images
A and the complex conjugate of B. If B is the same as A, then this function
will compute the power spectrum according the above equation.
Similarly function multiply A B does a complex multiplication without taking the complex conjugate of B. Those two function are mainly used for the
computation of a correlation function or a convolution function.
There is no extra function for complex division, since it is rarely used and
can be generated using the above functions. Defining complex division as
the inverse of the complex multiplication, it can be best visualised in the
realm of amplitude and phase. Here the complex multiplication is simply the
multiplication of the amplitudes while adding the phases:
Fk Gk = (Ak ei Pk ) (Bk ei Qk )
(Ak Bk ) ei (Pk +Qk )

(4.9)

Therefore complex division is the division of amplitudes while subtracting the


phases:
Fk /Gk = (Ak /Bk ) ei (Pk Qk )

(4.10)

In the same way the division by the complex conjugate G is done by adding
the phases.

4.8.7

FFT Data Storage

The FFT data is stored in one FLOAT-buffer using the fact that the Fourier
transform of a real data array is symmetric in its real part and anti-symmetric
129

4 About Filter Operations

in its imaginary part. This means, using the connotation of our basic equation
4.1 and 4.5:
Fk = Rk + iIk with 0 k N 1

(4.11)

the symmetry is given by


R0 = data average
R1 = RN 1 , R2 = RN 2 , ..., RN/2
I0 = 0, I1 = IN 1 , I2 = IN 2 , ..., IN/2 = 0

(4.12)

Stored in the FFT-buffer is only R0 up to RN/2 and I1 up to IN/21 , i.e. a


total of N real numbers. The storage is done in such a way that at the center
of the image is stored R0 and to the right are R1 to RN/2 and to the left are
I1 to IN/21 . The center of the image is at pixel location N/2-1. The highest
frequency is actually N/2, indices higher than that are equivalent to lower
frequencies.
Example: N=10, horizontal FFT. The FFT is stored as:

pix 0
I4
=
-I6

1
I3
=
-I7

2
I2
=
-I8

3
I1
=
-I9

4
R0

5
R1
=
R9

6
R2
=
R8

7
R3
=
R7

8
R4
=
R6

9
R5

Horizontal and vertical FFTs are computed independently. This means that
the 2D-FFT is done by first computing the horizontal FFT and storing the
result in the above form in one buffer, then computing the vertical FFT on
that buffer and again doing the rearrangement. Therefore in the 2D-case the
final storage arrangement is quite complicated. There is actually no need to
compute it, since it is much easier to use function Amplitude and Phase, in
case direct access to each individual FFT-data point is required.
Using equation 4.5 to 4.7 as the definition as the amplitude and phase, functions
Amplitude and Phase will store the result in the following way, again using
our example of N=10:
pix 0
A6
=
A4

and

130

1
A7
=
A3

2
A8
=
A2

3
A9
=
A1

4
A0

5
A1
=
A9

6
A2
=
A8

7
A3
=
A7

8
A4
=
A6

9
A5

4.8 Fourier Transformation

pix 0
P6
=
-P4

1
P7
=
-P3

2
P8
=
-P2

3
P9
=
-P1

4
P0
=
0

5
P1
=
-P9

6
P2
=
-P8

7
P3
=
-P7

8
P4
=
-P6

9
P5
=
0

Similar in the 2D case the storage is (N=8, M=6, Anm ):


A54
A55
A50
A51
A52
A53

A64
A65
A60
A61
A62
A63

A74
A75
A70
A71
A72
A73

A04
A05
A00
A01
A02
A03

A14
A15
A10
A11
A12
A13

A24
A25
A20
A21
A22
A23

A34
A35
A30
A31
A32
A33

A44
A45
A40
A41
A42
A43

Since the power spectrum is the square of the amplitude it is stored in the
same way as the amplitude or phase image.
2D-FFT-filter must be designed in such a way that they are symmetric around
R00 or A00 .

4.8.8

Correlation and Convolution

The Correlation between two arrays of data fi and gi of length N is defined as


Corrk =

1
N

NP
1

f (i) g(k + i)

(4.13)

i=0

The factor 1/N is sometimes omitted, but simply out of practical considerations
it should be included, since otherwise the numbers will get much too big to be
displayed in any way.
Corrk is a measure for how closely the two data arrays agree with each other
when they are shifted by k-data points. Therefore the correlation tells if a
certain structure in one data array appears in the second data array again
up to some displacement vector defined by k. Correlation are, for example,
used for computing flow or particle velocity fields, where two images are taken
shortly one after the other, and the correlation between the two images are
computed. The correlation can be computed on the whole image, giving a
measure of the average flow speed and direction, or it can be done on local
sub-images to compute a 2D-velocity field. The sub-images, of course, must
still be large enough so that in each one there is still enough information to
compute a correlation.
The correlation can be easily extended into 2D:
Corrkl =

1
NM

N 1,M
P 1

f (i, j) g(k + i, l + j)

(4.14)

i=0,j=0

131

4 About Filter Operations

Mathematically it would be very time-consuming to compute the correlation


according to the above equation, especially for a 2D-correlation of two 2Dimage with a large number of pixels. But there is a mathematical relation
between the correlation and the FFT. The correlation is the inverse FFT of
the multiplication of the Fourier transform of the first data array with the
complex conjugate FFT of the second data array:
Corr = IF F T (F F T (f ) F F T (g) )

(4.15)

The time saving is more than a factor of 1000 for a 512512 image. In the
dialog the Multiply FFT(FFT ) button simply computes the correlation
according to the above recipe. First the FFT is computed of the two source
images, the complex multiplication is done and finally the result is transformed
back.

4.8.9

Autocorrelation

The autocorrelation is the correlation of an image with itself. Mathematically


this is simply the inverse FFT of the power spectrum, since the power spectrum
is the result of the complex multiplication F (F ). Of course, this can be
computed with function Correlation by simply entering the same buffer for
both source images. The autocorrelation has always the highest value for
k=0, since correlating the image with itself (without displacement) is a perfect
correlation.

4.8.10

Convolution

The convolution between two arrays of data fi and gi of length N is defined as


Convk =

1
N

NP
1

f (i) g(k i)

(4.16)

i=0

The convolution is nearly the same as the correlation, except that the second
data array has been flipped over. So, for example, it can be used to detect
similar structures in two different images, where the structure has been reversed
in the second image.
Similarly the convolution can be computed via FFT by using
Conv = IF F T (F F T (f ) F F T (g))

(4.17)

Note that the multiplication is without taking the complex conjugate of


FFT(g).
132

4.8 Fourier Transformation

4.8.11

Cyclic versus Non-Cyclic Computations

In the definition of the correlation and the convolution, equations 4.13 and 4.16,
you will notice that the index of, for example, g(k + i) will run out-of-bound
for high ks and is. There are two solutions for this problem:
Cyclic computation:
In this case it is assumed that the source data will repeat itself indefinitely to
the right and left. I.e. the cyclic extension of the data is
g(N ) = g(0), g(N + 1) = g(1), g(N + 2) = g(2), ...
Fk = Rk + iIk = Ak ei Pk

= Ak (cos Pk + i sin Pk )

(4.18)

and similarly to the left in case of negative indices for computing the convolution. The advantage of using the cyclic extension of the data is that the
computation of the correlation or convolution by using the Fourier transform
can be done without further modifications, since the FFT is, by definition, also
cyclic, i.e. it also assumes that the data will repeat itself in every dimension.
Note that in the cyclic case the result is symmetric because a displacement
vector of k is the same as a displacement vector of N-k. Therefore it is sufficient
to look at e.g. the two top quadrants of the image (in the 2D-case), because
the other two quadrants do not contain any additional information.

Figure 4.13: Cyclic autocorrelation

Non-Cyclic computation:
In this case it is assumed that the source data will be 0 outside the specified
data range 0-N-1. I.e. the extension of the data is
g(N ) = 0, g(N + 1) = 0, g(N + 2) = 0, ...
and similarly to the left in case of negative indices for computing the convolution. Another way of understanding this case is that in the equations 4.13
133

4 About Filter Operations

and 4.16 we are only computing the sum for those data values which actually
exist. If any index is outside the bounds, it will not be added to the sum.
This case is most often physically much more meaningful, because there is
usually no reason to assume that the data will repeat itself with just exactly
that period N we choose to sample the data with.

Figure 4.14: Non-Cyclic autocorrelation


Now the question is, if we can compute the non-cyclic correlation and convolution still using the FFT. The answer is YES as long as we use a certain trick
of zero-filling:
The trick is to double the source image and set all new pixels to zero. Then the
FFT is computed just like in the cyclic case. We will end up with a resulting
image twice the size as in the cyclic case, which we then cut in half. Since
we doubled the N (and M in the 2D-case) we need to divide the image by the
factor of 2 (1D) or 4 (2D).
Note that the result of the non-cyclic correlation is not symmetric.
This procedure is done automatically by function non-cyclic correlation and
non-cyclic convolution. Since the FFTs and the IFFT is computed on an image
twice the size, it will take longer than in the cyclic case. Since a number of
intermediate temporary buffers are needed, make sure that you have not used
up all your memory yet. You might have to clean-up your buffers (set them to
zero size) before using these functions.
In some cases it is advantageous to fill only one image with zeros. For example,
doing autocorrelation on parts of an image the best results are achieved, when
a certain sub-image is picked out and stored in a separate buffer, and then
an area twice as big symmetrically surrounding that sub-image is taken as the
counterpart for the correlation and stored in another buffer. The buffer with
the sub-image itself is then doubled in size and filled with zeros. Finally the
correlation is performed.
134

4.8 Fourier Transformation

It is fairly simple to do those steps inside the program. Picking out an area
of interest is done with menu data compression (compression factor = 1).
Changing buffer sizes is done by clicking on the active buffer to go to the
buffer parameter menu. When enlarging a buffer, the newly created areas are
automatically set to 0.
Here it is shown how to do this using CL:
// optimal non-cyclic AUTOCORRELATION of part of an image
// it is assumed that the relevant image is in buffer 1
SetRect( 1, 100, 100, 139, 119 );
// rectangle 1: 40 x 20 pixels in size = sub-image
// (if you let the user specify a rectangle, you
// must make sure that there is enough space around
// the selected rectangle)
SetRect( 2, 80, 90, 159, 129 );
// rectangle 2: 80 x 40 pixels in size
SetBufferSize( 2, 80, 40, 1 );
// make space for sub-image
B(2) = 0; // fill with zeros
SetBufferSize( 3, 80, 40, 1 )
// make space for counter-image
B(3) = 0; // fill with zeros
MoveRect( Pix( 2, 20, 10, 0 ), 1, 1 );
// copy sub-image to center of buffer 2 !!
MoveRect( Pix( 3, 0, 0 ), 1, 2 )
// copy surrounding area
FFT( 2, 4, 2 );
// 2D-FFT of sub-image
FFT( 3, 5, 2 );
// 2D-FFT of surrounding area
MultiplyFFT( 4, 5, 6, 3+2); // 2D-complex mult. A * (B*)
IFFT( 6, 7, 2 );
// inverse FFT = correlation
SetBufferSize( 7, 40, 20, 1 ); // throw away symmetric parts
B(7) = B(7) / 4;

4.8.12

// renormalize

Literature

Adrian RJ, Christensen KT, Liu ZC (2000) Analysis and interpretation of


instantaneous turbulent velocity fields , Exp. in Fluids, 29/3, p. 275-290
Ernst, Dr. E., Einfhrung in die digitale Bildverarbeitung , Franzis Verlag
Jhne, B., Digitale Bildverarbeitung , Springer-Verlag
Jaroslavskij, L.P., Einfhrung in die Digitale Bildverarbeitung , Hthig Verlag
Blahut, R.E., Fast algorithms for digital precessing. Reading, Mass. ,
Addison-Wesley
135

4 About Filter Operations

4.9

Nonlinear Filter

The non-linear filters do not work with the simple matrix equation as the
linear filters do. Each non-linear filter has its specific advantages, but on the
other hand they are non-linear operations, i.e. the average intensity of the
image may change.
For the three filters Median, Erosion and Dilatation a kk area (k= 3,5,7,9
or 11) is taken and all elements are sorted according to their intensities. Then
the elements are stored back following a special rule for each filter.
Median Filter
The middle element of the sorted k k area is stored back as the new center
pixel. It eliminates high frequency noise. As an advantage compared to many
linear filters it does not eliminate sharp edges.
Erosion Filter
The element before the middle element of the sorted k k area is stored
back as the new center pixel. The effect is a kind of erosion. Valleys become
deeper and finally, after having applied the filter several times, the image will
be eroded away towards the background level.
Dilatation Filter
It does exactly the opposite of the Erosion filter. The next element after
the middle element in the sorted k k area is stored back as the new center
pixel. The effect is that edges become sharper and plateaus flatten.
Concentration Filter
Concentrates intensities on the "local maximum" pixel. First of all the filter
searches for pixels whose intensity is a local maximum. The intensity In addition has to be above a background level (set with the parameter noise-level).
If found, it will move the intensities of the surrounding pixels toward the center
to concentrate all power in the middle.

4.9.1

The Math behind NonlinearFilter

Sliding Average Filter:


This filter computes a local average over a specified scale length by computing
the average according to the following equation applied 4-times, by going from
136

4.9 Nonlinear Filter

left to right, from right to left, from top to bottom and from bottom to top
through the image:
Savg (0) = I (0)
and
Savg (i) = (n-1)/n * Savg (i-1) + 1/n * I (i) for i 1
where I(i) is the pixel intensity at a certain pixel i and Savg (i) is the computed
average at that pixel and and Savg (i-1) is the computed average at the previous
pixel. N is the scale length (must be n 2), which corresponds about to the
distance over which the average is computed.
The effect is a sliding average, where each new pixel is added with a small
weighting factor. This type of filter is much faster than any fourier type of
average filter or a linear n n matrix filter, since very few multiplications are
necessary for each pixel, independant on the scale length. There is a small
edge effect at the image borders, but by far not as severe as when using a
FFT-Filter. The only drawback is that the image intensities are shifted a bit
in the direction of processing (an intensity peak becomes smoothed and the
peak center is shifted by n/2). But this is compensated by going not only from
left to right, but also from right to left.
The exact equations for the 4 passes are decribed below:
Going from left to right: For all rows y do:
Savg (x,y) = (n-1)/n * Savg (x-1,y) + 1/n * I (x,y)
Going from right to left: For all rows y do:
Savg (x,y) = (n-1)/n * Savg (x+1,y) + 1/n * Savg (x,y)
Going from top to bottom: For all columns x do:
Savg (x,y) = (n-1)/n * Savg (x,y-1) + 1/n * Savg (x,y)
Going from bottom to top: For all columns x do:
Savg (x,y) = (n-1)/n * Savg (x,y+1) + 1/n * Savg (x,y)
For example, if the scale length is 10 pixel, then
Savg (i) = 0.9 * Savg (i-1) + 0.1 * I (i)
Sliding Minimum Filter:
This filter computes a local minimum over a specified scale length. The filter has the same principle as the sliding average, but with slightly different
equations:
With m = n / 2 half of scale length, do
Step 1: going from left to right: For all rows y do:
137

4 About Filter Operations

fmin = Savg (0,y) = I (0,y)


and
if ( I (x,y) > fmin )
fmin = (m-1)/m * fmin + 1/m * I (x,y)
else
fmin = I (x,y)
Savg

(x,y) = (n-1)/n * Savg (x-1,y) + 1/n * fmin

where fmin is an intermediate variable for storing a sliding minimum over half
the scale length, which again is smoothed over the full scale length.
Step 2-4: same as for sliding average
Note that this filter can still produce sometimes pixel intensities that are
slightly above the original values. The strict sliding minimum filter explained
below is strictly below the original intensities, but is not as smooth as this
filter.
Sliding Maximum Filter:
Same as sliding minimum, only < instead of > in the above equation in step
1.
Strict Sliding Minimum Filter:
Same as sliding minimum, except that none of the resulting pixel intensities
will be below the intensity of the original pixel at a certain position. The
equations are slightly different:
Going from left to right: For all rows y do:
Savg (0,y) = I (0,y)
and
if ( I (x,y) > Savg (x-1,y) )
Savg (x,y) = (m-1)/m * Savg (x-1,y) + 1/m * I (x,y)
else
Savg (x,y) = I (x,y)
Going from right to left: For all rows y do:
Savg (x,y) = min( Savg (x+1,y) (n-1)/n * Savg (x+1,y) +
1/n * Savg (x,y) )
Going from top to bottom: For all columns x do:
Savg (x,y) = min( Savg (x,y-1) (n-1)/n * Savg (x,y-1)
+ 1/n * Savg (x,y) )
138

4.10 Dialog for Linear Filter

Going from bottom to top: For all columns x do:


Savg (x,y) = min( Savg (x,y+1), (n-1)/n * Savg (x,y+1)
+ 1/n * Savg (x,y) )
Strict Sliding Maximum Filter:
Same as strict sliding minimum, only < instead of > in the above equation
in step 1.
Filtering horizontally
Same as the above described modes, but the filters are only applied horizontally, i.e. only performing steps 1 and 2 in the above equations. If one would
like the sliding filter applied only vertically, one needs to rotate the buffer by
90 , apply the filter horizontally, and rotate back 90 .

4.10

Dialog for Linear Filter

The dialog for linear filters (see figure 4.15) can be found in DaVis Classic
in menu Compute. Here the user can choose between predefined filters and
user filters that can be changed by the user.

Figure 4.15: Linear Filter dialog


Select a filter from the list by:
typing the first letter with the keybord
scrolling with the bar on the right or
139

4 About Filter Operations

using the cursor keys of the keybord.


In the info item on bottom of this dialog an explanation about the chosen filter
is displayed.
Button Edit opens a dialog box for the definition of User Filters.
Filter Matrix
Usually the filter operates as a NxN-matrix, which is placed over the image.
(For the selected filter the matrix is always displayed at the bottom of the
dialog box.) The new value of a pixel ( Pij ) is calculated from a linear
combination of the surrounding pixel values and the center pixel ( Pi,j )
itself. The result is normalized by a "divisor".
The 3x3 filter

a1 a2 a3

b1 b2 b3 /divisor
c1 c2 c3
leads to the new value Pi,j :
Pi,j = ( a1 Pi1,j1 + a2 Pi,j1 + a3 Pi+1,j1 +
b1 Pi1,j + b2 Pi,j + b3 Pi+1,j +
c1 Pi1,j+1 + c2 Pi,j+1 + c3 Pi+1,j+1 ) / divisor .
How to Perform Filter Operation
1. Select a filter from the list.
2. Click on "Execute".
3. Enter the source and destination buffer.
4. The result is displayed on the screen.
1D-Vector Filter
There are two predefined vector filters for smoothing over 9 pixel in one dimension (horizontally or vertically). Other 1-dimensional filters can be freely
defined as user filters.
Vector filters are very useful for analyzing, e.g., 1-dimensional spectra, which
have another information on the vertical axis of the image (e.g. space coordinate or time). Maybe, just the spatial axis should be smoothed, but the
spectral resolution on the horizontal axis is kept as it is. In this case use the
vertical smoothing filter.
140

4.10 Dialog for Linear Filter

4.10.1

User Filter

The user can freely define 10 different linear filters. The dialog box in which
all settings have to be made is shown below.

In order to define a new user filter, select it in the list of linear filters (shown
on the page before) and click on Edit to open the dialog box.
Choose the type of linear user filter.
Define the filter by entering the matrix or vector coefficients inside the corresponding field directly.
Further actions (divide by, set outer rim) are defined at the bottom of the
dialog box. They are performed before the result of the filter is stored.
The description entered here will apear below the list of linear filters, when
the filter has been selected (see the page before).
Basically, there are three types of user filters.
NxN matrices: Usual NxN-matrices (N= 3, 5, 7 or 9) that are applied
in the same way as the predefined linear filters. They are defined by
entering the matrix elements in the center field.
NxN separable matrices: They work much faster than the usual matrices. If a matrix is separable (is the product of a vertical times a
horizontal 1D-vector), several steps of the full matrices operations are
redundant. Therefore it can be applied in two steps of vector filter operations: first a horizontal vector, second a vertical vector. These filters
are also defined by entering the elements directly into the vectors.
141

4 About Filter Operations

1D vectors: Vector filters in one dimension.


For seperable matrices and vector filters enter the coefficients into the
vectors (horizontal and/or vertical). Enter normal matrice filters inside the
matrice.
Negative or floating point values can only be stored in image buffers of the
type FLOAT. So it might be necessary to convert the output buffer to a
FLOAT buffer, in order not to lose significant digits of the data.
After performing the matrix (or vector) operation, the result buffer can be
divided by a specified value.
1 (off ): The division is neglected.
sum of coefficients: Choose this divisor in order not to change the
average intensity of the image buffer.
value: Any other divisor can also be defined.
At the rim of the buffer a filter will not work over the same amount of pixels
as in the middle. Therefore the result might differ drastically at the rim,
espacially if a gradient filter is used. Then it might be useful to set the whole
outer rim equal to 0. In the default setting the rim of the result buffer is not
changed.

142

Index

Index
Dialog
AdaptPalette, 95
CreateMask, 91, 97
Fast Fourier Transform, 120
FFT, 120
Convolution, 121
Correlation, 121
LinearFilter, 139
Edit, 141
MaskDefinition, 90
OverlayEditor, 94

143

Index

144

Manual No 1003012 - Release June 22, 2009

LaVision
We count on Photons

LaVisionUK Ltd
Downsview House/ Grove Technology Park
Grove, Oxon, Ox 12 9FF/ UK
www.lavisionuk.com
Email: sales@lavision.com
Tel.: +44-(0)-870-997-6532
Fax: +44-(0)-870-762-6252

LaVision GmbH
Anna-Vandenhoeck-Ring 19
D-37081 Goettingen, Germany
www.lavision.com
Email: sales@lavision.com
Tel.: +49(0)551-9004-0
Fax: +49(0)551-9004-100

LaVision, Inc.
211 W. Michigan Ave., Suite 100
Ypsilanti, MI 48197, USA
www.lavisioninc.com
Email: sales@lavisioninc.com
Phone: +1(0)734-485-0913
Fax: +1(0)240-465-4306

Vous aimerez peut-être aussi