Bootstrap

openCV与eigen两种方法---旋转向量转旋转矩阵

请添加图片描述`

#include <Eigen/Dense>
#include <opencv2/core/eigen.hpp>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
	// opencv 旋转向量
	cv::Vec3d rvec(1.0, 2.0, 3.0);

	cv::Mat rotation_matrix;
	cv::Rodrigues(rvec, rotation_matrix);

	cout << "  opencv方法" << endl;
	cout << "   " << rotation_matrix << endl;

	cout << "  -------------------     " <<  endl;
	cout << "  eigen方法    旋转矩阵 " << endl;
	// eigen 旋转矩阵
	Eigen::Matrix3f eigen_rotation;
	cv::cv2eigen(rotation_matrix, eigen_rotation);
	cout << "   " << eigen_rotation << endl;

	return 0;


}



;