Ask Your Question

Revision history [back]

error in ICP

Hello,

i want to use the icp algorothm. But there is a error. Can someone tell me what should i do.

#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;
}

image description

error in ICP

Hello,

i want to use the icp algorothm. But there is a error. Can someone tell me what should i do.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;
}

image description

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

click to hide/show revision 3
None

updated 2018-01-10 02:20:26 -0600

berak gravatar image

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;
}

image description

error is:

OpenCV Error: Assertion failed (dataset.type() == CvType<elementtype>::type()) CvType<ElementType>::type()) in cv::flann::GenericIndex<struct cvflann::l2<float=""> cvflann::L2<float> >::GenericIndex, file C:\Users\XIAOBME\open\opencv\sources\modules\flann\include\opencv2/flann.hpp, line 253

253 C:\Users\open\opencv\sources\modules\flann\include\opencv2/flann.hpp:253 : error: (-215) dataset.type() == CvType<elementtype>::type() CvType<ElementType>::type() in function cv::flann::GenericIndex<struct cvflann::l2<float=""> >::GenericIndex

cvflann::L2<float> >::GenericIndex