Forum

Author Topic: Incorrect Show image with calibration with k4  (Read 1697 times)

Paulo

  • Hero Member
  • *****
  • Posts: 1346
    • View Profile
Incorrect Show image with calibration with k4
« on: March 11, 2024, 05:54:59 AM »
Hello all,

i have a project where my images (M3E) were adjusted using k1,k2,k3,k4 radial parameters in camera calibration. But when I do show Images in model view, the corners of projected image on model are chopped off when I would expect to have a pointed pattern (push pin). AS you can see in following the top left corner of projected  image is chopped off... in radial distorsion plot it is clear that in corners, there is up to 670 pixel distorsion....

Any explanation for this behavior? This does not occur if I calibrate with just k1,k2,k3 radial distorsion...
« Last Edit: March 11, 2024, 06:07:16 AM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #1 on: March 11, 2024, 06:15:51 PM »
Hello Paul,

What happens if you change the sign of K4 in the adjusted values tab?

According to the distortion plot it seems that the corners of the undistorted image are "folded" inside.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Paulo

  • Hero Member
  • *****
  • Posts: 1346
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #2 on: March 11, 2024, 07:02:18 PM »
Hello Alexey,

if I change the sign of k4, I get something that is not correct like barrel distorsion....

I think there is a bug when k4 is adjusted during optimization in the projection of image/camera...

If I optimize with just k1,k2,k3, th projection of image on model is correct.... see 2nd attachment
« Last Edit: March 11, 2024, 07:09:38 PM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor

olihar

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #3 on: March 12, 2024, 09:34:22 PM »

This is how it looks for me with K4, seems to work fine.


Paulo

  • Hero Member
  • *****
  • Posts: 1346
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #4 on: March 12, 2024, 10:40:34 PM »
Hi olihar,

yes your distorsion plot looks fine... However if you can activate Show Images in model view to see how  an image looks when projected onto model?
« Last Edit: March 12, 2024, 10:43:08 PM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor

olihar

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #5 on: March 13, 2024, 01:16:11 AM »
Oh interesting... Something is not right here.


olihar

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #6 on: March 13, 2024, 01:22:02 AM »
Same drone different dataset, Same processing method and K4 used as well, looks ok here.


olihar

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #7 on: March 13, 2024, 01:39:56 AM »
Can you post a screenshot of the Difference tab at 25X

Here is same photo, different project, showing problem and then no problem, both K4.

Paulo

  • Hero Member
  • *****
  • Posts: 1346
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #8 on: March 13, 2024, 09:25:28 AM »
I think the difference between initial calibration (no k4) and adjusted gives strong values in corners...ie. the reason for problematic projection on model....

Definitely with k4 adjustment the camera.unproject at corners gives wrong values as calculation does not seem to converge... thus getting greater and greater values...to infinity
as seen in  Excel extract starting from image top right u,v = 5279,0 pixel, I get undistorted pixel position that is huge as the iterative corrections do not converge to 0...
« Last Edit: March 13, 2024, 09:30:34 AM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor

olihar

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #9 on: March 13, 2024, 01:05:07 PM »
This is from Agisoft support.

Quote

Based on the available information from DJI, calibration using dewarp does not use the k4 parameter and when calibrating, it uses a camera type like fisheye.

Please try to set the camera type - Fisheye and fix k4 = 0. Then compare the calibration results. We think this can improve the calibration result.


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #10 on: March 13, 2024, 05:47:52 PM »
Hello Paul,

For the image visualization in the Model view (Show Images mode) the reverse distortion model is used, but since model utilized in Metashape is irreversible analytically, the calculation is performed partially using iterative approximation. The latter works well in the areas, where the distortion change is smooth, but in the corners in the given examples the distortion change is quite abrupt, so the result of iterative approximation of the undistorted coordinates is quite off from the real. Seems like that is the reason of the artifacts that you are observing.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Paulo

  • Hero Member
  • *****
  • Posts: 1346
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #11 on: March 13, 2024, 06:05:44 PM »
Thanks Alexey,

this what i found when I tried using reverse projection and iterative approximation. At top right corner the iterative approximation does not converge rather diverges towards infinity...
Best Regards,
Paul Pelletier,
Surveyor

