Package org.jvision.factory
Class JVisionFactory
java.lang.Object
org.jvision.factory.JVisionFactory
A factory dedicated to the creation of JVision classes implementations.
- Since:
- 1.0.0
- Version:
- "1.0.0" b202104211400L
- Author:
- Julien Seinturier - JOrigin - contact@jorigin.org - https://github.com/jorigin/jvision
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringThe default implementation that is used.static StringThe Initialization class of a JVision implementation.static StringThe static initialization method contained within the JVisionimplementation initialization classstatic StringA system property that enables to set the global implementation to use. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LensDistortionBrownCreate a new distortion representation based onBrown formalizationwith no distortion.static LensDistortionBrowncreateLensDistortionBrown(double[] coefficients)Create a new Brown based lens distortion with given coefficients.static LensDistortionBrowncreateLensDistortionBrown(double k1, double k2, double k3, double k4, double p1, double p2, double p3, double p4)Create a new distortion representation based onBrown formalizationwith radial coefficients (k1, k2, k3, k4) and tangential coefficients (p1, p2, p3, p4).static LensDistortionBrowncreateLensDistortionBrown(float[] coefficients)Create a new distortion representation based onBrown formalizationwith given coefficients.static LensDistortionBrowncreateLensDistortionBrown(org.jeometry.math.Vector coefficients)Create a new distortion representation based onBrown formalizationwith given coefficients.static LensDistortionMetashapeCreate a new distortion representation based onAgisoft Metashape(c) formalizationwith no distortion.static LensDistortionMetashapecreateLensDistortionMetashape(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.static LensDistortionMetashapecreateLensDistortionMetashape(double k1, double k2, double k3, double k4, double p1, double p2)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.static LensDistortionMetashapecreateLensDistortionMetashape(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.static LensDistortionMetashapecreateLensDistortionMetashape(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.static LensDistortionOpenCVCreate a new distortion representation based onOpenCV formalizationwith no distortion.static LensDistortionOpenCVcreateLensDistortionOpenCV(double[] coefficients)Create a new distortion representation based onOpenCV formalizationwith given coefficients.
An OpenCV distortion is made of 4 components: Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).static LensDistortionOpenCVcreateLensDistortionOpenCV(double k1, double k2, double k3, double p1, double p2)Create a new distortion representation based onOpenCV formalizationwith given coefficients.
An OpenCV distortion is made of 4 components: Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).static LensDistortionOpenCVcreateLensDistortionOpenCV(double k1, double k2, double k3, double k4, double k5, double k6, double p1, double p2)Create a new distortion representation based onOpenCV formalizationwith given coefficients.
An OpenCV distortion is made of 4 components: Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).static LensDistortionOpenCVcreateLensDistortionOpenCV(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 onOpenCV formalizationwith given coefficients.
An OpenCV distortion is made of 4 components: Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).static LensDistortionOpenCVcreateLensDistortionOpenCV(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 onOpenCV formalizationwith given coefficients.
An OpenCV distortion is made of 4 components: Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).static LensDistortionOpenCVcreateLensDistortionOpenCV(float[] coefficients)Create a new distortion representation based onOpenCV formalizationwith given coefficients.
An OpenCV distortion is made of 4 components: Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).static LensDistortionOpenCVcreateLensDistortionOpenCV(org.jeometry.math.Vector coefficients)Create a new distortion representation based onOpenCV formalizationwith given coefficients.
An OpenCV distortion is made of 4 components: Radial distortion defined by coefficients k1, k2, k3 (simple) and k4, k5, k6 (rational).static CameraBuilderGet the defaultcamera builder.static booleanloadImplementation(String implementation)Load and attach the givenimplementation.static voidsetDefaultCameraBuilder(CameraBuilder builder)Set the defaultcamera builder.
-
Field Details
-
JVISION_IMPLEMENTATION_PROPERTY
A system property that enables to set the global implementation to use. The value of this property is used to locate the initialization class for the given implementation.
For example, if the Java application is launched with-D"org.jvision.implementation"=val, JVision will:- Load the class
org.jvision.val."JVisionImplementation"(wherevalvalue is lower cased) - Call the static method
void initJVisionImplementation()that have to provide the registering of the builders
By default, JVision use thesimpleimplementation that will provide simple implementations of all the API interfaces..- See Also:
- Constant Field Values
- Load the class
-
JVISION_IMPLEMENTATION_INIT_CLASS
The Initialization class of a JVision implementation.- See Also:
- Constant Field Values
-
JVISION_IMPLEMENTATION_INIT_METHOD
The static initialization method contained within the JVisionimplementation initialization class- See Also:
- Constant Field Values
-
JVISION_DEFAULT_IMPLEMENTATION
The default implementation that is used.- See Also:
- Constant Field Values
-
-
Constructor Details
-
JVisionFactory
public JVisionFactory()
-
-
Method Details
-
loadImplementation
Load and attach the givenimplementation.
In order to be loaded, an implementation has to provide anorg.jvision.<implementation>.JVisionImplementationclass that contains a methodpublic static void initJVisionImplementation()that attach the implementation to the factory.
For example, thesimpleimplementation provides a classorg.jvision.simple.JVisionImplementationthat contains the methodpublic static void initJVisionImplementation().- Parameters:
implementation- the implementation to use- Returns:
trueif the implementation is successfully loaded and attached andfalseotherwise.
-
getDefaultCameraBuilder
Get the defaultcamera builder.- Returns:
- the default
camera builder - See Also:
setDefaultCameraBuilder(CameraBuilder)
-
setDefaultCameraBuilder
Set the defaultcamera builder.- Parameters:
builder- the camera builder to use as default- See Also:
getDefaultCameraBuilder()
-
createLensDistortionBrown
Create a new distortion representation based onBrown formalizationwith no distortion.- Returns:
- the lens distortion
-
createLensDistortionBrown
public static LensDistortionBrown createLensDistortionBrown(double k1, double k2, double k3, double k4, double p1, double p2, double p3, double p4)Create a new distortion representation based onBrown formalizationwith radial coefficients (k1, k2, k3, k4) and tangential coefficients (p1, p2, p3, p4).- Parameters:
k1- the first radial distortion coefficientk2- the second radial distortion coefficientk3- the third radial distortion coefficientk4- the fourth radial distortion coefficientp1- the first tangential distortion coefficientp2- the second tangential distortion coefficientp3- the third tangential distortion coefficientp4- the fourth tangential distortion coefficient- Returns:
- a new Brown based lens distortion with radial coefficients (k1, k2, k3, k4) and tangential (decentering) coefficients (p1, p2, p3, p4)
-
createLensDistortionBrown
public static LensDistortionBrown createLensDistortionBrown(org.jeometry.math.Vector coefficients) throws IllegalArgumentExceptionCreate a new distortion representation based onBrown formalizationwith given coefficients. Possible values are:- (k1, k2, k3, k4, p1, p2, p3, p4) (8 dimensions)
- (k1, k2, k3, p1, p2) (5 dimensions)
- (k1, k2, k3) (3 dimensions)
- null or empty vector for no distortion
- Parameters:
coefficients- the distortion coefficients- Returns:
- a new Brown lens distortion representation
- Throws:
IllegalArgumentException- if the input vector does not match a distortion configuration
-
createLensDistortionBrown
public static LensDistortionBrown createLensDistortionBrown(float[] coefficients) throws IllegalArgumentExceptionCreate a new distortion representation based onBrown formalizationwith given coefficients. Possible values are:- [k1, k2, k3, k4, p1, p2, p3, p4] (8 values)
- [k1, k2, k3, p1, p2] (5 values)
- [k1, k2, k3] (3 values)
- null or empty array for no distortion
- Parameters:
coefficients- the distortion coefficients- Returns:
- a new Brown lens distortion representation
- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
createLensDistortionBrown
public static LensDistortionBrown createLensDistortionBrown(double[] coefficients) throws IllegalArgumentExceptionCreate a new Brown based lens distortion with given coefficients. Possible values are:- [k1, k2, k3, k4, p1, p2, p3, p4] (8 values)
- [k1, k2, k3, p1, p2] (5 values)
- [k1, k2, k3] (3 values)
- null or empty array for no distortion
- Parameters:
coefficients- the distortion coefficients- Returns:
- a new Brown lens distortion representation
- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
createLensDistortionOpenCV
Create a new distortion representation based onOpenCV formalizationwith no distortion.- Returns:
- the lens distortion
-
createLensDistortionOpenCV
public static LensDistortionOpenCV createLensDistortionOpenCV(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 onOpenCV formalizationwith 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 coefficientk2- the second radial distortion simple coefficientk3- the third radial distortion simple coefficientk4- the first radial distortion rational coefficientk5- the second radial distortion rational coefficientk6- the third radial distortion rational coefficientp1- the first tangential (decentering) distortion coefficientp2- the second tangential (decentering) distortion coefficients1- the first thin prism distortion coefficients2- the second thin prism distortion coefficients3- the third thin prism distortion coefficients4- the fourth thin prism distortion coefficienttx- the x tilt distortion coefficientty- the y tilt distortion coefficient- Returns:
- a new OpenCV lens distortion representation
-
createLensDistortionOpenCV
public static LensDistortionOpenCV createLensDistortionOpenCV(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 onOpenCV formalizationwith 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.
0(no distortion).- Parameters:
k1- the first radial distortion simple coefficientk2- the second radial distortion simple coefficientk3- the third radial distortion simple coefficientk4- the first radial distortion rational coefficientk5- the second radial distortion rational coefficientk6- the third radial distortion rational coefficientp1- the first tangential (decentering) distortion coefficientp2- the second tangential (decentering) distortion coefficients1- the first thin prism distortion coefficients2- the second thin prism distortion coefficients3- the third thin prism distortion coefficients4- the fourth thin prism distortion coefficient- Returns:
- a new OpenCV lens distortion representation
-
createLensDistortionOpenCV
public static LensDistortionOpenCV createLensDistortionOpenCV(double k1, double k2, double k3, double k4, double k5, double k6, double p1, double p2)Create a new distortion representation based onOpenCV formalizationwith 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.
0(no distortion).- Parameters:
k1- the first radial distortion simple coefficientk2- the second radial distortion simple coefficientk3- the third radial distortion simple coefficientk4- the first radial distortion rational coefficientk5- the second radial distortion rational coefficientk6- the third radial distortion rational coefficientp1- the first tangential (decentering) distortion coefficientp2- the second tangential (decentering) distortion coefficient- Returns:
- a new OpenCV lens distortion representation
-
createLensDistortionOpenCV
public static LensDistortionOpenCV createLensDistortionOpenCV(double k1, double k2, double k3, double p1, double p2)Create a new distortion representation based onOpenCV formalizationwith 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.
0(no distortion).- Parameters:
k1- the first radial distortion simple coefficientk2- the second radial distortion simple coefficientk3- the third radial distortion simple coefficientp1- the first tangential (decentering) distortion coefficientp2- the second tangential (decentering) distortion coefficient- Returns:
- a new OpenCV lens distortion representation
-
createLensDistortionOpenCV
public static LensDistortionOpenCV createLensDistortionOpenCV(org.jeometry.math.Vector coefficients) throws IllegalArgumentExceptionCreate a new distortion representation based onOpenCV formalizationwith 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.
- (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- Returns:
- a new OpenCV lens distortion representation
- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
createLensDistortionOpenCV
public static LensDistortionOpenCV createLensDistortionOpenCV(float[] coefficients) throws IllegalArgumentExceptionCreate a new distortion representation based onOpenCV formalizationwith 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.
- [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- Returns:
- a new OpenCV lens distortion representation
- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
createLensDistortionOpenCV
public static LensDistortionOpenCV createLensDistortionOpenCV(double[] coefficients) throws IllegalArgumentExceptionCreate a new distortion representation based onOpenCV formalizationwith 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.
- [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- Returns:
- a new OpenCV lens distortion representation
- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
createLensDistortionMetashape
Create a new distortion representation based onAgisoft Metashape(c) formalizationwith no distortion.- Returns:
- the lens distortion
-
createLensDistortionMetashape
public static LensDistortionMetashape createLensDistortionMetashape(double k1, double k2, double k3, double k4, double p1, double p2)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:
k1- the first radial distortion simple coefficientk2- the second radial distortion simple coefficientk3- the third radial distortion simple coefficientk4- the fourth radial distortion simple coefficientp1- the first tangential (decentering) distortion coefficientp2- the second tangential (decentering) distortion coefficient- Returns:
- a lens distortion
-
createLensDistortionMetashape
public static LensDistortionMetashape createLensDistortionMetashape(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- Returns:
- a lens distortion
- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
createLensDistortionMetashape
public static LensDistortionMetashape createLensDistortionMetashape(float[] 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- Returns:
- a lens distortion
- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-
createLensDistortionMetashape
public static LensDistortionMetashape createLensDistortionMetashape(double[] 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- Returns:
- a lens distortion
- Throws:
IllegalArgumentException- if the input array does not match a distortion configuration
-