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 asrt_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
andcrd[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
Somewhat better explanation for dumbbell calibration parameters
I copy the dumbbell.par file and try to explain more:
Explanation for parameters: