Forum

Author Topic: Lens Distortion - Profile curve  (Read 1434 times)

Hugh

  • Newbie
  • *
  • Posts: 19
    • View Profile
Lens Distortion - Profile curve
« on: August 05, 2022, 07:27:17 PM »
Hi,

I'm trying to understand how the distortion plot is calculated in the Camera Calibration window.

I've got, for example, the attached image.

In this, I'd expect to be able to pass in a pixel radius of 2000 and get a result of just under 12 pixels.

The details of this calibration are:

Code: [Select]
w : 3840
h : 2160
f : 7617.05664
k1 : 0.052014
k2 : 0.689641
k3 : -3.7671
k4 : 0
cx : 0
cy : 0
p1 : -0.00148237
p2 : -0.0018401
b1 : 0
b2 : 0

The corner of my image would be considered 0.5, 0.5, which is 1920, 1080 from the center. So the pixel distance to the corner is 2202.907. I'm going to use this point, and expect something around or just above 12.

r2 = r*r
r4 = r*r*r*r
etc...

I've used the formulae from Appendix C of the Metashape Pro documentation, on Frame cameras.

Code: [Select]
x_prime = (x * (1 + k1*r2 + k2*r4 + k3*r6)) + (p1 * (r2 + (2 * x2))) + (2 * p2 * x * y) = 0.36136245
y_prime = (y * (1 + k1*r2 + k2*r4 + k3*r6)) + (p2 * (r2 + (2 * y2))) + (2 * p1 * x * y) = 0.36118359

u = w * 0.5 + cx + x_prime * f + x_prime * b1 + x_prime * b2 = 4672.52
v = h * 0.5 + cy + y_prime * f = 3831.16

This position in u,v is much more than 12 pixels away from the corner, so I'm not sure where my maths is going wrong here.

I tried doing this with p1 and p2 set to 0, and I got a similar result:

Code: [Select]
x_prime = (x * (1 + k1*r2 + k2*r4 + k3*r6)) + (p1 * (r2 + (2 * x2))) + (2 * p2 * x * y) = 0.363764875
y_prime = (y * (1 + k1*r2 + k2*r4 + k3*r6)) + (p2 * (r2 + (2 * y2))) + (2 * p1 * x * y) = 0.363764875

u = w * 0.5 + cx + x_prime * f + x_prime * b1 + x_prime * b2 = 4690.82
v = h * 0.5 + cy + y_prime * f = 3850.82


Could someone help me as to where I'm going wrong here? I'd like to be able to calculate the same results as the graph is showing.

Thanks