matrix3dhalconhomogenous-transformation

Halcon - Create hom_mat3D from data / Ajust existing hom_mat3D data


I am trying to create a Halcon homogeneous transformation matrix with data aquired from another process. I will be using it to generate a pose, which in turn will be used for rigid transformation.

The most useful option for hom_mat3D creation I have found so far is: hom_mat3d_identity (HomMat3DIdentity)

I tried using create_matrix and set_value_matrix to fill a matrix with the known data and then use hom_mat2d_compose(HomMat3DIdentity, matrix, result) Unfortunately Matrix and Hom_mat3d don't mix.

In short: How do I create a Halcon homogeneous transformation matrix from previously acuired variables? Many thanks!


Solution

  • Here is a snippet that shows how to create a hom_mat3d as well as a pose, write new data inside them and then multiply them together.

    hom_mat3d_identity (HomMat3DIdentity)
    HomMat3DIdentity[0] := 11
    HomMat3DIdentity[1] := 2
    HomMat3DIdentity[2] := 6
    HomMat3DIdentity[3] := 45
    HomMat3DIdentity[4] := 22
    HomMat3DIdentity[5] := 88
    HomMat3DIdentity[6] := 25
    HomMat3DIdentity[7] := 9
    HomMat3DIdentity[8] := 12
    HomMat3DIdentity[9] := 106
    HomMat3DIdentity[10] := 23
    HomMat3DIdentity[11] := 48
    
    hom_mat3d_to_pose (HomMat3DIdentity, Pose1)
    
    create_pose (0.1, 0.1, 0.1, 90, 90, 90, 'Rp+T', 'gba', 'point', Pose2)
    Pose2[0] := 67
    Pose2[1] := 71
    Pose2[2] := 11
    Pose2[3] := 23
    Pose2[4] := 56
    Pose2[5] := 98
    
    pose_compose (Pose1, Pose2, Pose3)