gpt4 book ai didi

opencv - ICP::registerModelToScene() 无法运行最小示例

转载 作者:行者123 更新时间:2023-12-02 16:37:15 29 4
gpt4 key购买 nike

这是调用 registerModelToScene() 的最小示例, 包含在类 cv::ppf_match_3d::ICP 中OpenCV贡献模块表面匹配的:

#include <opencv2/surface_matching/icp.hpp>
#include <opencv2/surface_matching/ppf_helpers.hpp>

int main() {
/* allocate solver */
cv::ppf_match_3d::ICP iterativeClosestPoint;

/* reference vertices */
cv::Mat reference = cv::ppf_match_3d::loadPLYSimple("reference.ply", 1);
/* measured vertices */
cv::Mat measurement = cv::ppf_match_3d::loadPLYSimple("measurement.ply", 1);

/* do the magic */
double error;
cv::Matx44d transformation;
iterativeClosestPoint.registerModelToScene(reference, measurement, error, transformation);

return 0;
}
要匹配的顶点 ( reference.ply) 以多边形文件格式给出,并且仅用法线表示两个点:
ply
format ascii 1.0
element vertex 2
property float x
property float y
property float z
property float nx
property float ny
property float nz
end_header
0 0 0 0 0 1
0 1 0 0 0 1
需要匹配的顶点以相同的文件格式给出,相同的两个点,绕z轴旋转20°:
ply
format ascii 1.0
element vertex 2
property float x
property float y
property float z
property float nx
property float ny
property float nz
end_header
0 0 0 0 0 1
0.3429 0.93937 0 0 0 1
代码在 GCC 8.2.0、OpenCV 版本 4.0.0 上编译。
运行时错误:
OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.0.0) Error: Assertion failed (dataset.type() == CvType<ElementType>::type()) in GenericIndex, file C:/Users/maxherrman/openCV/4.0.0/modules/flann/include/opencv2/flann.hpp, line 316
在 answers.opencv.org 上有一个 post说明 registerModelToScene() 的前两个参数的元素数据类型( Mat )需要匹配第四个( Matx44d )中的那些。
但是 documenation说:

Currently, CV_32F is the only supported data type.


因此模型和场景元素的数据类型( CV_32F)与姿势中元素的数据类型( double)不匹配。
知道如何规避这个问题,还是我弄错了?

最佳答案

即使错误没有说明,您也没有足够的算法数据

关于opencv - ICP::registerModelToScene() 无法运行最小示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55532416/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com