public static class TLcdPanoramicTransformationFactory.PerspectiveTransformationBuilder
extends java.lang.Object
Builder for a ILcdModelModelTransformations that transform 3D reference CS
points to 2D image CS points for perspective camera images ("pinhole images").
By default, this transformation expects that the image axes X and Y map to the world axes X and Y, and that the center of the image points to -Z.
You can change this by specifying a rotation(double[]).
Set the 3 x 3 rotation matrix for the transformation.
By default, this transformation expects that the image axes X and Y map to the world axes X and Y, and that the center of the image points to -Z.
As such, the default value for this property is the identity matrix.
The rotation matrix describes how the 3D camera CS is rotated relative to the reference CS.
It is provided as a row-major array of doubles:
[ m11, m12, m13,
m21, m22, m23,
m31, m32, m33 ]
You can use this rotation to orient your image in the world.
Examples
Example 1: image axes are different from the expected defaults
Often, image formats will use a different axis alignment than what this perspective transformation expects.
The easiest way to rectify this is by swapping the input axes so they map on the expected axes.
This example keeps X, but maps Y onto Z, and Z onto -Y.
This is the same as rotating 90 degrees clockwise around X.
Perspective image can be taken at any angle in 3D. Some formats offer these angles as a quaternion.
Matrix3d poseMatrix = new Matrix3d();
poseMatrix.set(new Quat4d(rot));
Example 3: applying a heading
Sometimes, the center of the image is defined by a heading azimuth (degrees, clockwise starting north).
This can be applied by rotating around the Z axis.
Matrix3d headingMatrix = new Matrix3d();
headingMatrix.rotZ(Math.toRadians(-heading));
Example 4: combination of both
You can combine the two operations by multiplying the matrices into one.
Set the 2D image coordinates of the principal point.
The principal point is the point on the image that is the closest to the camera's projection center,
or in other words, the point where the Z axis of the camera CS intersects the image plane.
Note that the point is expressed in terms of the 2D image CS, in the range (0.0,0.0) to (1.0,1.0).
See TLcdPanoramicTransformationFactory.
The default value for this property is (0.5,0.5).
Parameters:
aX - the x coordinate of the principal point in the range (0.0-1.0)
aY - the y coordinate of the principal point in the range (0.0-1.0)
This property is used to calculate either the horizontal or
vertical field of view value if only one of them is provided.
It has no default value. See build().
Get the perspective camera parameters from image properties.
The focal length and pixel size parameters are expressed in the reference CS's unit of measurement
(most likely, that will be meters).
The image size parameters are expressed in number of pixels.
Parameters:
aFocalLength - the camera's focal length (in the reference CS's unit of measurement)
aImageWidth - the width of the image (in pixels)
aImageHeight - the height of the image (in pixels)
aPixelWidth - the width of a single pixel (in the reference CS's unit of measurement)
aPixelHeight - the height of a single pixel (in the reference CS's unit of measurement)