3d Halcon-仿射变换轮廓的三维等价物

3d Halcon-仿射变换轮廓的三维等价物,3d,transform,contour,halcon,3d,Transform,Contour,Halcon,我有一个XLD轮廓,我需要从世界平面转换到图像平面。。但我只能找到affine\u trans\u contour\u xld,它接受2D垫,而不是3D垫。。如何将xld轮廓从世界平面变换到图像平面 基本上我需要的是轮廓到世界平面的倒数 编辑:我认为解决方案是找到XY平面的2D Mat,但也找不到如何做到这一点。我写了一个我以前使用过的代码 程序名称:世界平面坐标到图像点 输入控制参数: 坎帕兰,姿势,X,Y 输出控制参数: 行、列 * given the X, Y coordinates on

我有一个XLD轮廓,我需要从世界平面转换到图像平面。。但我只能找到
affine\u trans\u contour\u xld
,它接受2D垫,而不是3D垫。。如何将xld轮廓从世界平面变换到图像平面

基本上我需要的是轮廓到世界平面的倒数


编辑:我认为解决方案是找到XY平面的2D Mat,但也找不到如何做到这一点。

我写了一个我以前使用过的代码

程序名称:世界平面坐标到图像点

输入控制参数: 坎帕兰,姿势,X,Y

输出控制参数: 行、列

* given the X, Y coordinates on the world plane,
* the procedure returns the relative points on the image (original or unwarped)

* create arrays with z coordinates all equal to 0
tuple_length (X, NumPoints)
tuple_gen_const (NumPoints, 0, Z)    

* Coordinates in the distorted image
pose_to_hom_mat3d(Pose, HomMat3D)
affine_trans_point_3d(HomMat3D, X, Y, Z, Qx, Qy, Qz)
project_3d_point(Qx, Qy, Qz, CamParam, Row, Column)
通过研究文档,您可以更好地阅读解决方案:

有关资料载于:

3.3.5将世界坐标转换为图像坐标

我是这样解决的:

*get the points of a 100 mm square on my XY plane. Since the XLD is in 1px=1mm

affine_trans_point_3d(Mat3D, 0, 0, 0, X, Y, Z)
project_3d_point(X, Y, Z, CamParam, Xp1, Yp1)
affine_trans_point_3d(Mat3D, 0, 0.1, 0, X, Y, Z)
project_3d_point(X, Y, Z, CamParam, Xp2, Yp2)
affine_trans_point_3d(Mat3D, 0.1, 0.1, 0, X, Y, Z)
project_3d_point(X, Y, Z, CamParam, Xp3, Yp3)
affine_trans_point_3d(Mat3D, 0.1, 0, 0, X, Y, Z)
project_3d_point(X, Y, Z, CamParam, Xp4, Yp4)

*0 on my Image corrisponds to 0 on my XY plane. 100 px square equals the 0.1m square above.
*generate the 2D mat by projection

hom_vector_to_proj_hom_mat2d ([0,100,100,0], [0,0,100,100], [1,1,1,1], 
[Xp1,Xp2,Xp3,Xp4], [Yp1,Yp2,Yp3,Yp4], [1,1,1,1], 'dlt', HomMat2D)

*load the first Z plane
select_obj(ListZplanes, CurrentZplaneXLD,i)

*project the Z plane onto the Plane
projective_trans_contour_xld(CurrentZplaneXLD,CurrentZplaneTransXLD,HomMat2D)

你怎么认为?有帮助吗?谢谢你。。。这是我自己已经取得的成就,但不幸的是,它只反映了分数。。我需要投影一个XLD形状。。(请注意:您的主页未加载)您可以使用:gen_polygons_xld将xld转换为多边形每个多边形都是一个坐标数组。您可以使用:get_polygon_xld提取点,然后您可以在我的答案中使用该过程。您可以使用:gen\u contour\u polygon\u xld重建轮廓