【发布时间】:2021-05-07 19:06:44
【问题描述】:
我是 CV 领域的新手,我试图在三张图片之间对点进行三角剖分,但一开始,我想在两张图片之间进行三角剖分。 为此,我做了以下步骤:
- 使用 AKAZE 进行特征检测
- NORM_HAMMING 的特征匹配
- 过滤匹配项
- 将过滤后的描述符与关键点坐标匹配
之后,对于每个相同大小的图像,我都有一个关键点向量。 知道我想将此向量转换为“cv::Mat”,以便我可以使用 TriangulatPoints 函数:
std::vector<cv::KeyPoint>::iterator it_1;
std::vector<cv::Point2f> points_1;
for(it_1 = keypoints_matched_1.begin() ; it_1!=keypoints_matched_1.end() ; it_1++)
{
points_1.push_back(it_1->pt);
}
cv::Mat pointmatrix1(points_1);
std::vector<cv::KeyPoint>::iterator it_2;
std::vector<cv::Point2f> points_2;
for(it_2 = keypoints_matched_2.begin() ; it_2!=keypoints_matched_2.end() ; it_2++)
{
points_2.push_back(it_2->pt);
}
cv::Mat pointmatrix2(points_2);
std::vector<cv::Mat> points3D;
std::vector<cv::Mat> points_all={pointmatrix1, pointmatrix2};
cv::sfm::triangulatePoints(points_all,Proj_matrices,points3D);
我一直遇到这个错误:
错误:(-215:Assertion failed) points2d_tmp[i].rows == 2 && points2d_tmp[i].cols == n_points in function 'triangulatePoints'
【问题讨论】: