Write 3D pose data to text file.
::write_pose is used to write 3D pose data Pose into a text file with the name PoseFile.
The input tupel Pose describes 3D pose parameters which describe a 3D transform, for example the external camera parameters. These are given by the 3D translational vector (in meters), the three rotation angles and the code of the representation type of the 3D transform: E.g., the value '0' is the code of the representation type 1 and says, that the transform of a point is described, hereby the 3D rotation is performed before the 3D translation, that the three rotations are specified as angles (in degrees), and that the rotation order is Gamma-Beta-Alpha, i.e., the first rotation is around the Z-axis, the second one around the new Y-axis, and the third one around the new X-axis, which is generated after the second rotation. ::pose_to_hom_mat3d operates with all types of 3D transform. The sense of the other representation types are explained at ::create_pose.
A file generated by ::write_pose looks like the following:
# 3D POSE PARAMETERS: rotation and translation # Used representation type: f 0 # Rotation angles [deg] or Rodriguez-vector: r -17.8134 1.83816 0.288092 # Translational vector (x y z [m]): t 0.280164 0.150644 1.7554
|
Pose (input_control) |
pose-array -> HTuple.double / long |
| External camera parameters. | |
| Number of elements: 7 | |
|
PoseFile (input_control) |
filename -> HTuple.char * |
| File name of the external camera parameters. | |
| Default value: 'campose.dat' | |
| List of values: 'campose.dat', 'campose.initial', 'campose.final' | |
HTuple StartCamPar,NX,NY,NZ;
HTuple RCoord1,CCoord1,StartPose1;
HTuple RCoord2,CCoord2,StartPose2;
HTuple RCoord3,CCoord3,StartPose3;
HTuple StartPoses,RCoords,CCoords;
HTuple CamParam,NFinalPose,FinalPose,Errors;
// read calibration images
HImage Image1("calib-01.tiff");
HImage Image2("calib-02.tiff");
HImage Image3("calib-03.tiff");
// find calibration pattern
HRegion Caltab1 = Image1.FindCaltab("caltab.descr",3,112,5);
HRegion Caltab2 = Image2.FindCaltab("caltab.descr",3,112,5);
HRegion Caltab3 = Image3.FindCaltab("caltab.descr",3,112,5);
// find calibration marks and start poses
StartCamPar[7] = 576; // ImageHeight
StartCamPar[6] = 768; // ImageWidth
StartCamPar[5] = 288; // Cy
StartCamPar[4] = 384; // Cx
StartCamPar[3] = 0.000011; // Sy
StartCamPar[2] = 0.000011; // Sx
StartCamPar[1] = 0.0; // Kappa
StartCamPar[0] = 0.008; // Focus
RCoord1 = Image1.FindMarksAndPose(Caltab1,"caltab.descr",StartCamPar,
128,10,&CCoord1,&StartPose1);
RCoord2 = Image2.FindMarksAndPose(Caltab2,"caltab.descr",StartCamPar,
128,10,&CCoord2,&StartPose2);
RCoord3 = Image3.FindMarksAndPose(Caltab3,"caltab.descr",StartCamPar,
128,10,&CCoord3,&StartPose3);
// read 3D positions of calibration marks
::caltab_points("caltab.descr",&NX,&NY,&NZ);
// camera calibration
StartPoses = (StartPose1.Append(StartPose2)).Append(StartPose3);
RCoords = (RCoord1.Append(RCoord2)).Append(RCoord3);
CCoords = (CCoord1.Append(CCoord2)).Append(CCoord3);
::camera_calibration(NX,NY,NZ,RCoords,CCoords,StartCamPar,StartPoses,
11,&CamParam,&NFinalPose,&Errors);
/* write external camera parameters of first calibration image */
FinalPose[6] = NFinalPose[6];
FinalPose[5] = NFinalPose[5];
FinalPose[4] = NFinalPose[4];
FinalPose[3] = NFinalPose[3];
FinalPose[2] = NFinalPose[2];
FinalPose[1] = NFinalPose[1];
FinalPose[0] = NFinalPose[0];
::write_pose(FinalPose,"campose.dat");
::write_pose returns H_MSG_TRUE if all parameter values are correct and the file has been written successfully. If necessary an exception handling is raised.
::camera_calibration, ::hom_mat3d_to_pose
::create_pose, ::find_marks_and_pose, ::camera_calibration, ::disp_caltab, ::sim_caltab, ::read_pose, ::pose_to_hom_mat3d, ::hom_mat3d_to_pose
Camera calibration