Halcon - affine_trans_contour_xld 的 3D 等价物 [英] Halcon - 3D equivalent of affine_trans_contour_xld

查看:50
本文介绍了Halcon - affine_trans_contour_xld 的 3D 等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 XLD 轮廓,我需要将它从世界平面转换为图像平面..但我只能找到 affine_trans_contour_xld,它接受 2D Mat,而不是 3D mat..怎么能我将 xld Contour 从世界平面转换到图像平面?

I have a XLD contour that i need to convert from world plane to image plane.. but I can only find affine_trans_contour_xld, that accepts a 2D Mat, and not a 3D mat.. how can I transform the xld Contour from the world plane to the image plane?

基本上我需要的是 contour_to_world_plane_xld

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

I THINK that the solution would be to find the 2D Mat of the XY plane, but couldnt find how to do that either..

推荐答案

我是这样解决的:

*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)

这篇关于Halcon - affine_trans_contour_xld 的 3D 等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