# Agisoft Metashape

## Agisoft Metashape => Camera Calibration => Topic started by: shwetankumar on January 27, 2017, 03:43:29 AM

Title: Camera Projection Model with 8 distortion coefficients
Post by: shwetankumar on January 27, 2017, 03:43:29 AM
Hi,

I am curious to know what lens distortion formula to use for computing projection, given
1) Radial distortion co-efficients k1, k2, k3, k4
2) Tangential distortion co-efficients p1, p2, p3, p4

I found a formula in the Agisoft Lens User Manual Version 0.4.0, but it does not incorporate all the 8 distortion coefficients seen in an exported XML file.

x = X / Z
y = Y / Z

x' = x(1 + K1r2 + K2r4 + K3r6) + P2(r2+2x2) + 2P1xy
y' = y(1 + K1r2 + K2r4 + K3r6) + P1(r2+2y2) + 2P2xy
u = cx + x'fx + y'skew
v = cy + y'fy

Thanks !
Title: Re: Camera Projection Model with 8 distortion coefficients
Post by: Alexey Pasumansky on January 27, 2017, 11:06:37 AM
Hello shwetankumar,

Please check Appendix C for additional information regarding the camera model used in PhotoScan and Lens:

http://www.agisoft.com/pdf/photoscan-pro_1_2_en.pdf

Title: Re: Camera Projection Model with 8 distortion coefficients
Post by: shwetankumar on January 27, 2017, 05:49:28 PM
Thanks for the prompt response.

I notice that the formula provided in the updated manual contains 2 skew parameters (B1 and B2).
The attachment I added has just one parameter called skew. Which one of these is it ?
Also, I have separate fx and fy values for focal lengths and the model assumes just one focal length f.
Title: Re: Camera Projection Model with 8 distortion coefficients
Post by: Alexey Pasumansky on January 28, 2017, 07:49:22 PM
Hello shwetankumar,

Code: [Select]
`F = FyB1 = Fx - FyB2 = skew`
Title: Re: Camera Projection Model with 8 distortion coefficients
Post by: shwetankumar on January 30, 2017, 10:01:28 PM
Thanks Alexey !

That answers all my questions and I have a working projection pipeline.

:)
Title: Re: Camera Projection Model with 8 distortion coefficients
Post by: shwetankumar on February 10, 2017, 06:48:41 PM
I have been using Agisoft for a significant amount of time now and getting consistent results.
However, this recent project has left me wondering what the issue is.
Can you please take a look at this image and data to help me figure out why the image projections are not landing at the correct location ?

A valid point in the point cloud has coordinates : -0.039719, -0.705446, -4.893686
The expected projected coordinates should be around (5330, 4950)

The camera parameters for the project are :