Package inputOutput

Class TransformationMatrix

java.lang.Object
inputOutput.TransformationMatrix

public class TransformationMatrix extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int[][]
    Factors for flipping (mirroring) the image
    int
    Assuming that rotation, translation and scale matrix uses 3 dimension, we skip this dimension in order to use it for 2D
    float[][]
    The raw measurements of the image points (landmarks in image coordinates)
    float[][]
    The rotation matrix, provided by MITK
    float[]
    Scaling vector (applied in the respective dimensions)
    float[][]
    The raw measurements of the tracker (landmarks in tracking coordinates)
    float[]
    The translation vector as provided by MITK
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.opencv.core.MatOfPoint2f
    Provides the image points as OpenCV-Matrix Only uses the first two coordinates of the point (2D)
    org.opencv.core.MatOfPoint3f
    Provides the image points as OpenCV-Matrix Uses three point coordinates, to calculate in 3D
    org.opencv.core.Mat
    Converts the rotation matrix array into an OpenCV-Matrix
    org.opencv.core.Mat
    Converts the scale vector array into an OpenCV-Matrix
    org.opencv.core.MatOfPoint2f
    Provides the tracking points as OpenCV-Matrix Only uses the first two coordinates of the point (2D)
    org.opencv.core.MatOfPoint3f
    Provides the tracking points as OpenCV-Matrix Uses three point coordinates, to calculate in 3D
    org.opencv.core.Mat
    Calculates a transformation matrix by the provided raw points Uses OpenCV's estimate-method based on RANSAC method Uses only the x,y coordinates of the points and hence only calculates a 2D projection matrix
    org.opencv.core.Mat
    Calculates a transformation matrix by the provided raw points Uses OpenCV's estimate-method based on RANSAC method Uses x,y,z coordinates of the points and hence calculates a 3D projection matrix
    org.opencv.core.Mat
    Calculates a transformation matrix by the provided raw points.
    org.opencv.core.Mat
    Converts the translation vector array into an OpenCV-Matrix
    Loads the attributes from a file
    void
    Writes the current configuration into a JSON file

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • rotation3d

      public float[][] rotation3d
      The rotation matrix, provided by MITK
    • translationVector3d

      public float[] translationVector3d
      The translation vector as provided by MITK
    • scaleVector3d

      public float[] scaleVector3d
      Scaling vector (applied in the respective dimensions)
    • flip2d

      public int[][] flip2d
      Factors for flipping (mirroring) the image
    • imagePoints

      public float[][] imagePoints
      The raw measurements of the image points (landmarks in image coordinates)
    • trackingPoints

      public float[][] trackingPoints
      The raw measurements of the tracker (landmarks in tracking coordinates)
    • ignoreDimension

      public int ignoreDimension
      Assuming that rotation, translation and scale matrix uses 3 dimension, we skip this dimension in order to use it for 2D
  • Constructor Details

    • TransformationMatrix

      public TransformationMatrix()
  • Method Details

    • loadFromJSON

      public static TransformationMatrix loadFromJSON(String file) throws FileNotFoundException
      Loads the attributes from a file
      Parameters:
      file - Path of the json file
      Returns:
      A TransformationMatrix-Object
      Throws:
      FileNotFoundException - If the path is invalid
    • saveToJSON

      public void saveToJSON(File file) throws IOException
      Writes the current configuration into a JSON file
      Parameters:
      file - The file to write to
      Throws:
      IOException - If problems occur
    • getImagePoints2d

      public org.opencv.core.MatOfPoint2f getImagePoints2d()
      Provides the image points as OpenCV-Matrix Only uses the first two coordinates of the point (2D)
      Returns:
      the points as MatOfPoint2f
    • getTrackingPoints2d

      public org.opencv.core.MatOfPoint2f getTrackingPoints2d()
      Provides the tracking points as OpenCV-Matrix Only uses the first two coordinates of the point (2D)
      Returns:
      the points as MatOfPoints2f
    • getImagePoints3d

      public org.opencv.core.MatOfPoint3f getImagePoints3d()
      Provides the image points as OpenCV-Matrix Uses three point coordinates, to calculate in 3D
      Returns:
      the points as MatOfPoint3f
    • getTrackingPoints3d

      public org.opencv.core.MatOfPoint3f getTrackingPoints3d()
      Provides the tracking points as OpenCV-Matrix Uses three point coordinates, to calculate in 3D
      Returns:
      the points as MatOfPoints3f
    • getRotationMat

      public org.opencv.core.Mat getRotationMat()
      Converts the rotation matrix array into an OpenCV-Matrix
      Returns:
      The converted matrix
    • getTranslationMat

      public org.opencv.core.Mat getTranslationMat()
      Converts the translation vector array into an OpenCV-Matrix
      Returns:
      The converted matrix
    • getScaleMat

      public org.opencv.core.Mat getScaleMat()
      Converts the scale vector array into an OpenCV-Matrix
      Returns:
      The converted matrix
    • getTransformMatProjectionTransform

      public org.opencv.core.Mat getTransformMatProjectionTransform()
      Calculates a transformation matrix by the provided raw points. Uses the method of finding the projective transform. See also https://math.stackexchange.com/a/339033 !! Only works with a 2D-representation of the points. !!
      Returns:
      The resulting transformation matrix
    • getTransformMatOpenCvEstimated2d

      public org.opencv.core.Mat getTransformMatOpenCvEstimated2d()
      Calculates a transformation matrix by the provided raw points Uses OpenCV's estimate-method based on RANSAC method Uses only the x,y coordinates of the points and hence only calculates a 2D projection matrix
      Returns:
      The transformation matrix
    • getTransformMatOpenCvEstimated3d

      public org.opencv.core.Mat getTransformMatOpenCvEstimated3d()
      Calculates a transformation matrix by the provided raw points Uses OpenCV's estimate-method based on RANSAC method Uses x,y,z coordinates of the points and hence calculates a 3D projection matrix
      Returns:
      The transformation matrix