Package org.jvision.camera.distortion
Class SimpleLensDistortionMetashape
java.lang.Object
org.jvision.camera.distortion.SimpleLensDistortionMetashape
- All Implemented Interfaces:
LensDistortion,LensDistortionMetashape
A class dedicated to the handling of lens distortion within the Agisoft Metashape(c) convention.
The distortion is used to compute distorted / undistorted points for a given camera. Let (X, Y, Z) be a 3D point expressed within the camera referential.
A new point (u, v) that integrate distortion (a distorted point) can be obtained a follows:
with:
with:
The distortion is used to compute distorted / undistorted points for a given camera. Let (X, Y, Z) be a 3D point expressed within the camera referential.
A new point (u, v) that integrate distortion (a distorted point) can be obtained a follows:
| x | = | X / Z |
| y | = | Y / Z |
| x' | = | x | (1 + k1r2 + k2r4 + k3r6 + k4r8) | + | (P1(r2+2x2) + 2P2xy) |
| y' | = | x | (1 + k1r2 + k2r4 + k3r6 + k4r8) | + | (P2(r2+2y2) + 2P1xy) |
with:
- (x', y') is a point within camera referential that is affected by the distortion.
- r2 = x2 + y2.
- k1, k2, k3, k4 are the radial distortion coefficients.
- p1, p2 are the tangential distortion coefficients.
| u = w × 0.5 + cx + x'f + x'B1 + y'B2 |
| v = h × 0.5 + cy + y'f |
with:
- (u, v) is a point within the image referential that is affected by the distortion expressed in pixels (px).
- w is the digital image width in pixels (px).
- h is the digital image height in pixels (px).
- (cx, cy) is the principal point offset expressed in pixels (px).
- f is the camera focal length in pixels (px).
- B1 is the affinity coefficient.
- B2 is the non-orthogonality (skew) coefficient.
- Since:
- 1.0.0
- Version:
- "1.0.0" b202104211400L
- Author:
- Julien Seinturier - JOrigin - contact@jorigin.org - https://github.com/jorigin/jvision
-
Field Summary
Fields inherited from interface org.jvision.camera.distortion.LensDistortion
TYPE_NO_DISTORTION, TYPE_PRISM, TYPE_RADIAL, TYPE_RADIAL_RATIONAL, TYPE_RADIAL_SIMPLE, TYPE_TANGENTIAL, TYPE_TILT -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new Agisoft Metashape lens distortion representation with no distortion.SimpleLensDistortionMetashape(double[] coefficients)Create a new distortion representation based onAgisoft Metashape(c) formalizationwith given coefficients.
An Agisoft Metashape (c) distortion is made of 2 components: Radial distortion defined by coefficients k1, k2, k3 and k4.SimpleLensDistortionMetashape(double k1, double k2, double k3, double k4, double p1, double p2)Construct a new Agisoft Metashape lens distortion.SimpleLensDistortionMetashape(float[] coefficients)Create a new distortion representation based onAgisoft Metashape(c) formalizationwith given coefficients.
An Agisoft Metashape (c) distortion is made of 2 components: Radial distortion defined by coefficients k1, k2, k3 and k4.SimpleLensDistortionMetashape(org.jeometry.math.Vector coefficients)Create a new distortion representation based onAgisoft Metashape(c) formalizationwith given coefficients.
An Agisoft Metashape (c) distortion is made of 2 components: Radial distortion defined by coefficients k1, k2, k3 and k4. -
Method Summary
Modifier and TypeMethodDescriptionorg.jeometry.geom2D.point.Point2Ddistort(org.jeometry.geom2D.point.Point2D undistorted)org.jeometry.geom2D.point.Point2Ddistort(org.jeometry.geom2D.point.Point2D undistorted, org.jeometry.geom2D.point.Point2D distorted)org.jeometry.math.Vectororg.jeometry.math.VectorgetDistortionCoefficients(org.jeometry.math.Vector parameters)double[]double[]getDistortionCoefficientsDouble(double[] parameters)float[]float[]getDistortionCoefficientsFloat(float[] parameters)intdoublegetK1()doublegetK2()doublegetK3()doublegetK4()doublegetP1()doublegetP2()voidsetDistortionCoefficients(double[] parameters)voidsetDistortionCoefficients(double k1, double k2, double k3, double k4, double p1, double p2)voidsetDistortionCoefficients(float[] parameters)voidsetDistortionCoefficients(org.jeometry.math.Vector parameters)voidsetK1(double k1)voidsetK2(double k2)voidsetK3(double k3)voidsetK4(double k4)voidsetP1(double p1)voidsetP2(double p2)org.jeometry.geom2D.point.Point2Dundistort(org.jeometry.geom2D.point.Point2D distorted)org.jeometry.geom2D.point.Point2Dundistort(org.jeometry.geom2D.point.Point2D distorted, org.jeometry.geom2D.point.Point2D undistorted)
-
Constructor Details
-
SimpleLensDistortionMetashape
public SimpleLensDistortionMetashape()Construct a new Agisoft Metashape lens distortion representation with no distortion.
An Agisoft Metashape (c) distortion is made of 2 components:- Radial distortion defined by coefficients k1, k2, k3 and k4.
- Tangential (decentering) distortion defined by coefficients p1 and p2.
-
SimpleLensDistortionMetashape
public SimpleLensDistortionMetashape(double k1, double k2, double k3, double k4, double p1, double p2)Construct a new Agisoft Metashape lens distortion.
An Agisoft Metashape (c) distortion is made of 2 components:- Radial distortion defined by coefficients k1, k2, k3 and k4.
- Tangential (decentering) distortion defined by coefficients p1 and p2.
- Parameters:
k1- the first radial distortion parameterk2- the second radial distortion parameterk3- the third radial distortion parameterk4- the fourth radial distortion parameterp1- the first tangential distortion parameterp2- the second tangential distortion parameter
-
SimpleLensDistortionMetashape
public SimpleLensDistortionMetashape(org.jeometry.math.Vector coefficients) throws IllegalArgumentExceptionCreate a new distortion representation based onAgisoft Metashape(c) formalizationwith given coefficients.
An Agisoft Metashape (c) distortion is made of 2 components:- Radial distortion defined by coefficients k1, k2, k3 and k4.
- Tangential (decentering) distortion defined by coefficients p1 and p2.
- Parameters:
coefficients- the distortion coefficients- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
SimpleLensDistortionMetashape
Create a new distortion representation based onAgisoft Metashape(c) formalizationwith given coefficients.
An Agisoft Metashape (c) distortion is made of 2 components:- Radial distortion defined by coefficients k1, k2, k3 and k4.
- Tangential (decentering) distortion defined by coefficients p1 and p2.
- Parameters:
coefficients- the distortion coefficients- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
SimpleLensDistortionMetashape
Create a new distortion representation based onAgisoft Metashape(c) formalizationwith given coefficients.
An Agisoft Metashape (c) distortion is made of 2 components:- Radial distortion defined by coefficients k1, k2, k3 and k4.
- Tangential (decentering) distortion defined by coefficients p1 and p2.
- Parameters:
coefficients- the distortion coefficients- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
-
Method Details
-
getDistortionConvention
- Specified by:
getDistortionConventionin interfaceLensDistortion
-
getDistortionComponents
public int getDistortionComponents()- Specified by:
getDistortionComponentsin interfaceLensDistortion
-
distort
public org.jeometry.geom2D.point.Point2D distort(org.jeometry.geom2D.point.Point2D undistorted)- Specified by:
distortin interfaceLensDistortion
-
distort
public org.jeometry.geom2D.point.Point2D distort(org.jeometry.geom2D.point.Point2D undistorted, org.jeometry.geom2D.point.Point2D distorted)- Specified by:
distortin interfaceLensDistortion
-
undistort
public org.jeometry.geom2D.point.Point2D undistort(org.jeometry.geom2D.point.Point2D distorted)- Specified by:
undistortin interfaceLensDistortion
-
undistort
public org.jeometry.geom2D.point.Point2D undistort(org.jeometry.geom2D.point.Point2D distorted, org.jeometry.geom2D.point.Point2D undistorted)- Specified by:
undistortin interfaceLensDistortion
-
getDistortionCoefficients
public org.jeometry.math.Vector getDistortionCoefficients()- Specified by:
getDistortionCoefficientsin interfaceLensDistortion- Specified by:
getDistortionCoefficientsin interfaceLensDistortionMetashape
-
getDistortionCoefficients
public org.jeometry.math.Vector getDistortionCoefficients(org.jeometry.math.Vector parameters) throws IllegalArgumentException- Specified by:
getDistortionCoefficientsin interfaceLensDistortion- Specified by:
getDistortionCoefficientsin interfaceLensDistortionMetashape- Throws:
IllegalArgumentException
-
setDistortionCoefficients
public void setDistortionCoefficients(org.jeometry.math.Vector parameters) throws IllegalArgumentException- Specified by:
setDistortionCoefficientsin interfaceLensDistortion- Specified by:
setDistortionCoefficientsin interfaceLensDistortionMetashape- Throws:
IllegalArgumentException
-
getDistortionCoefficientsFloat
public float[] getDistortionCoefficientsFloat()- Specified by:
getDistortionCoefficientsFloatin interfaceLensDistortion- Specified by:
getDistortionCoefficientsFloatin interfaceLensDistortionMetashape
-
getDistortionCoefficientsFloat
- Specified by:
getDistortionCoefficientsFloatin interfaceLensDistortion- Specified by:
getDistortionCoefficientsFloatin interfaceLensDistortionMetashape- Throws:
IllegalArgumentException
-
setDistortionCoefficients
- Specified by:
setDistortionCoefficientsin interfaceLensDistortion- Specified by:
setDistortionCoefficientsin interfaceLensDistortionMetashape- Throws:
IllegalArgumentException
-
getDistortionCoefficientsDouble
public double[] getDistortionCoefficientsDouble()- Specified by:
getDistortionCoefficientsDoublein interfaceLensDistortion- Specified by:
getDistortionCoefficientsDoublein interfaceLensDistortionMetashape
-
getDistortionCoefficientsDouble
public double[] getDistortionCoefficientsDouble(double[] parameters) throws IllegalArgumentException- Specified by:
getDistortionCoefficientsDoublein interfaceLensDistortion- Specified by:
getDistortionCoefficientsDoublein interfaceLensDistortionMetashape- Throws:
IllegalArgumentException
-
setDistortionCoefficients
- Specified by:
setDistortionCoefficientsin interfaceLensDistortion- Specified by:
setDistortionCoefficientsin interfaceLensDistortionMetashape- Throws:
IllegalArgumentException
-
getK1
public double getK1()- Specified by:
getK1in interfaceLensDistortionMetashape
-
setK1
public void setK1(double k1)- Specified by:
setK1in interfaceLensDistortionMetashape
-
getK2
public double getK2()- Specified by:
getK2in interfaceLensDistortionMetashape
-
setK2
public void setK2(double k2)- Specified by:
setK2in interfaceLensDistortionMetashape
-
getK3
public double getK3()- Specified by:
getK3in interfaceLensDistortionMetashape
-
setK3
public void setK3(double k3)- Specified by:
setK3in interfaceLensDistortionMetashape
-
getK4
public double getK4()- Specified by:
getK4in interfaceLensDistortionMetashape
-
setK4
public void setK4(double k4)- Specified by:
setK4in interfaceLensDistortionMetashape
-
getP1
public double getP1()- Specified by:
getP1in interfaceLensDistortionMetashape
-
setP1
public void setP1(double p1)- Specified by:
setP1in interfaceLensDistortionMetashape
-
getP2
public double getP2()- Specified by:
getP2in interfaceLensDistortionMetashape
-
setP2
public void setP2(double p2)- Specified by:
setP2in interfaceLensDistortionMetashape
-
setDistortionCoefficients
public void setDistortionCoefficients(double k1, double k2, double k3, double k4, double p1, double p2)- Specified by:
setDistortionCoefficientsin interfaceLensDistortionMetashape
-