Halcon学习之仿射变换3D3

7.转换一个3d仿射变换矩阵为pose

//转换一个3d仿射变换矩阵为pose,pose代表一个3d刚性物体变换数据集,可以平移和旋转
    //pose对象参数说明:参数1-参数3:代表x,y,z三个方向的平移量,参数4-参数6:代表x,y,z三个轴的旋转量,最后一个代表操作类型。
    HPose pose = rotatelocal.HomMat3dToPose();
    tuple=pose.ConvertToTuple();
    for (int i = 0; i < tuple.Length(); i++)
    {
        cout << (double)tuple[i] << " ";
    }       
    cout << endl << endl;

8.添加平移因子到一个3d仿射变换矩阵中

//添加平移因子到一个3d仿射变换矩阵中
    //参数说明:参数1:相对于x轴方向的平移量,参数2:相对于y轴方向的平移量,参数3:相对于z轴方向的平移量,

    HHomMat3D translate = hhommat3d.HomMat3dTranslate(5, -1, 10);
    tuple = translate.ConvertToTuple();

    for (int i = 0; i < tuple.Length(); i++)
    {
        cout << (double)tuple[i] << " ";
        if ((i + 1) % 4 == 0)
            cout << endl;
    }
    cout << endl;

9.添加平移因子到一个3d仿射变换矩阵中

//添加平移因子到一个3d仿射变换矩阵中,作用和示例8相同
    //参数说明:参数1:相对于x轴方向的平移量,参数2:相对于y轴方向的平移量,参数3:相对于z轴方向的平移量,

    HHomMat3D translatelocal = hhommat3d.HomMat3dTranslateLocal(5, -1, 10);
    tuple = translatelocal.ConvertToTuple();

    for (int i = 0; i < tuple.Length(); i++)
    {
        cout << (double)tuple[i] << " ";
        if ((i + 1) % 4 == 0)
            cout << endl;
    }
    cout << endl;

10.转置一个3d仿射变换矩阵

//转置一个3d仿射变换矩阵
    HHomMat3D transpose = translatelocal.HomMat3dTranspose();//利用translatelocal仿射变换矩阵对象进行测试结果
    tuple = transpose.ConvertToTuple();

    for (int i = 0; i < tuple.Length(); i++)
    {
        cout << (double)tuple[i] << " ";
        if ((i + 1) % 4 == 0)
            cout << endl;
    }
    cout << endl;

11.转换一个3d pose 为3d仿射变换矩阵

  //转换一个3d pose 为3d仿射变换矩阵
    HHomMat3D poseToMat = pose.PoseToHomMat3d();
    tuple = poseToMat.ConvertToTuple();

    for (int i = 0; i < tuple.Length(); i++)
    {
        cout << (double)tuple[i] << " ";
        if ((i + 1) % 4 == 0)
            cout << endl;
    }
    cout << endl;

你可能感兴趣的:(3D,仿射变换,halcon)