Difficulties with calibration

25 views
Skip to first unread message

krug.dominik

unread,
Aug 22, 2025, 2:06:21 PM (13 days ago) Aug 22
to openptv
Hi everyone,
 
We are trying to set up an experiment to track particles in turbulence. However, we are having some difficulties calibrating our cameras with the latest version of pyPTV at the moment.
 
So far, we have managed to run a single-plane calibration with a semi-planar target at constant z (z=0mm and z=-2mm). However, when we triangulate the same images as the ones used for calibration, we get a plane that is tilted (points do not have constant z). To us, it seems like the camera positions and orientations in the .ori files after calibration are reasonable, and the .txt file with 3D coordinates is correct, so we are not sure what we should also check. It would be great if someone can point us in the right direction.

Here are some files which we think will be useful:
  1. The pyptv folder for this case (SinglePlaneMWE.zip).
  2. The triangulated positions plotted from res/rt_is.123456789
  3. A picture of the setup and a sketch of the camera positions. (xcam,ycam,zcam) = (250mm,420mm,520mm)approximately in air. Note that cameras 1 and 2 are hanging upside down, so their images are inverted. We put individual prisms that is filled with water in front of the cameras to eliminate refraction as shown in the attached images.
  4. An image that shows the indexing of the points of the calibration target. The point labelled 1 corresponds to 5001 in cal/z25mm_calpoints.txt, 2 to 5002, etc.
 
Please let us know if more information is needed.

Thanks and best regards,
Dominik on behalf of Duco and Timothy

PrismsInFrontOfCameras.jpeg
SinglePlaneMWETriangulatedPts.png
SinglePlaneMWETriangulatedPts.fig
SinglePlaneMWE.zip
CameraPositionSketch.png
CalibrationTargetPoints.png
Cameras_annotated.jpeg

Alex Liberzon

unread,
Aug 22, 2025, 4:58:08 PM (13 days ago) Aug 22
to openptv
Hi Dominik, 

Nice to see you use OpenPTV through PyPTV. Regards to Duco and Timothy. 

I tried to calibrate with the new PyPTV (note it's 0.4.0 and uses YAML instead of parameters/ directory). I attach here the YAML file. When I run it first time, the YAML is built automatically from the parameters/ folder 

The only problem I found was the glass vector - you used 0,0,0 but the idea is to use 0,0,1 i.e. a window is perpendicular to Z axis or parallel to the x,y plane. Now, when I plot the 3D target and RT_is.123457698 file, they look identical with 2 planes of Z 

Please let me use this case as another example on the OpenPTV GitHub repo - it has an interesting case of 2 cameras rotated around their own axis. 

Alex
z25mm_cam4.tif.ori
parameters_Run1.yaml
z25mm_cam2.tif.ori
draw_3d_rt_is.py
Figure_1.png
z25mm_cam1.tif.ori
z25mm_cam3.tif.ori

krug.dominik

unread,
Aug 25, 2025, 11:53:22 AM (11 days ago) Aug 25
to openptv
Dear Aleks,

thanks so much for the super quick help! My own PTV skills have gotten a bit rusty, it seems.. 

And of course happy for you to use the case in the repo!

Best regards,
Dominik

Timothy Chan

unread,
Aug 25, 2025, 11:53:29 AM (11 days ago) Aug 25
to openptv

Hi Alex,

Thanks for pointing out the problem so quickly and for admitting me to this group. Of course you can use this as another example case.

I notice that that the focal distance in the .ori files never changes from my initial guess in the calibration (even if I check 'cc' in Calibration Parameters > Calibration Orientation Param). Is there a way to include the focal distance as a calibration parameter?

Timothy

Alex Liberzon

unread,
Aug 25, 2025, 11:54:47 AM (11 days ago) Aug 25
to openptv
Hi Timothy, 

This seems to be a bug. Definitely, when we change the checkbox, it should change. Please add an issue to the openptv or pyptv github. I'll make a note to myself to check it. 

Alex Liberzon

unread,
Aug 25, 2025, 12:16:20 PM (11 days ago) Aug 25
to openptv

Alex Liberzon

unread,
Aug 25, 2025, 12:34:49 PM (11 days ago) Aug 25
to openptv

I checked and it does change on my machine. Please see what's printed in your command line when you run calibration. 

On Monday, August 25, 2025 at 6:54:47 PM UTC+3 Alex Liberzon wrote:

Timothy Chan

unread,
Aug 25, 2025, 2:57:02 PM (10 days ago) Aug 25
to openptv
Hi Alex,

Thanks for looking into it. I tried changing the focal distance of camera 3 (z25mm_cam3.tif.ori) to 220 from the original value of 225. Pressing 'raw orientation' does not change the focal length, only the camera position. Only after pressing 'fine tuning', cc changes very slightly from 220.0 to 219.9998 (The terminal output is attached.). By extension, this would imply that the initial guess for the focal length needs to be very accurate? At the moment, I estimate it according to the suggestion in manual :
'For example, if we have a ratio of world image to chip image of 500 mm to 65 mm (384 pixels is therefore corresponding to 17 microns), e.g. 1:8. The distance from lens to calibration target is about 800 mm. Hence the focal distance is about 100 mm.' 
I wonder whether this estimate is good enough if the calibration only changes the focal length so slightly.

I am asking this also in the context of multiplane calibration (which I am testing), where I imagine the accuracy of the focal distance affects the quality of the calibration.
TerminalOutput.png

Alex Liberzon

unread,
Aug 25, 2025, 3:50:09 PM (10 days ago) Aug 25
to openptv
We could meet on Zoom and discuss the calibration. Yes, the focal plane changes when we run fine-tuning; previously, it was just a match with the position and angles, without any other variations. 

If you need to change the focal distance completely, you'll have to work hard through the initial guess. I changed (see on GitHub) camera 3 to match the others, and it adjusted the Z distance accordingly. However, all cameras appear to be "close enough" to each other in terms of values, i.e., symmetric. I cannot confirm whether this z-distance is correct, but it should be verified before we set the focal length. 

The test compares the calibration file to the rt_is. file in the /res folder - it seems close to me. 

Multiplane is a longer story, and yes - it's best to start only after you have a good initial guess for a single plane. 
Reply all
Reply to author
Forward
0 new messages