我正在尝试使用立体相机获取 3D 坐标。
第二种方法是在opencv中使用reprojectImageTo3D。
但是我不知道这种方法的原理。
结果不是以毫米为单位,因此很难匹配大小。
请告诉我这两种方法的区别。
(其中第一个代码是匹配后将Point Feature转换为3D坐标。)(第二个代码是使用SGBM计算整个立体图像的视差,使用reprojectImageTo3D计算点特征的3d坐标。)
*第一种方法
cv::Mat depth(m_input.m_leftImg.size(), CV_32FC3, cv::Scalar::all(0));
int size = feOutput.m_leftKp.size();
for (int i = 0; i < size; i++)
{
cv::Point pt = cv::Point((int)(feOutput.m_leftKp.at(i).pt.x + 0.5f), (int)(feOutput.m_leftKp.at(i).pt.y + 0.5f));
depth.at<cv::Vec3f>(pt)[2] = fX * baseLine / (feOutput.m_leftKp.at(i).pt.x - feOutput.m_rightKp.at(i).pt.x); // Z
depth.at<cv::Vec3f>(pt)[0] = (feOutput.m_leftKp.at(i).pt.x - cX) * depth.at<cv::Vec3f>(pt)[2] / fX; // X
depth.at<cv::Vec3f>(pt)[1] = (feOutput.m_leftKp.at(i).pt.y - cY) * depth.at<cv::Vec3f>(pt)[2] / fY; // Y
}
depth /= 1000.f; //milli-meter to meter
Run Code Online (Sandbox Code Playgroud)
*第二种方法
cv::Mat …Run Code Online (Sandbox Code Playgroud) 三角形库可以在 VS2015 x64 上运行吗?
我正在 Linux 上工作,并致力于将 VS2015 x64 转换为 Windows,但由于 poolalloc 函数中的内存问题,我收到错误。
但我不明白问题是什么。
void OptimizeMatches(MatrixXf& feat, MatrixXf& feat_ref, MatrixXi& match_idx, MatrixXf& match_dist, std::vector<Matrix3f>& trans_mat, std::vector<Matrix3f>& inv_mat, std::vector<Matrix3f>& trans_mat_ref, std::vector<Matrix3f>& inv_mat_ref,
MatrixXf* belief_ptr, MatrixXi* label_ptr, std::vector<match_list>* match_ptr, std::vector<triangle_segment>* triangle_ptr ) {
int num_nodes = (int)feat.cols();
int num_matches = (int)match_idx.rows();
// build graph using delaunay triangulation
std::vector<support_pt> p_support;
p_support.resize(num_nodes);
for(int i = 0; i < num_nodes; i++){
p_support[i].x = feat(0,i);
p_support[i].y = feat(1,i);
}
std::vector<triangle_segment>& T = *triangle_ptr;
computeDelaunayTriangulation(p_support, &T);
............ …Run Code Online (Sandbox Code Playgroud)