--- layout: default title: 3D-PTV Benchmark project ---

Benchmark of 3D-PTV software using PIV Standard Images project

Introduction

Recent WG1 meeting in Zurich was our Experimental Workshop. It was roposed during that meeting that we develop few test cases that different research groups can use to test their own algorithms and software.
The report of the groups will help to identify those performing best at different stages of the analysis and to expose the best practices to the other members of the action. There is a single important condition - open science. The codes, algorithms, data should be open to all the members of the action. The main goal is to make particle tracking better and accessible.



Benchmark proposal 1

We propose to start with the synthetic images, created from a known velocity field. Such images and data are available from the PIV Standard Images Project [1]. Here we describe the test case #377 (which is slightly more tricky due to an unknown wall reflection and camera positions).

we keep a mirror copy of the data for the case 352 on case 352 copy


im377.jpg


Here we first copy the original description of the experimental conditions from their case 377 website

  1. No.      377    Unit
  2. Image Size      256 x 256       pixel
  3. Area    1 x 1   cm
  4. Laser Illumination      Volume  mm
  5. Interval        0.001   sec
  6. Max. Velocity   10      pixel/interval
  7. Max. out-of-plane Velocity      ??      %
  8. DATA DOWNLOAD
  9.  
  10. * The format of the images are RAW data.[64KB]
  11. * The particle data file[100KB] contains; (1) particle ID, (2-4) particle 3d location [x,y,z] (cm),
  12. (5,6) particle location in Image 0 [X,Y] and (7,8) particle location in Image 1 [X,Y] and
  13. (9,10) particle location in Image 2 [X,Y] and (11) maximum intensity of the particle [I].
  14. The particle ID is unique, so that the same particle location could be correctly tracked with using
  15. the serial particle files. Please see the example
  16. * The vector file[50KB] contains; (1-3) node of the image (X,Y,Z) [cm] and (4-6)
  17. vector (U,V,W) in the unit of [cm/s] Please see the example
  18.  
  19.  
  20. PIV Three-dimensional Standard Images    #377
  21.  
  22.  
  23. Generator:  K. Okamoto  (Univ. Tokyo)
  24. Program:    ddr.c
  25. Date:       March 27, 1998
  26.  
  27.  
  28. Parameters:
  29.  Target Flow Field:  Jet impinging on the Wall
  30.  Reynolds Number:    3000
  31.  
  32.                       2cm
  33.          ------------|   |------------
  34.                        |  15cm/s
  35.                        V
  36.  
  37.  
  38.                     XXX
  39.                     XXX
  40.          -----------------------------
  41.  
  42.  Number of Particles inserted in the field      40000 Particles
  43.  Number of Particles visualized in one Image      500 Particles (average)
  44.  
  45.  Diameter of Particles      5 pixel (average)
  46.                             2       (standard deviation)
  47.                             1       (minimum)
  48.  
  49.  Maximum Velocity                 12 cm/s
  50.  Target Flow field                5mm x 5mm x 5mm
  51.  Time Interval between images     1 msec
  52.  
  53.  Laser Illumination               Cylindrical from bottom (radius = 1cm)
  54.  
  55.  Water refractive index           1.33
  56.  Wall distance                    7 mm from center
  57.       orientation                 y-direction  (simulate impinging plate)
  58.  
  59.  Camera positions
  60.     #0  (x,y,z) = (5.77, -10, 0)
  61.  
  62.     #1  (x,y,z) = (-2.88, -10, -5)
  63.  
  64.     #2  (x,y,z) = (-2.88, -10, 5)
  65.  
  66.  
  67.   Small Orientation variations were considered.
  68.  
  69.  
  70.                                     ^ y
  71.                                     |
  72.                                     |/
  73.                         ------------+---------------> x
  74.                               #2   /|
  75.                                   / |      #1
  76.                           #3     /
  77.                                 /z
  78.                                L
  79.  
  80.  
  81.            Side View              ^
  82.                              Jet  | y-axis
  83.                                   |
  84.                                  O| Particles
  85.                     --------------+-----------------> x-axis
  86.                                  /|        n=1.33(water)
  87.                     ==============|2mm==================
  88.                                /  |        n=1.33(acryl)
  89.                     ==============|7mm================== WALL
  90.                              /    |        n=1.00(air)
  91.                             /     |
  92.                            /      |
  93.                           /       |
  94.                         #2,3      |        #0 camera
  95.                      camera       |
  96.                                   |
  97.  
  98.             The wall surface is (y=-7mm)
  99.             Jet impinging plate is (y=-2mm)
  100.             Visualized region is (-2,-2,-2) < (x,y,z) < (2,2,2)mm
  101.  
  102.  
  103.  
  104.  
  105. Image Files (imX???.raw)
  106.  
  107.   X:    camera# (0-2)
  108.   ???:  serial# (000-200)   Total 200msec
  109.  
  110.   Image size  256x256 pixel (8bit:256)
  111.  
  112.  
  113.  
  114.  Calibration File (imX999.raw)
  115.    Particles (Total 125 particles)
  116.      x = -0.2, -0.1, 0, 0.1, 0.2 cm
  117.      y = -0.2, -0.1, 0, 0.1, 0.2 cm
  118.      z = -0.2, -0.1, 0, 0.1, 0.2 cm
  119.  
  120.  
  121.  
  122. Vector files  (vec???.dat)
  123.  
  124.    x      y      z        u         v         w
  125.  -0.80  -0.80  -0.80   0.17542  -4.51977   0.01204
  126.  -0.80  -0.80  -0.60  -0.18245  -4.11870  -0.26516
  127.  -0.80  -0.80  -0.40  -0.78761  -3.38484  -0.41633
  128.  
  129.    unit: x,y,z  [cm]
  130.          u,v,w  [cm/s]
  131.  
  132.  
  133. Particle Files  (ptc???.dat)
  134.                              #1 camera     #2 camera     #3 camera  intensity
  135.    ID    x      y      z      X      Y      X      Y      X      Y
  136.     4 -0.301  0.584  0.893 147.61  64.91  95.55  65.10  53.07  65.92 208.18
  137.     6 -0.898  1.266 -0.258   0.00   0.00   0.00   0.00  46.22   0.15 208.69
  138.     8  1.178  0.886  0.149 249.88  38.07 251.10  35.42 219.99  32.46 191.52
  139.     9  0.720 -1.242 -0.530 183.76 252.88 201.24 254.40   0.00   0.00 211.21
  140.  
  141.    unit: x,y,z  [cm]
  142.          X,Y    [pixel]
  143.  
  144.    The particle ID is unique number, therefore, the same particle could
  145.    be easily tracked with checking the ID for serial particle files.
  146.  
  147.  
  148. If you have any questions, please contact Dr. Okamoto
  149. (okamoto@tokai.t.u-tokyo.ac.jp)


