Forum

Author Topic: Metashape 1.8 / 2.0.3 - Export undistorted images  (Read 14073 times)

tazzo

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Metashape 1.8 / 2.0.3 - Export undistorted images
« on: October 24, 2023, 05:09:18 PM »
Hello,

I tried File/Export/Convert Images to export undistorted images. The "transform to initial calibration" is checked, but output files are identical to input images.

In Tools/Camera Calibration I have set the initial with the calibration data (so now is identical to the Adjusted tab), but this seems not to work.

Here the calibration images I used https://we.tl/t-i5htm5bYTT and attached the screenshoot of the calibration parameters Metashape calculated.
« Last Edit: October 25, 2023, 02:39:23 PM by tazzo »

tazzo

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Re: Metashape 1.8 - Export undistorted images
« Reply #1 on: October 25, 2023, 02:31:56 PM »
Hello all,

I tried to verify the distortion parameters with another software compatible with the Brown-Conrady model (as documented in the Metashape Manual) and attached the result.

In this software I have a k0 parameter that should be fixed to 1.0 to have the same Metashape formula. Cx and Cy are set to 0.5 (so in the middle) because the calibration displacement (in pixels) is very small. Tangential parameters are ignored because very small and set to 0.0.

Anyway seems that the calibration is actually very off. Is this why Metashape is ignoring it during the export?

tazzo

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Re: Metashape 1.8 / 2.0.3 - Export undistorted images
« Reply #2 on: October 25, 2023, 02:41:25 PM »
I tried with Metashape 2.0.3 build 16960 and I get very similar results, here the console Log

Code: [Select]
CalibrateCamera: f, cxcy, k1-k3, p1, p2
2023-10-25 13:36:31 Calibrating lens...
2023-10-25 13:36:32 corners hessian: 0.035 non-maxima: 0.032 correspondences: 0.654 refine: 0.11
2023-10-25 13:36:33 corners hessian: 0.03 non-maxima: 0.034 correspondences: 0.366 refine: 0.11
2023-10-25 13:36:33 corners hessian: 0.014 non-maxima: 0.009 correspondences: 0.205 refine: 0.1
2023-10-25 13:36:34 corners hessian: 0.03 non-maxima: 0.032 correspondences: 0.187 refine: 0.077
2023-10-25 13:36:35 corners hessian: 0.017 non-maxima: 0.008 correspondences: 0.562 refine: 0.11
2023-10-25 13:36:35 corners hessian: 0.031 non-maxima: 0.033 correspondences: 0.44 refine: 0.099
2023-10-25 13:36:36 corners hessian: 0.031 non-maxima: 0.034 correspondences: 0.621 refine: 0.11
2023-10-25 13:36:38 corners hessian: 0.032 non-maxima: 0.033 correspondences: 0.907 refine: 0.108
2023-10-25 13:36:38 corners hessian: 0.031 non-maxima: 0.033 correspondences: 0.572 refine: 0.111
2023-10-25 13:36:39 corners hessian: 0.017 non-maxima: 0.008 correspondences: 0 refine: 0.025
2023-10-25 13:36:39 corners hessian: 0.032 non-maxima: 0.033 correspondences: 0.179 refine: 0.103
2023-10-25 13:36:40 corners hessian: 0.018 non-maxima: 0.01 correspondences: 0.648 refine: 0.111
2023-10-25 13:36:41 corners hessian: 0.032 non-maxima: 0.033 correspondences: 0.598 refine: 0.108
2023-10-25 13:36:42 corners hessian: 0.032 non-maxima: 0.032 correspondences: 0.668 refine: 0.164
2023-10-25 13:36:43 corners hessian: 0.03 non-maxima: 0.032 correspondences: 0.691 refine: 0.114
2023-10-25 13:36:43 lm opt: xxxxxxxxxx 2.06755 -> 0.341846
2023-10-25 13:36:43 lm opt: xxxxxxxx 0.325542 -> 0.324358
2023-10-25 13:36:43 lm opt: xxxxxxx 0.316869 -> 0.316489
2023-10-25 13:36:43 reprojection errors: min = 0.000798391 avg = 0.562573 max = 2.55666
2023-10-25 13:36:43
2023-10-25 13:36:43 Calibration results:
2023-10-25 13:36:43 -----------------------------------------
2023-10-25 13:36:43 EXIF focal length: 3.37
2023-10-25 13:36:43 F = 1387.29 +- 0.874451
2023-10-25 13:36:43 Cx = -2.1682 +- 0.744479
2023-10-25 13:36:43 Cy = 14.8666 +- 0.618627
2023-10-25 13:36:43 K1 = 0.158559 +- 0.00249776
2023-10-25 13:36:43 K2 = -0.464342 +- 0.0147186
2023-10-25 13:36:43 K3 = 0.377462 +- 0.025755
2023-10-25 13:36:43 P1 = -0.00309609 +- 0.000214457
2023-10-25 13:36:43 P2 = -0.000456081 +- 0.00016084
2023-10-25 13:36:43
2023-10-25 13:36:43 -----------------------------------------
2023-10-25 13:36:43 Finished processing in 11.834 sec (exit code 1)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15691
    • View Profile
Re: Metashape 1.8 / 2.0.3 - Export undistorted images
« Reply #3 on: October 25, 2023, 02:48:50 PM »
Hello tazzo,

If you set Initial values same as Adjusted and then use "transform to initial calibration" option - you wouldn't get any transformation, as initial and adjusted calibration are the identical.

Have you checked the article regarding Convert Images dialog for the undistortion purposes?
https://agisoft.freshdesk.com/support/solutions/articles/31000168141-export-undistorted-photos
Best regards,
Alexey Pasumansky,
Agisoft LLC

tazzo

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Re: Metashape 1.8 / 2.0.3 - Export undistorted images
« Reply #4 on: October 25, 2023, 05:40:08 PM »
Thank you Alexey for your reply.
Now I am able to export the undistorted images.

I think that there is another problem with the distortion algorithm.

Let's set only k2=-10 on the grid test image attached.

As you can see the undistorted result is not modified at the corners.

According to other software (where k2=coefficient[3]) the whole undistorted image should be kind of radial.
This radial result make more sense and seems that Metashape is buggy in clipping the undistorted image.

Are the formula used by Metashape the same of the user manual?

Thank you
« Last Edit: October 25, 2023, 05:42:43 PM by tazzo »

tazzo

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Re: Metashape 1.8 / 2.0.3 - Export undistorted images
« Reply #5 on: October 30, 2023, 11:44:26 PM »
This bug seems pretty important if confirmed, any update on this?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15691
    • View Profile
Re: Metashape 1.8 / 2.0.3 - Export undistorted images
« Reply #6 on: October 31, 2023, 02:37:12 PM »
Hello tazzo,

Can you please specify, which parameters you are using in Initial/Adjusted tabs of Metashape for undistrorted image export?
Best regards,
Alexey Pasumansky,
Agisoft LLC