Class CameraKannalaBrandt

All Implemented Interfaces:
Serializable

public class CameraKannalaBrandt extends CameraPinhole
A camera model for pinhole, wide angle, and fisheye cameras. The full camera model from [1] has been implemented. While mathematically very similar to the model presented in [1], this has been modified to extend a pinhole camera model and now can model skew. In the original formulation skew was implicitly 0. (mu, mv) = (fx, fy). This was done primarily to maximize code reuse and integration with existing code.

(x,y,z) is a point in 3D space in camera frame

θ = acos(z/normf([x y z]))

φ = atan2(y, x)

symmetric(θ) = k1θ + k2θ3 + ... + θnθ2*n-1

radial(θ,φ) = (l1θ + l2θ3 + l3θ5) (i1cos(φ) + i2sin(φ) + i3cos(2φ) + i4sin(2φ))

tangential(θ,φ) = (m1θ + m2θ3 + m3θ5) (j1cos(φ) + j2sin(φ) + j3cos(2φ) + j4sin(2φ))

Then the distorted normalized coordinates are found:

xd = (symmetric(θ) + radial(θ,φ))ur(φ) + tangential(θ,φ)ut(φ)

where ur and ut are unit vectors in radial and tangential directions.

NOTE: If the number of asymmetric distortion terms is set to zero then there will only be radially symmetric distortion. This is what most libraries refer to as the Kannala-Brandt model as they do not implement the full model. It's also often referred to as an Equidistance model. That's a bit of a misnomer as the Equidistance model is defined as r = f*theta, which is a special case of the symmetric model. BoofCV's naming convention is closer to the original authors in [1] and their source code.

[1] Kannala, J., and Brandt, S. S. (2006). A generic camera model and calibration method for conventional, wide-angle, and fish-eye lenses. IEEE transactions on pattern analysis and machine intelligence, 28(8), 1335-1340.

See Also:
  • Field Details

    • symmetric

      public double[] symmetric
      Coefficients for radially symmetric model
    • radial

      public double[] radial
      Coefficients for distortion terms in radial direction
    • radialTrig

      public double[] radialTrig
      Coefficients for distortion terms in radial direction
    • tangent

      public double[] tangent
      Coefficients for distortion terms in tangential direction
    • tangentTrig

      public double[] tangentTrig
      Coefficients for distortion terms in tangential direction
  • Constructor Details

    • CameraKannalaBrandt

      public CameraKannalaBrandt(int numSymmetric, int numAsymmetric)
      Constructor which allows the order of all distortion coefficients to be specified
      Parameters:
      numSymmetric - Number of radially symmetric terms. Standard is 5.
      numAsymmetric - Number of non symmetric terms. If not zero then trig coefficients will be 4. Standard is 4
    • CameraKannalaBrandt

      public CameraKannalaBrandt(CameraKannalaBrandt src)
      Copy constructor
    • CameraKannalaBrandt

      public CameraKannalaBrandt()
      With no coefficients specified.
  • Method Details

    • configureCoefficients

      public void configureCoefficients(int numSymmetric, int numAsymmetric)
      Configures the number of coefficients for each distortion term.
      Parameters:
      numSymmetric - Number of radially symmetric terms. Standard is 5.
      numAsymmetric - Number of non symmetric terms. If not zero then trig coefficients will be 4. Standard is 4
    • fsetK

      public CameraKannalaBrandt fsetK(double fx, double fy, double skew, double cx, double cy)
      Overrides:
      fsetK in class CameraPinhole
    • fsetShape

      public CameraKannalaBrandt fsetShape(int width, int height)
      Overrides:
      fsetShape in class CameraPinhole
    • fsetSymmetric

      public CameraKannalaBrandt fsetSymmetric(double... coefs)
    • fsetRadial

      public CameraKannalaBrandt fsetRadial(double... coefs)
    • fsetTangent

      public CameraKannalaBrandt fsetTangent(double... coefs)
    • fsetRadialTrig

      public CameraKannalaBrandt fsetRadialTrig(double... coefs)
    • fsetTangentTrig

      public CameraKannalaBrandt fsetTangentTrig(double... coefs)
    • isSymmetricModel

      public boolean isSymmetricModel()
      Returns true if it's a symmetric model. That is, no radial or tangential distortion
    • isAsymmetricModel

      public boolean isAsymmetricModel()
      Returns true if there are coefficients that could result in a non-zero distortion for the non-symmetric terms. This does not check to see if the coefficients are zero.
    • setTo

      Copies the value of 'src' into 'this'. After this call they will be identical
      Parameters:
      src - (input) Camera model
    • isIdentical

      public boolean isIdentical(CameraKannalaBrandt src)
      Checks to see of the two models are exactly alike
    • createLike

      public <T extends CameraModel> T createLike()
      Description copied from class: CameraModel
      Creates a new camera model with zero values of the same type os this one
      Overrides:
      createLike in class CameraPinhole
    • toString

      public String toString()
      Overrides:
      toString in class CameraPinhole
    • print

      public void print()
      Description copied from class: CameraModel
      Prints a summary of this model to stdout
      Overrides:
      print in class CameraPinhole