error in ICP
Hello,
i want to use the icp algorothm. But there is a error. Can someone tell me what should i do. Thank you!
#include <opencv2/core.hpp>
#include <iostream>
#include <cv.h>
#include <vector>
#include "opencv2/surface_matching/icp.hpp"
#include "opencv2/surface_matching/pose_3d.hpp"
#include <stdio.h>
#include <stdlib.h>
#include "flann.hpp"
using namespace cv;
using namespace ppf_match_3d;
using namespace std;
int main()
{
try {
float m2[4][6] = { { 1, 1, 0, 1, 1, 1 },{ 2 , 2 , 0, 1 , 1, 1 },{ 2, 1, 0 , 1 , 1 , 1 },{ 1 , 2 , 0 , 1, 1, 1 } };
float m1[4][6] = { { 1, 1, 0, 1, 1, 1 },{ 2 , 2 , 0, 1 , 1, 1 },{ 2, 1, 0 , 1 , 1 , 1 },{ 1 , 2 , 0 , 1, 1, 1 } };
Mat M1 = cv::Mat(4, 6, CV_32F, m1);
Mat M2 = cv::Mat(4, 6, CV_32F, m2);
double re;
Matx44d pose1;
vector<Pose3DPtr> resultsSub;
cv::ppf_match_3d::ICP calculate(100, 0.005f, 2.5f, 8);
calculate.registerModelToScene(M1, M2, re, pose1);
}
catch (cv::Exception ex) {
std::cout << ex.msg << std::endl;
std::getchar();
}
return 0;
}
error is:
OpenCV Error: Assertion failed (dataset.type() == CvType<ElementType>::type()) in cv::flann::GenericIndex<struct cvflann::L2<float> >::GenericIndex, file C:\Users\XIAOBME\open\opencv\sources\modules\flann\include\opencv2/flann.hpp, line 253
C:\Users\open\opencv\sources\modules\flann\include\opencv2/flann.hpp:253
: error: (-215) dataset.type() == CvType<ElementType>::type() in function cv::flann::GenericIndex<struct cvflann::L2<float> >::GenericIndex
thanks for your answer, now you can see the text of my error
i guess, if your pose1 Mat is double, you have to use double for M1 and M2, too.