Optimising Dual Lens Calibration

147 views
Skip to first unread message

Nick Harrop

unread,
Apr 27, 2022, 8:10:13 AM4/27/22
to PTGui Support

Hi,

I am working on building a simple dual lens panoramic camera and I am trying to use PTGUI to both calculate the lens distortion parameters for the forward and rear lens as well as calculate the lens-to-lens Roll, Pitch, Yaw offsets between the 2 lenses.  Each lens FOV is around 200Deg.  In this way I can apply a template to any images taken with the camera to produce a complete equirectangular image.

For the lens distortion, I am taking a series of images, approximately every 10 degrees rotation, with the camera mounted on a rotating tripod, so that it rotates around a central point. I then load all images from the front camera into PTGUI. I set a crop, then calculate control points and optimise for FOV, A, B and C. I typically get a result with an average control point distance of less than 1.5. I then save these parameters to the lens database.

 I then repeat this procedure the rear lens. I believe that both lens models are ok based on the output from the optimiser.

The issue I am facing is then the best way to optimise the R, P, Y between the 2 lenses.

Currently, I create a new project and load a pair of images, one from the Front and the matching one from the Rear sensor.  In the lens settings, I add a second lens profile. I load the lens settings, (calculated in the previous step) from the lens database and ensure that in the “Use Individual parameters for images” I set 1 to #1 and 2 to #2. 

I then manually create control points and optimise only for R, P and Y for image 2.  Although, I typically create around 10-20 control points, but even using higher number of control points, I can only manage to get a “good” result with the average control point distance typically around 2-3.  I have tried taking calibration images indoors and outdoors with the same result, although indoors gives poorer results. 

 Having solved for RPY for the rear image, I then save the project as a template and apply it to other images from the camera. 

The issue is that the stitching is always relatively poor, e.g., roof lines can be seen to be not straight and continuous.

I was wondering if there was a method in PTGUI where I could load in all the images (Front and Rear) from my calibration data, rather than only using a single pair of images.  I could then use all image pairs to optimise the R,P and Y which would potentially give a more accurate result than simply relying on a single image pair.

 Apologies for the lengthy explanation.

 Cheers,

nick

Jim Watters

unread,
Apr 27, 2022, 11:28:23 AM4/27/22
to pt...@googlegroups.com

Nick, [resending to list]

You are doing things right. Importantly you are calculating the lens parameters separately using each lens separately.

How to calculate a good average YPR for the second camera to line up with the first?

You can add multiple panoramas to a project in PTGui.

  1. Link all the first images together, and set the YPR to each be 0.
  2. Find control points between the first image and the second image of all the panoramas.
  3. Choose pairs that have lots of features all around the lens.
    1. Maybe setting the camera horizontal so the horizon is at the seam.
    2. Have some with very distant objects and some with close object like inside a large room, or buildings outside. Try to avoid very close objects, at least try not to have control points on these.
  4. Note: because the two lenses are not at the NPP you are only finding a good average that works for most cases.
  5. Remove all but a single pano and create a template with just the two images.
  6. You will still need to find control points to fine tune the pano if they have the seam going through a subject that is close. You may need to add more than just YPR to get a good fit between the images if there is lots of parallax because of a close subject. Maybe adding FoV of the second image.

The other trick instead of loading a whole bunch of panos at once is to keep replacing the images with a new set and adding more control points. This way you never have more that one pano in PTGui at one time.

Similar to the way I documented a method to calibrate the Sphericam. https://www.youtube.com/watch?v=zj2mkMKNYhs

Jim Watters

--
You received this message because you are subscribed to the Google Groups "PTGui Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ptgui+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ptgui/78cdfbaa-064f-4b54-9d2c-d84be428d362n%40googlegroups.com.

Nick Harrop

unread,
Apr 28, 2022, 3:44:42 AM4/28/22
to PTGui Support
Hi Jim,
Many thanks for the reply and the information.  I will follow your instructions and see how i get on. 

Cheers
nick

PTGui Support

unread,
Apr 28, 2022, 5:52:16 AM4/28/22
to pt...@googlegroups.com
Hi Nick,

Just keep in mind that any dual lens camera will suffer from parallax.
Images with parallax cannot be stitched perfectly, there will be
discontinuities in nearby objects around the seams.

Kind regards,

Joost Nieuwenhuijse
www.ptgui.com

On 28/04/2022 10:44, Nick Harrop wrote:
> Hi Jim,
> Many thanks for the reply and the information.  I will follow your
> instructions and see how i get on.
>
> Cheers
> nick
>
> On Wednesday, 27 April 2022 at 16:28:23 UTC+1 Jim wrote:
>
> Nick, [resending to list]
>
> You are doing things right. Importantly you are calculating the lens
> parameters separately using each lens separately.
>
> How to calculate a good average YPR for the second camera to line up
> with the first?
>
> You can add multiple panoramas to a project in PTGui.
>
> 1. Link all the first images together, and set the YPR to each be 0.
> 2. Find control points between the first image and the second image
> of all the panoramas.
> 3. Choose pairs that have lots of features all around the lens.
> 1. Maybe setting the camera horizontal so the horizon is at the
> seam.
> 2. Have some with very distant objects and some with close
> object like inside a large room, or buildings outside. Try
> to avoid *very* close objects, at least try not to have
> control points on these.
> 4. Note: because the two lenses are not at the NPP you are only
> finding a good average that works for most cases.
> 5. Remove all but a single pano and create a template with just the
> two images.
> 6. You will still need to find control points to fine tune the pano
>> <https://groups.google.com/d/msgid/ptgui/78cdfbaa-064f-4b54-9d2c-d84be428d362n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "PTGui Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ptgui+un...@googlegroups.com
> <mailto:ptgui+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ptgui/233b50cc-0877-4f75-abaa-944e91c58d1cn%40googlegroups.com
> <https://groups.google.com/d/msgid/ptgui/233b50cc-0877-4f75-abaa-944e91c58d1cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Nick Harrop

unread,
Apr 29, 2022, 10:12:12 AM4/29/22
to PTGui Support
Hi Jim,
I've spent some time today working on a dataset i took yesterday.   I now, potentially have a "best-fit" solution for the RPY offset between my front and rear-facing sensors based on your advice which i think I am following :).  I suspect that my remaining stitching errors are down to parallax issues as Joost pointed out above.

So my current workflow is:
Capture a series of images with the camera rotated every 10 degrees around a central point. Load the 36 Front facing and rear facing image pairs into PTGUI.

In Lens Settings: 
1. Define 2 x lens profiles and load Front and Rear lens models from the database.
2. Confirm that all Front facing images use Profile 1 and Rear facing images use Profile 2.

In Control Points 
1. Create Control Points for the images taken at heading 1, i.e. Image 1-F and 1-R, then create control points for the next image pair 2-F and 2-R. 
2. Repeat creating control points for the remaining image pairs.   

In Source Images
1. Link all rear facing images.

In Optimizer
1. Run the optimiser for RPY for the link images only.
This seems to provide me with average RPY values based on all image pairs.

In Source Images
Remove all images apart from 1F and 1R.

Save this template and then run the batch workflow on my image pairs using the template i've just saved.  Whilst, not perfect I think that this is giving me the best overall result for the camera that i can achieve.

I'm not certain where there is a more efficient workflow to achieve this result.

cheers,
nick
Reply all
Reply to author
Forward
0 new messages