Class SimpleLensDistortionOpenCV

java.lang.Object
org.jvision.camera.distortion.SimpleLensDistortionOpenCV
All Implemented Interfaces:
LensDistortion, LensDistortionOpenCV

public class SimpleLensDistortionOpenCV extends Object implements LensDistortionOpenCV
A class dedicated to the handling of lens distortion within the OpenCV convention. A complete description of the convention can be found in Camera calibration With OpenCV
The distortion is used to compute distorted / undistorted points for a given camera. Let (x, y) be the projection of a 3D point onto an image.
OPENCV Pinehole camera model
A new point (x'', y'') that integrate distortion (a distorted point) can be obtained a follows:
 
1 + k1r2 + k2r4 + k3r6
x''=x'×
+2p1x'y'+p2(r2+2x'2)+s1r2+s2r4
1 + k4r2 + k5r4 + k6r6

and
 
1 + k1r2 + k2r4 + k3r6
y''=y'×
+p1(r2+2y'2)+2p2x'y'+s3r2+s4r4
1 + k4r2 + k5r4 + k6r6
with:
  • (x', y') is a 3D point within camera referential that is not affected by the distortion.
  • (x'', y'') is a point within camera referential that is affected by the distortion.
  • r2 = x'2 + y'2.
  • k1, ..., k6 are the radial distortion coefficients.
  • p1, p2 are the tangential distortion coefficients.
  • s1, s2, s3 and s4 are the thin prism distortion coefficients.
Since:
1.0.0
Version:
"1.0.0" b202104211400L
Author:
Julien Seinturier - JOrigin - contact@jorigin.org - https://github.com/jorigin/jvision
  • Constructor Details

    • SimpleLensDistortionOpenCV

      public SimpleLensDistortionOpenCV()
      Create a new OpenCV lens distortion representation with no distortion.

      An OpenCV distortion is made of 4 components:
      • Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).
      • Tangential (decentering) distortion defined by coefficients p1 and p2.
      • Thin prism distortion defined by coefficients s1, s2, s3 and s4
      • Tilt distortion defined by coefficients τx and τy.
    • SimpleLensDistortionOpenCV

      public SimpleLensDistortionOpenCV(double k1, double k2, double k3, double k4, double k5, double k6, double p1, double p2, double s1, double s2, double s3, double s4, double tx, double ty)
      Create a new distortion representation based on OpenCV formalization with given coefficients.

      An OpenCV distortion is made of 4 components:
      • Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).
      • Tangential (decentering) distortion defined by coefficients p1 and p2.
      • Thin prism distortion defined by coefficients s1, s2, s3 and s4
      • Tilt distortion defined by coefficients τx and τy.
      Parameters:
      k1 - the first radial distortion simple coefficient
      k2 - the second radial distortion simple coefficient
      k3 - the third radial distortion simple coefficient
      k4 - the first radial distortion rational coefficient
      k5 - the second radial distortion rational coefficient
      k6 - the third radial distortion rational coefficient
      p1 - the first tangential (decentering) distortion coefficient
      p2 - the second tangential (decentering) distortion coefficient
      s1 - the first thin prism distortion coefficient
      s2 - the second thin prism distortion coefficient
      s3 - the third thin prism distortion coefficient
      s4 - the fourth thin prism distortion coefficient
      tx - the x tilt distortion coefficient
      ty - the y tilt distortion coefficient
    • SimpleLensDistortionOpenCV

      public SimpleLensDistortionOpenCV(double k1, double k2, double k3, double k4, double k5, double k6, double p1, double p2, double s1, double s2, double s3, double s4)
      Create a new distortion representation based on OpenCV formalization with given coefficients.

      An OpenCV distortion is made of 4 components:
      • Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).
      • Tangential (decentering) distortion defined by coefficients p1 and p2.
      • Thin prism distortion defined by coefficients s1, s2, s3 and s4
      • Tilt distortion defined by coefficients τx and τy.
      Parameters:
      k1 - the first radial distortion simple coefficient
      k2 - the second radial distortion simple coefficient
      k3 - the third radial distortion simple coefficient
      k4 - the first radial distortion rational coefficient
      k5 - the second radial distortion rational coefficient
      k6 - the third radial distortion rational coefficient
      p1 - the first tangential (decentering) distortion coefficient
      p2 - the second tangential (decentering) distortion coefficient
      s1 - the first thin prism distortion coefficient
      s2 - the second thin prism distortion coefficient
      s3 - the third thin prism distortion coefficient
      s4 - the fourth thin prism distortion coefficient
    • SimpleLensDistortionOpenCV

      public SimpleLensDistortionOpenCV(double k1, double k2, double k3, double k4, double k5, double k6, double p1, double p2)
      Create a new distortion representation based on OpenCV formalization with given coefficients.

      An OpenCV distortion is made of 4 components:
      • Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).
      • Tangential (decentering) distortion defined by coefficients p1 and p2.
      • Thin prism distortion defined by coefficients s1, s2, s3 and s4
      • Tilt distortion defined by coefficients τx and τy.
      Parameters:
      k1 - the first radial distortion simple coefficient
      k2 - the second radial distortion simple coefficient
      k3 - the third radial distortion simple coefficient
      k4 - the first radial distortion rational coefficient
      k5 - the second radial distortion rational coefficient
      k6 - the third radial distortion rational coefficient
      p1 - the first tangential (decentering) distortion coefficient
      p2 - the second tangential (decentering) distortion coefficient
    • SimpleLensDistortionOpenCV

      public SimpleLensDistortionOpenCV(double k1, double k2, double k3, double p1, double p2)
      Create a new distortion representation based on OpenCV formalization with given coefficients.

      An OpenCV distortion is made of 4 components:
      • Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).
      • Tangential (decentering) distortion defined by coefficients p1 and p2.
      • Thin prism distortion defined by coefficients s1, s2, s3 and s4
      • Tilt distortion defined by coefficients τx and τy.
      Parameters:
      k1 - the first radial distortion simple coefficient
      k2 - the second radial distortion simple coefficient
      k3 - the third radial distortion simple coefficient
      p1 - the first tangential (decentering) distortion coefficient
      p2 - the second tangential (decentering) distortion coefficient
    • SimpleLensDistortionOpenCV

      public SimpleLensDistortionOpenCV(org.jeometry.math.Vector coefficients)
      Create a new distortion representation based on OpenCV formalization with given coefficients.

      An OpenCV distortion is made of 4 components:
      • Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).
      • Tangential (decentering) distortion defined by coefficients p1 and p2.
      • Thin prism distortion defined by coefficients s1, s2, s3 and s4
      • Tilt distortion defined by coefficients τx and τy.
      Accepted vectors are:
      • (k1, k2 , p1, p2, k3, k4, k5, k6, s1, s2, s3, s4, τx, τy) (14 dimensions)
      • (k1, k2 , p1, p2, k3, k4, k5, k6, s1, s2, s3, s4) (12 dimensions)
      • (k1, k2 , p1, p2, k3, k4, k5, k6) (8 dimensions)
      • (k1, k2 , p1, p2, k3) (5 dimensions)
      • (k1, k2 , p1, p2) (4 dimensions)
      • null or empty vector for no distortion
      Parameters:
      coefficients - the distortion coefficients
      Throws:
      IllegalArgumentException - if the input array does not match a distortion configuration
    • SimpleLensDistortionOpenCV

      public SimpleLensDistortionOpenCV(float[] coefficients)
      Create a new distortion representation based on OpenCV formalization with given coefficients.

      An OpenCV distortion is made of 4 components:
      • Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).
      • Tangential (decentering) distortion defined by coefficients p1 and p2.
      • Thin prism distortion defined by coefficients s1, s2, s3 and s4
      • Tilt distortion defined by coefficients τx and τy.
      Accepted arrays are:
      • [k1, k2 , p1, p2, k3, k4, k5, k6, s1, s2, s3, s4, τx, τy] (length 14)
      • [k1, k2 , p1, p2, k3, k4, k5, k6, s1, s2, s3, s4] (length 12)
      • [k1, k2 , p1, p2, k3, k4, k5, k6] (length 8)
      • [k1, k2 , p1, p2, k3] (length 5)
      • [k1, k2 , p1, p2] (length 4)
      • null or empty array for no distortion
      Parameters:
      coefficients - the distortion coefficients
      Throws:
      IllegalArgumentException - if the input array does not match a distortion configuration
    • SimpleLensDistortionOpenCV

      public SimpleLensDistortionOpenCV(double[] coefficients)
      Create a new distortion representation based on OpenCV formalization with given coefficients.

      An OpenCV distortion is made of 4 components:
      • Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).
      • Tangential (decentering) distortion defined by coefficients p1 and p2.
      • Thin prism distortion defined by coefficients s1, s2, s3 and s4
      • Tilt distortion defined by coefficients τx and τy.
      Accepted arrays are:
      • [k1, k2 , p1, p2, k3, k4, k5, k6, s1, s2, s3, s4, τx, τy] (length 14)
      • [k1, k2 , p1, p2, k3, k4, k5, k6, s1, s2, s3, s4] (length 12)
      • [k1, k2 , p1, p2, k3, k4, k5, k6] (length 8)
      • [k1, k2 , p1, p2, k3] (length 5)
      • [k1, k2 , p1, p2] (length 4)
      • null or empty array for no distortion
      Parameters:
      coefficients - the distortion coefficients
      Throws:
      IllegalArgumentException - if the input array does not match a distortion configuration
  • Method Details