Class JVisionFactory

java.lang.Object
org.jvision.factory.JVisionFactory

public class JVisionFactory extends Object
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 Details

    • JVISION_IMPLEMENTATION_PROPERTY

      public static final String 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" (where val value is lower cased)
      • Call the static method void initJVisionImplementation() that have to provide the registering of the builders

      By default, JVision use the simple implementation that will provide simple implementations of all the API interfaces..
      See Also:
      Constant Field Values
    • JVISION_IMPLEMENTATION_INIT_CLASS

      public static final String JVISION_IMPLEMENTATION_INIT_CLASS
      The Initialization class of a JVision implementation.
      See Also:
      Constant Field Values
    • JVISION_IMPLEMENTATION_INIT_METHOD

      public static final String JVISION_IMPLEMENTATION_INIT_METHOD
      The static initialization method contained within the JVision implementation initialization class
      See Also:
      Constant Field Values
    • JVISION_DEFAULT_IMPLEMENTATION

      public static final String JVISION_DEFAULT_IMPLEMENTATION
      The default implementation that is used.
      See Also:
      Constant Field Values
  • Constructor Details

    • JVisionFactory

      public JVisionFactory()
  • Method Details

    • loadImplementation

      public static boolean loadImplementation(String implementation)
      Load and attach the given implementation.

      In order to be loaded, an implementation has to provide an org.jvision.<implementation>.JVisionImplementation class that contains a method public static void initJVisionImplementation() that attach the implementation to the factory.

      For example, the simple implementation provides a class org.jvision.simple.JVisionImplementation that contains the method public static void initJVisionImplementation().
      Parameters:
      implementation - the implementation to use
      Returns:
      true if the implementation is successfully loaded and attached and false otherwise.
    • getDefaultCameraBuilder

      public static CameraBuilder getDefaultCameraBuilder()
      Get the default camera builder.
      Returns:
      the default camera builder
      See Also:
      setDefaultCameraBuilder(CameraBuilder)
    • setDefaultCameraBuilder

      public static void setDefaultCameraBuilder(CameraBuilder builder)
      Set the default camera builder.
      Parameters:
      builder - the camera builder to use as default
      See Also:
      getDefaultCameraBuilder()
    • createLensDistortionBrown

      public static LensDistortionBrown createLensDistortionBrown()
      Create a new distortion representation based on Brown formalization with 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 on Brown formalization with radial coefficients (k1, k2, k3, k4) and tangential coefficients (p1, p2, p3, p4).
      Parameters:
      k1 - the first radial distortion coefficient
      k2 - the second radial distortion coefficient
      k3 - the third radial distortion coefficient
      k4 - the fourth radial distortion coefficient
      p1 - the first tangential distortion coefficient
      p2 - the second tangential distortion coefficient
      p3 - the third tangential distortion coefficient
      p4 - 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 IllegalArgumentException
      Create a new distortion representation based on Brown formalization with 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 IllegalArgumentException
      Create a new distortion representation based on Brown formalization 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
    • createLensDistortionBrown

      public static LensDistortionBrown createLensDistortionBrown(double[] coefficients) throws IllegalArgumentException
      Create 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

      public static LensDistortionOpenCV createLensDistortionOpenCV()
      Create a new distortion representation based on OpenCV formalization with 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 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
      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 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.
      With this creation method, the tilt distortion coefficients are set to 0 (no distortion).
      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
      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 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.
      With this creation method, the thin prism and tilt distortions coefficients are set to 0 (no distortion).
      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
      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 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.
      With this creation method, the radial rational, thin prism and tilt distortions coefficients are set to 0 (no distortion).
      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
      Returns:
      a new OpenCV lens distortion representation
    • createLensDistortionOpenCV

      public static LensDistortionOpenCV createLensDistortionOpenCV(org.jeometry.math.Vector coefficients) throws IllegalArgumentException
      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
      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 IllegalArgumentException
      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
      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 IllegalArgumentException
      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
      Returns:
      a new OpenCV lens distortion representation
      Throws:
      IllegalArgumentException - if the input array does not match a distortion configuration
    • createLensDistortionMetashape

      public static LensDistortionMetashape createLensDistortionMetashape()
      Create a new distortion representation based on Agisoft Metashape(c) formalization with 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 on Agisoft Metashape(c) formalization with 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 coefficient
      k2 - the second radial distortion simple coefficient
      k3 - the third radial distortion simple coefficient
      k4 - the fourth radial distortion simple coefficient
      p1 - the first tangential (decentering) distortion coefficient
      p2 - the second tangential (decentering) distortion coefficient
      Returns:
      a lens distortion
    • createLensDistortionMetashape

      public static LensDistortionMetashape createLensDistortionMetashape(org.jeometry.math.Vector coefficients) throws IllegalArgumentException
      Create a new distortion representation based on Agisoft Metashape(c) formalization with 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.
      Accepted vector is (k1, k2, k3, k4, p1, p2) (6 dimensions).
      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 IllegalArgumentException
      Create a new distortion representation based on Agisoft Metashape(c) formalization with 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.
      Accepted array is [k1, k2, k3, k4, p1, p2] (length 6).
      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 IllegalArgumentException
      Create a new distortion representation based on Agisoft Metashape(c) formalization with 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.
      Accepted array is [k1, k2, k3, k4, p1, p2] (length 6).
      Parameters:
      coefficients - the distortion coefficients
      Returns:
      a lens distortion
      Throws:
      IllegalArgumentException - if the input array does not match a distortion configuration