3D PTV

3D-PTV

3D Particle Tracking Velocimetry software on Github ( http://3dptv.github.com )

Read the News

Dumbbell calibration

The files to repeat what is described in the following are stored in "working_folder_Dumbbell_b" on svn.origo.


Contents

Basic idea

Sometimes it is inconvenient to position a calibration target. Either because there is something in the way, like in the case of the aorta replica, or because it is cumbersome to get the entire target again out of the observation domain. It would be much easier to move a simple object randomly around the observation domain and from this perform the calibration.

This is what "Dumbbell calibration" is doing. The simple object is a dumbbell with two points separated at a known distance. A very rough initial guess is sufficient to solve the correspondence problem for only two particles per image. In other words, the tolerable epipolar band width is very large: large enough to also find the correspondence for a very rough calibration, but small enough so as not to mix up the two points. From there on, calibration optimizes the distances by which the epipolar lines miss each other, while maintaining the detected distance of the dumbbell points.

Unlike previous calibration approaches, Dumbbell calibration uses all camera views simultaneously. The "Gauss Markoff Model", based on linearized derivatives of an error function, would definitely blow up for this task (I have tried) and therefor a very simple, slower, but very robust algorithm is used. The algorithm computes sequentially local derivatives of the error function (epipolar mismatches and dumbbell pair distance mismatch) and follows this gradient. It is a simple gradient descent algorithm. Mind you, the poor algorithm has to optimize 36 parameters, 4*3(cam positions)*3(cam angles)*1(focal fistance)*2(dx dy chip position).

Required input

Somehow, an object with two well visible points has to be moved through the observation domain and recorder. The dumbbells points should be separated by roughly a third of the observation scale. In our example we use two 5mm beads that are spaced 46.5mm in an observation domain of roughly 15cm. We recorded 300 frames at a rate of 20Hz. This is slow enough for good illumination, but still fast enough to capture the movements of the dumbbell which was moved manually through the domain.

Note that the accuracy by which these dumbbell points can be determined in 2d, also defines the possible accuracy in 3d. With 5mm point radii we will be lucky to get a 3d point accuracy less than 1mm. Thus, for real (this is just a feasibility example), the dumbbell points should be as small and as accurate as possible.

Processing

Pre-processing images

The 3D-PTV 2d detection is rather slow for large particles that cover many pixels. We therefore used a Matlab detection routine to create _target files (_target files contain the results of the 2d image processing). in  /trunk/Matlab there is a  detection_proc_matlab_db.m subroutine that does the job, optimized for the current dumbbell images. Tune it for your need. The result is the _targets files in the /img directory


Processing

The processing is rather simple. After defining in "main parameters" the sequence (names and first and last file number) click "Orientation->Orientation from Dumbbells". That's it and you have to wait O(2min).

The algorithm in the meantime performs the following steps:

  • It establishes correspondences and - only if precisely two points are found per frame - store the positions and links to the _target files in db_is.xxx files (same format as rt_is.xxx).
  • From this the routine "prepare_eval" creates a list of corresponding 2d image points, which will be fed into the new "orient_v4" routine. The list is stored in crd[cam_num][point_id].x and crd[cam_num][point_id].y.
  • "orient_v4" minimizes the epipolar mismatches while enforcing the correct dumbbell points distances.
  • The routine "eval_ori_v2" is the core function of this approach, as it evaluates the residual for the current crd-list and camera parameters.


Before clicking again you may want to change the sequence numbers or other parameters, in order not to over-train the calibration. All controlling parameters are stored in the file parameters/dumbbell.par it contains 6 parameters:

  • epipolar tolerance (mm) (in our example it is set to 5)
  • distance of dumbbell points (mm) (in our example it is 46.5mm)
  • factor controlling the "speed" of the gradient descent step size (default value: 1, use 2 for beginning and 0.05 for fine tuning)
  • weight to enforce the distance of dumbbell points (default value is 1)
  • step size through the sequence (for speed it can be better to sample a set with steps of 3 or so)
  • number of iterations (a typical value is 500)


Console output

For each iteration step four values are written to the console:

  • eps_tot(=eps_epi+weight*eps_dist): Total relative calibration error, sum of epipolar mismatch and of dumbbell scale mismatch
  • eps_epi: Average of distance between corresponding epipolar lines normalized by the measured(!) dumbbell scale.
  • eps_dist: Relative dumbbell scale error.
  • current number of iterations


back to Documentation and manual

Somewhat better explanation for dumbbell calibration parameters

I copy the dumbbell.par file and try to explain more:



3
25
0.05
1
1
500

Explanation for parameters:


1: eps (mm)
2: dumbbell scale
3: gradient descent factor
4: weight for dumbbell penalty
5: step size through sequence
6: num iterations per click


  1. eps(mm) is now set to 3mm. It is the tolerable bandwith by which epipolar lines are allowed to miss each other during calibration
  2. the dumbbell scale is quite important: Here it is 25mm. Since the algorithm optimizes two targets,
    • the epipolar mismatch and
    • the scale of the dumbbell particle pair.
  3. if everything would be linear then a factor of 1 would converge after one step. Generally one is a bit instable though, so a more careful, but slow, value is 0.05. But I encourage you to play with it yourself and try.
  4. this is the relative weight that is given to the dumbbell scale penalty. with one it is equally bad to have dumbbell scale of only 24mm and to have epipolar mismatch of 1mm. Usually I reduce this value to 0.01-0.2 after rough convergence, since it is difficult to precisely even measure this scale.
  5. well, it is step size. It could be different to 1 when the dumbbell recording is very long with successivee images that are almost identical, then step size of 10 or so might be more appropriate.
  6. well, this is clear, I find 500 a good value for the begin and later to really fine tune the calibration with careful values for 3) I run the thing over night for say 5000 steps or so.