for (int camera_index = 0; camera_index < this->m_safe_camera_list.size(); ++camera_index) { camera* cam = &(this->m_safe_camera_list[camera_index]); if (cam->m_is_exter_calib_check_mark == true) { // as a Internal reference K of the camera, the K-1 is : // 1/ax 0 -px/ax // 0 1/ay -py/ay // 0 0 1 Eigen::Matrix3f invk; invk.setIdentity(); invk(0, 0) = 1.0 / cam->m_inter_calib(0, 0); invk(0, 2) = -1.0 * cam->m_inter_calib(0, 2) / cam->m_inter_calib(0, 0); invk(1, 1) = 1.0 / cam->m_inter_calib(1, 1); invk(1, 2) = -1.0 * cam->m_inter_calib(1, 2) / cam->m_inter_calib(1, 1); Eigen::Vector3f tmp_t_verts = cam->m_exter_calib.topRightCorner(3, 1); Eigen::Matrix3f tmp_inv_r_mat= cam->m_exter_calib.topLeftCorner(3, 3).transpose(); Eigen::Vector3f tmp_root_point = -tmp_inv_r_mat * tmp_t_verts; for (int pose_index = 0; pose_index < cam->m_2D_pose_list.size(); ++pose_index) { Eigen::MatrixXf pose = cam->m_2D_pose_list[pose_index]; // check the pose's Confidence, if all the joints's confidiance is smaller than the gain, drop out float confidence = pose.row(2).maxCoeff(); if (confidence < this->m_joint_confidence_gian) { continue; }; my_radials tmpradials; tmpradials.m_2d_pose = pose; tmpradials.m_root_point = tmp_root_point; tmpradials.m_radials_points = (invk * pose.topRows(2).colwise().homogeneous()).colwise().normalized(); tmpradials.m_radials_points = tmp_inv_r_mat * tmpradials.m_radials_points; tmpradials.m_3d_pose_ID = -1; tmpradials.m_camera_index = camera_index; tmpradials.m_poes_index = pose_index; tmpradials.m_pose_confidence = pose.row(2).leftCols(7).sum(); this->m_3d_radials.push_back(tmpradials); } } }
时间: 2024-03-28 22:39:06 浏览: 149
这段代码是一个 for 循环,遍历了一个名为 m_safe_camera_list 的相机列表。对于列表中的每个相机,如果其 m_is_exter_calib_check_mark 属性为 true,则进行以下操作:
1. 计算相机的内参矩阵 K 的逆矩阵 invk,其中 K 的值被存储在相机的 m_inter_calib 属性中;
2. 计算相机的外参矩阵 m_exter_calib 的逆矩阵的转置矩阵 tmp_inv_r_mat;
3. 根据 tmp_inv_r_mat 和 m_exter_calib 中的平移向量计算相机在世界坐标系下的位置 tmp_root_point;
4. 遍历相机 m_2D_pose_list 中的姿态,对于每个姿态:
- 检查该姿态的置信度是否大于设定的阈值 m_joint_confidence_gian,如果不是则跳过;
- 构建一个名为 tmpradials 的结构体,存储该姿态的相关信息,包括姿态的 2D 坐标、3D 坐标、相机索引、姿态索引等;
- 将 tmpradials 添加到名为 m_3d_radials 的结构体列表中。
整个代码的作用是将相机的 2D 姿态转换为 3D 姿态,并将结果存储在 m_3d_radials 中。
阅读全文