如何使用 OpenCV 绘制 3D 坐标轴进行面部姿态估计? [英] How to draw 3D Coordinate Axes with OpenCV for face pose estimation?

查看:51
本文介绍了如何使用 OpenCV 绘制 3D 坐标轴进行面部姿态估计?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有面欧拉角(俯仰、偏航、滚动).如何绘制显示人脸姿势的3D坐标轴?

这是一个来自 函数.它需要 3D 点、相机参数并生成 2D 图像点.获得图像点后,您可以简单地使用 line函数在投影中心点(3D 中的 [0,0,0])和轴点的每个结果投影之间绘制线.

Suppose I have got the face euler angles (pitch, yaw, roll). How can draw the 3D Coordinate Axes which show the face pose?

Here is an example from here:

解决方案

This can be done in pure OpenCV as long as you have your camera parameters. You should be able to create three vectors corresponding to axis x, y, z (basically points [0,0,0] [1, 0, 0], [0, 1, 0], [0, 0, 1] which you will later project into the image plane. You should first rotate those points according to your yaw/pitch/roll (e.g. by multiplying them by a rotation matrix).

In order to project 3D points to the image plane, use the projectPoints function. It takes 3D points, camera parameters and generates 2D image points. Once you have the image points, you can simply use the line function to draw lines between the projected central point ([0,0,0] in 3D) and each of the resulting projections of the axis points.

这篇关于如何使用 OpenCV 绘制 3D 坐标轴进行面部姿态估计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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