Python 2.7 如何获得Aruco标记的差异';世界坐标系中的轴天使?
我是opencv和Aruco的新手。我试图找出两个不同的阿鲁科标记轴角度的差异。例如,角度差b/w表示现实世界中标记的两个(1,0,0)向量。根据我的理解,变换按以下顺序进行:局部坐标->摄影机坐标->世界坐标。然后我得到两个阿鲁科标记的角度差,因为它们现在都在同一个世界坐标中。有人能解释一下这个过程是如何完成的吗?或者有没有更好的方法来找出角度差?我正在使用python和opencv进行编码 已知:Python 2.7 如何获得Aruco标记的差异';世界坐标系中的轴天使?,python-2.7,opencv,coordinate-transformation,aruco,Python 2.7,Opencv,Coordinate Transformation,Aruco,我是opencv和Aruco的新手。我试图找出两个不同的阿鲁科标记轴角度的差异。例如,角度差b/w表示现实世界中标记的两个(1,0,0)向量。根据我的理解,变换按以下顺序进行:局部坐标->摄影机坐标->世界坐标。然后我得到两个阿鲁科标记的角度差,因为它们现在都在同一个世界坐标中。有人能解释一下这个过程是如何完成的吗?或者有没有更好的方法来找出角度差?我正在使用python和opencv进行编码 已知: aruco模块中estimatePoseSingleMarkers()函数的平移和旋转向量(1
void drawAxis(InputOutArray\u图像、InputArray\u摄像机矩阵、InputArray\u distcoefs、,
输入阵列_rvec,输入阵列_tvec,浮点长度){
CV_断言(_image.getMat().total()!=0&&
(_image.getMat().channels()==1 | | u image.getMat().channels()==3));
CV_断言(长度>0);
//投影轴点
向量轴点;
向后推(点3f(0,0,0));
向后推(点3f(长度,0,0));
向后推(点3f(0,长度,0));
向后推(点3f(0,0,长度));
向量图像点;
项目点(axisPoints、rvec、tvec、cameraMatrix、Discoefs、imagePoints);
//画轴线
线(_图像,图像点[0],图像点[1],标量(0,0255),3);
线(_图像,图像点[0],图像点[2],标量(0,255,0),3);
线(_图像,图像点[0],图像点[3],标量(255,0,0),3);
}从技术上讲,这是解决我问题的一个办法。所以我认为ARUCO库有一个名为projectPoints的函数,它将3D对象点映射为2D图像点 imagePoints[0]和imagePoints[1]提供了(长度,0,0)的二维投影。通过使用arccos(np.dot(v1,v2)),可以得到两个标记的x轴角度的差异
void drawAxis(InputOutputArray _image, InputArray _cameraMatrix, InputArray _distCoeffs,
InputArray _rvec, InputArray _tvec, float length) {
CV_Assert(_image.getMat().total() != 0 &&
(_image.getMat().channels() == 1 || _image.getMat().channels() == 3));
CV_Assert(length > 0);
// project axis points
vector< Point3f > axisPoints;
axisPoints.push_back(Point3f(0, 0, 0));
axisPoints.push_back(Point3f(length, 0, 0));
axisPoints.push_back(Point3f(0, length, 0));
axisPoints.push_back(Point3f(0, 0, length));
vector< Point2f > imagePoints;
projectPoints(axisPoints, _rvec, _tvec, _cameraMatrix, _distCoeffs, imagePoints);
// draw axis lines
line(_image, imagePoints[0], imagePoints[1], Scalar(0, 0, 255), 3);
line(_image, imagePoints[0], imagePoints[2], Scalar(0, 255, 0), 3);
line(_image, imagePoints[0], imagePoints[3], Scalar(255, 0, 0), 3);