dpitman

  • Full Member
  • ***
  • Posts: 246
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #12 on: March 14, 2024, 04:17:21 PM »
Interesting conversation. 

My M3E images are captured with Dewarp off, and pre-calibration taken from XMP data via MS preferences. 

I get no values populated for K4. And I only have distortion plots available for Residuals.  Nothing for the other fields.

When I use Optimize Cameras, K4 is left unchecked, as well as b1 and b2.

Is this not the correct approach with the M3E?


Paulo

  • Hero Member
  • *****
  • Posts: 1346
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #13 on: March 14, 2024, 06:21:17 PM »
Hello Dave ,

yes the k4 less calibration is certainly adequate. But given the significant radial distorsion in this wide angle lens, I decided to compare  a 5 cm GSD calibration flight, optimizing with and without k4 checked. And I got slightly better results in terms of reprojection error (error promedio de reproyeccion) and tie points variance (Precision promedia de puntos) but a little worse in GCPs error using k4  compared to nok4... Following results with k4 first then without...

Code: [Select]
---------------------------------------------------------------------------
    Reporte Puntos de amarre - Calib_110_140_pr_Optk4_gradsel_RU_PA_RE - Calib_5cm.psx version 2.0.2.16334
 ---------------------------------------------------------------------------
 Sigma0: 0.998
 Precision de puntos de amarre (pix): 0.13
 Numero de puntos de amarre: 93610
 Numero de proyecciones: 315302
 Promedio de proyecciones (TiePts) por foto: 1480
 Numero de fotos alineadas: 213
 Numero de puntos iniciales: 456675
 Numero de proyecciones iniciales: 2210367
 Error promedio de reproyeccion (pix): 0.276
 Error maxima de reproyeccion (pix): 1.529
 Error medio cuadratico (RMS) de reproyeccion (pix): 0.330
 Precision promedia de puntos (cm):3.988 sX, 3.499 sY, 6.579 sZ, 8.452 sTotal
 Tamano promedio de punto (pix): 2.352
 Multiplicidad promedia de punto de amarre: 3.368
 Multiplicidad promedia de punto de amarre (todos): 4.840
 ---------------------------------------------------------------------------
 Script finished in 2 seconds.

Total error GCPs:
    Control points 0.015 0.019 0.019
    Check point 0.025   0.029 0.048
   
---------------------------------------------------------------------------
    Reporte Puntos de amarre - Calib_110_140_pr_Nok4_gradsel_RU_PA_RE - Calib_5cm.psx version 2.0.2.16334
 ---------------------------------------------------------------------------
 Sigma0: 1.008
 Precision de puntos de amarre (pix): 0.18
 Numero de puntos de amarre: 93610
 Numero de proyecciones: 315302
 Promedio de proyecciones (TiePts) por foto: 1480
 Numero de fotos alineadas: 213
 Numero de puntos iniciales: 456675
 Numero de proyecciones iniciales: 2210367
 Error promedio de reproyeccion (pix): 0.384
 Error maxima de reproyeccion (pix): 3.199
 Error medio cuadratico (RMS) de reproyeccion (pix): 0.465
 Precision promedia de puntos (cm): 6.094 sX, 5.460 sY, 9.940 sZ, 12.875 sTotal
 Tamano promedio de punto (pix): 2.352
 Multiplicidad promedia de punto de amarre: 3.368
 Multiplicidad promedia de punto de amarre (todos): 4.840
 ---------------------------------------------------------------------------
 Script finished in 2 seconds.

Total Error GCPs:
    Control points 0.016 0.018 0.017
    Check point 0.005 0.025 0.002

All in all there is no significant difference.... I think

Attached is camera calibration comparison (no k4 - k4). Clearly image residuals are smaller  with k4....
« Last Edit: March 14, 2024, 06:58:54 PM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor

dpitman

  • Full Member
  • ***
  • Posts: 246
    • View Profile
Re: Incorrect Show image with calibration with k4
« Reply #14 on: March 15, 2024, 04:44:42 AM »
Hi Paul.

How are you able to get distortion plots for anything but Residuals? 

My residuals plot looks quite different.  Were your images captured with dewarp on or off?