Prerequisites

  1. 3D-PTV software (it requires ActiveTCL 8.4.x)
  2. post-processing software
  3. Matlab (meanwhile, we're trying to move it all to Python/Numpy/Matplotlib)

Download and prepare the test case

  1. Download the images, point and vec files from the origional website using [2] .
  2. Create 3D-PTV directory:

  1. C:/PTV/case377
  2.  
  3.         /img
  4.  
  5.         /res
  6.  
  7.         /cal
  8.  
  9.         /parameters

  1. Convert RAW images into TIFF (8 bit) images using IrfanView (on Windows), ImageMagick or Matlab. The name convention is cam1.XXX cam2.XXX cam3.XXX (not .tif extension)
  2. Use the attached [3] Matlab file (remove .txt extension) to generate the calibration images and necessary ASCII files (see  >> help ptc999_to_man_ori_377 for more information).
  3. The orientation of the cameras turned to be quite tricky as the authors didn't mention the rotation around the imaging axis. Never mind, the ORI files are attached (remove .txt extension) . These could be significantly improved using iterative SHAKING algorithm of Beat.

Sample run

  1. If all the previous steps were successful, then running  start.bat will open the main window. From there, Start, then Tracking -> Sequence/Tracking will be the fastest way of checking it. At the end, Tracking -> Show trajectories should show something of the kind:

Prepare calibration

  1. function ptc999_to_man_ori_377(dir1,dir2,midplane)
  2. % PTC999_TO_MAN_ORI_377(DIRNAME1,DIRNAME2,MIDPLANE)
  3. % takes the PTC999.DAT file from DIRNAME1 as an input
  4. % and generates all the necessary files for the 3D-PTV software
  5. % (almost) automatic calibration in DIRNAME2:
  6. % MAN_ORI.DAT
  7. % MAN_ORI.PAR in /parameters
  8. % CAL377.TXT
  9. % CAM1.TIF, CAM2.TIF, CAM3.TIF in /cal
  10. %
  11. % There is only CAM1-3.TIF.ORI files are missing.
  12. %
  13. % MIDPLANE = 0 or 1 (false or true) - useful if only the midplane
  14. % points are used for the calibration.
  15. %
  16. % Author: Alex Liberzon
  17. %
  18.  
  19. if ~nargin
  20.     dir1 = 'c:\PTV\benchmarks\piv_std_377\ptc\';
  21.     dir2 = 'c:\PTV\Software\sortgrid_from_initial_guess_Oct09\case377\';
  22.     midplane = 0;
  23. end
  24. % PTC999_TO_MAN_ORI_377
  25.  
  26. % read ptc999.dat file from the case 377
  27. d = load(fullfile(dir1,'ptc999.dat'));
  28.  
  29. cal = fullfile(dir2,'cal377mid.txt');
  30. dat = fullfile(dir2,'man_ori.dat');
  31. par = fullfile(dir2,'parameters','man_ori.par');
  32. cam1 = fullfile(dir2,'cal','cam1.tif');
  33. cam2 = fullfile(dir2,'cal','cam2.tif');
  34. cam3 = fullfile(dir2,'cal','cam3.tif');
  35.  
  36. % cm -> mm
  37. d(:,2:4) = d(:,2:4)*10;
  38.  
  39. % transform axis: x->x y->-z z -> y
  40. tmp = d;
  41. d(:,3) = tmp(:,4);
  42. d(:,4) = -tmp(:,3);
  43.  
  44. % indices:
  45. % d(:,1) = d(:,1) + 1;
  46.  
  47. % if one plane only:
  48. if midplane
  49. midplane = find(d(:,4) == 0);
  50. d = d(midplane,:);
  51. d(:,1) = 1:size(d,1);
  52. id = [1,5,21,25];
  53. else
  54.     d(:,1) = d(:,1) + 1;
  55.     id = [1,5,121,125];
  56. end
  57.  
  58.  
  59. % write cal377.txt
  60. fid = fopen(cal,'w');
  61. fprintf(fid,'%5d %9.4f %9.4f %9.4f\n',d(:,1:4)');
  62. fclose(fid);
  63.  
  64. % choose points
  65. id = [1,5,21,25];
  66. fidpar = fopen(par,'w');
  67. fiddat = fopen(dat,'w');
  68. for i = 1:4
  69.     fprintf(fidpar,'%3d\n',d(id,1));
  70. end
  71. for i = 1:4
  72.     fprintf(fiddat,'%6.3f %6.3f\n',d(id(i),5:6));
  73. end
  74. for i=1:4
  75.     fprintf(fiddat,'%6.3f %6.3f\n',d(id(i),7:8));
  76. end
  77. for i=1:4
  78.     fprintf(fiddat,'%6.3f %6.3f\n',d(id(i),9:10));
  79. end
  80.  
  81. fclose(fidpar);
  82. fclose(fiddat);
  83.  
  84. % generate images:
  85. % Image generation parameters
  86. Radius = 2;
  87. sx = 256;
  88. sy = 256;
  89.  
  90. %% Cam1
  91. x = d(:,5);
  92. y = d(:,6);
  93. % figure, scatter(x,y)
  94. bw = uint8(zeros(sx,sy));
  95. for j = 1:length(x)
  96.     output_coord = plot_circle(x(j),y(j),Radius);
  97.     bw = imadd(bw,uint8(poly2mask(output_coord(:,1),output_coord(:,2),sx,sy)));
  98. end
  99. bw(bw>0) = 255;
  100. % figure, imshow(bw)
  101. imwrite(bw,cam1,'tiff','compression','none')
  102.  
  103. %% Cam1
  104. x = d(:,7);
  105. y = d(:,8);
  106. % figure, scatter(x,y)
  107. bw = uint8(zeros(sx,sy));
  108. for j = 1:length(x)
  109.     output_coord = plot_circle(x(j),y(j),Radius);
  110.     bw = imadd(bw,uint8(poly2mask(output_coord(:,1),output_coord(:,2),sx,sy)));
  111. end
  112. bw(bw>0) = 255;
  113. % figure, imshow(bw)
  114. imwrite(bw,cam2,'tiff','compression','none')
  115.  
  116. %% Cam1
  117. x = d(:,9);
  118. y = d(:,10);
  119. % figure, scatter(x,y)
  120. bw = uint8(zeros(sx,sy));
  121. for j = 1:length(x)
  122.     output_coord = plot_circle(x(j),y(j),Radius);
  123.     bw = imadd(bw,uint8(poly2mask(output_coord(:,1),output_coord(:,2),sx,sy)));
  124. end
  125. bw(bw>0) = 255;
  126. % figure, imshow(bw)
  127. imwrite(bw,cam3,'tiff','compression','none')


Attachment Size
ptc999_to_man_ori_377.m.txt 2.96 KB
cam1.tif_.ori_.txt 303 bytes
cam2.tif_.ori_.txt 303 bytes
cam3.tif_.ori_.txt 303 bytes