Package inputOutput
Class TransformationMatrix
java.lang.Object
inputOutput.TransformationMatrix
-
Field Summary
Modifier and TypeFieldDescriptionint[][]
Factors for flipping (mirroring) the imageint
Assuming that rotation, translation and scale matrix uses 3 dimension, we skip this dimension in order to use it for 2Dfloat[][]
The raw measurements of the image points (landmarks in image coordinates)float[][]
The rotation matrix, provided by MITKfloat[]
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
-
Method Summary
Modifier and TypeMethodDescriptionorg.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 3Dorg.opencv.core.Mat
Converts the rotation matrix array into an OpenCV-Matrixorg.opencv.core.Mat
Converts the scale vector array into an OpenCV-Matrixorg.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 3Dorg.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 matrixorg.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 matrixorg.opencv.core.Mat
Calculates a transformation matrix by the provided raw points.org.opencv.core.Mat
Converts the translation vector array into an OpenCV-Matrixstatic TransformationMatrix
loadFromJSON
(String file) Loads the attributes from a filevoid
saveToJSON
(File file) Writes the current configuration into a JSON file
-
Field Details
-
rotation3d
public float[][] rotation3dThe rotation matrix, provided by MITK -
translationVector3d
public float[] translationVector3dThe translation vector as provided by MITK -
scaleVector3d
public float[] scaleVector3dScaling vector (applied in the respective dimensions) -
flip2d
public int[][] flip2dFactors for flipping (mirroring) the image -
imagePoints
public float[][] imagePointsThe raw measurements of the image points (landmarks in image coordinates) -
trackingPoints
public float[][] trackingPointsThe raw measurements of the tracker (landmarks in tracking coordinates) -
ignoreDimension
public int ignoreDimensionAssuming 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
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
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
-