3D-Lagen werden typischerweise für zwei Zwecke verwendet: Erstens zur
Beschreibung der Position und Orientierung eines Koordinatensystems relativ
zu einem anderen (z.B. die 3D-Lage eines Objektkoordinatensystems relativ
zum Kamerakoordinatensystem - kurz, die 3D-Lage des Objekts relativ zur
Kamera) und zweitens zur Beschreibung der Transformation von Koordinaten
zwischen Koordinatensystemen (z.B. die Transformation von Objektkoordinaten
in Kamerakoordinaten).
wird in der
Fachliteratur auch Yaw-Pitch-Roll Konvention genannt.
Bitte beachten Sie, dass diese Kette auf zwei Arten „gelesen“ werden kann:
Wenn man von rechts startet, werden die Rotationen immer relativ zum globalen
(unveränderten oder „alten“) Koordinatensystem ausgeführt. D.h.,
kann wie folgt gelesen
werden: Erst wird um die z-Achse rotiert, dann um die „alte“ y-Achse und
schließlich um die „alte“ x-Achse. Falls die Kette dagegen von links nach
rechts gelesen wird, werden die Rotationen jeweils relativ zum lokalen
(„neuen“) Koordinatensystem ausgeführt. Dann liest sich
wie folgt: Erst wird um
die x-Achse rotiert, dann um die „neue“ y-Achse und schließlich um die
„neu(st)e“ z-Achse.
Von rechts nach links gelesen, entspricht
der folgenden Sequenz von
Operatoraufrufen:
Falls der Wert 'rodriguez'"rodriguez""rodriguez""rodriguez""rodriguez""rodriguez" in OrderOfRotationOrderOfRotationOrderOfRotationOrderOfRotationOrderOfRotationorderOfRotation übergeben
wird, werden die Rotationsparameter RotXRotXRotXRotXRotXrotX, RotYRotYRotYRotYRotYrotY und
RotZRotZRotZRotZRotZrotZ als die x-, y- und z-Komponente des sogenannten
Rodriguez-Rotationsvektors interpretiert. Die Richtung dieses Vektors
definiert die (beliebige) Rotationsachse, seine Länge den Rotationswinkel
(mathematisch positive Orientierung). HALCON verwendet eine Variation des
Rodriguez-Vektors, in der die Länge des Vektors gleich dem Tangens des halben
Winkels ist:
Bitte beachten Sie, dass diese Posen-Darstellung nicht immer eindeutig ist,
d.h. mehrere Posen-Darstellungen beschreiben dieselbe homogene
Transformationsmatrix. Beispielsweise für
mit
haben die folgenden zwei Posen die gleiche Darstellung als homogene Transformationsmatrix:
Mit dem Operator pose_to_hom_mat3dpose_to_hom_mat3dPoseToHomMat3dpose_to_hom_mat3dPoseToHomMat3dPoseToHomMat3d erhält man die der 3D-Lage
entsprechende homogene Transformationsmatrix. Gemäß der Standard-Definition
ist dies die folgende Transformationsmatrix, welche in zwei separate Matrizen
aufgespaltet werden kann, eine für die Translation
(H(t)) und eine für die Rotation
(H(R)):
Koordinatentransformation
Die folgende Gleichung zeigt, wie ein Punkt mit Hilfe einer 3D-Lage (bzw.
der entsprechenden homogenen Transformationsmatrix
) von Koordinatensystem 1 in
Koordinatensystem 2 transformiert werden kann (Ein- und Ausgabepunkte als
homogene Vektoren dargestellt, vgl. affine_trans_point_3daffine_trans_point_3dAffineTransPoint3daffine_trans_point_3dAffineTransPoint3dAffineTransPoint3d). Beachten
Sie, dass zur Transformation von Koordinatensystem 1 in System 2 die
homogene Transformationsmatrix verwendet wird, die die 3D-Lage von System 1
relativ zu System 2 beschreibt:
Die Gleichung entspricht der folgenden Sequenz von Operatoraufrufen:
Wenn in 'coordinate_system'"coordinate_system""coordinate_system""coordinate_system""coordinate_system""coordinate_system" in ViewOfTransformViewOfTransformViewOfTransformViewOfTransformViewOfTransformviewOfTransform übergeben
wird, bleibt die Reihenfolge der Transformationen gleich, aber die
Rotationswinkel werden negiert. Bitte beachten Sie, dass dies nicht der
Transformation eines Koordinatensystems entspricht, auch wenn der
Parameterwert dies suggeriert!
* Goal: Calibration with non-standard calibration object
* Read start values for internal camera parameters
read_cam_par('campar.dat', CameraParam)
* (Read 3D world points [WorldPointsX,WorldPointsY,WorldPointsZ],
* extract corresponding 2D image points [PixelsRow,PixelsColumn])
* Task: Create starting value for the external camera parameters, i.e., the
* pose of the calibration object in the calibration images
* First image: Calibration object placed at a distance of 0.5 and 0.1
* 'below' the camera coordinate system
* orientation 'read from left to right': rotated 30 degrees
* around the optical axis of the camera (z-axis),
* then tilted 10 degrees around the new y-axis
create_pose(0.1, 0.0, 0.5, 30, 10, 0, 'Rp+T', 'abg', 'point', StartPose1)
* (Accumulate all poses in StartPoses = [StartPose1, StartPose2, ...])
* perform the calibration
camera_calibration(WorldPointsX, WorldPointsY, WorldPointsZ, \
PixelsRow, PixelsColumn, CameraParam, StartPoses, \
'pose', FinalCamParam, FinalPoses, Errors)
* Goal: Calibration with non-standard calibration object
* Read start values for internal camera parameters
read_cam_par('campar.dat', CameraParam)
* (Read 3D world points [WorldPointsX,WorldPointsY,WorldPointsZ],
* extract corresponding 2D image points [PixelsRow,PixelsColumn])
* Task: Create starting value for the external camera parameters, i.e., the
* pose of the calibration object in the calibration images
* First image: Calibration object placed at a distance of 0.5 and 0.1
* 'below' the camera coordinate system
* orientation 'read from left to right': rotated 30 degrees
* around the optical axis of the camera (z-axis),
* then tilted 10 degrees around the new y-axis
create_pose(0.1, 0.0, 0.5, 30, 10, 0, 'Rp+T', 'abg', 'point', StartPose1)
* (Accumulate all poses in StartPoses = [StartPose1, StartPose2, ...])
* perform the calibration
camera_calibration(WorldPointsX, WorldPointsY, WorldPointsZ, \
PixelsRow, PixelsColumn, CameraParam, StartPoses, \
'pose', FinalCamParam, FinalPoses, Errors)
* Goal: Calibration with non-standard calibration object
* Read start values for internal camera parameters
read_cam_par('campar.dat', CameraParam)
* (Read 3D world points [WorldPointsX,WorldPointsY,WorldPointsZ],
* extract corresponding 2D image points [PixelsRow,PixelsColumn])
* Task: Create starting value for the external camera parameters, i.e., the
* pose of the calibration object in the calibration images
* First image: Calibration object placed at a distance of 0.5 and 0.1
* 'below' the camera coordinate system
* orientation 'read from left to right': rotated 30 degrees
* around the optical axis of the camera (z-axis),
* then tilted 10 degrees around the new y-axis
create_pose(0.1, 0.0, 0.5, 30, 10, 0, 'Rp+T', 'abg', 'point', StartPose1)
* (Accumulate all poses in StartPoses = [StartPose1, StartPose2, ...])
* perform the calibration
camera_calibration(WorldPointsX, WorldPointsY, WorldPointsZ, \
PixelsRow, PixelsColumn, CameraParam, StartPoses, \
'pose', FinalCamParam, FinalPoses, Errors)
// goal: calibration with non-standard calibration object
HTuple CameraParam, StartPose1, StartPoses, FinalPoses;
HTuple Errors, FinalCamParam;
HTuple WorldPointsX, WorldPointsY, WorldPointsZ, PixelsRow, PixelsColumn;
// read start values for internal camera parameters
read_cam_par("campar.dat", &CameraParam);
// (read 3D world points [WorldPointsX,WorldPointsY,WorldPointsZ],
// extract corresponding 2D image points [PixelsRow,PixelsColumn])
// task: create starting value for the external camera parameters, i.e., the
// pose of the calibration object in the calibration images
// first image: calibration object placed at a distance of 0.5 and 0.1
// 'below' the camera coordinate system
// orientation 'read from left to right': rotated 30 degrees
// around the optical axis of the camera (z-axis),
// then tilted 10 degrees around the new y-axis
create_pose(0.1, 0.0, 0.5, 30, 10, 0, 'Rp+T', 'abg', 'point', &StartPose1);
// (accumulate all poses in StartPoses = [StartPose1, StartPose2, ...])
// perform the calibration
camera_calibration(WorldPointsX, WorldPointsY, WorldPointsZ,
PixelsRow, PixelsColumn, CameraParam, StartPoses, "pose",
&FinalCamParam, &FinalPoses, &Errors);
* Goal: Calibration with non-standard calibration object
* Read start values for internal camera parameters
read_cam_par('campar.dat', CameraParam)
* (Read 3D world points [WorldPointsX,WorldPointsY,WorldPointsZ],
* extract corresponding 2D image points [PixelsRow,PixelsColumn])
* Task: Create starting value for the external camera parameters, i.e., the
* pose of the calibration object in the calibration images
* First image: Calibration object placed at a distance of 0.5 and 0.1
* 'below' the camera coordinate system
* orientation 'read from left to right': rotated 30 degrees
* around the optical axis of the camera (z-axis),
* then tilted 10 degrees around the new y-axis
create_pose(0.1, 0.0, 0.5, 30, 10, 0, 'Rp+T', 'abg', 'point', StartPose1)
* (Accumulate all poses in StartPoses = [StartPose1, StartPose2, ...])
* perform the calibration
camera_calibration(WorldPointsX, WorldPointsY, WorldPointsZ, \
PixelsRow, PixelsColumn, CameraParam, StartPoses, \
'pose', FinalCamParam, FinalPoses, Errors)
* Goal: Calibration with non-standard calibration object
* Read start values for internal camera parameters
read_cam_par('campar.dat', CameraParam)
* (Read 3D world points [WorldPointsX,WorldPointsY,WorldPointsZ],
* extract corresponding 2D image points [PixelsRow,PixelsColumn])
* Task: Create starting value for the external camera parameters, i.e., the
* pose of the calibration object in the calibration images
* First image: Calibration object placed at a distance of 0.5 and 0.1
* 'below' the camera coordinate system
* orientation 'read from left to right': rotated 30 degrees
* around the optical axis of the camera (z-axis),
* then tilted 10 degrees around the new y-axis
create_pose(0.1, 0.0, 0.5, 30, 10, 0, 'Rp+T', 'abg', 'point', StartPose1)
* (Accumulate all poses in StartPoses = [StartPose1, StartPose2, ...])
* perform the calibration
camera_calibration(WorldPointsX, WorldPointsY, WorldPointsZ, \
PixelsRow, PixelsColumn, CameraParam, StartPoses, \
'pose', FinalCamParam, FinalPoses, Errors)