Why CCLib::ICPRegistrationTools::RegisterClouds Return ERROR

Feel free to ask any question here
Post Reply
bingyu1413
Posts: 19
Joined: Tue Oct 28, 2014 5:53 am

Why CCLib::ICPRegistrationTools::RegisterClouds Return ERROR

Post by bingyu1413 »

Hello!

This is the second time to ask for help.There are my codes below:

CCLib::SimpleCloud model;
CCLib::SimpleCloud part;
model.reserve(model_cop.width()*model_cop.height());
part.reserve(part_cop.width()*part_cop.height());
CCVector3 ccvt3;
for (int i = 0; i < model_cop.height(); i++)
{
for (int j = 0; j < model_cop.width(); j++)
{
ccvt3.x = model_cop[j].x();
ccvt3.y = model_cop[j].y();
ccvt3.z = model_cop[j].z();
model.addPoint(ccvt3);
}
}

for (int i = 0; i < part_cop.height(); i++)
{
for (int j = 0; j < part_cop.width(); j++)
{
ccvt3.x = part_cop[j].x();
ccvt3.y = part_cop[j].y();
ccvt3.z = part_cop[j].z();
part.addPoint(ccvt3);
}
}

double finalerror = 0;
CCLib::ICPRegistrationTools icprt;

int result = icprt.RegisterClouds(&model, &part, totalTrans, CCLib::ICPRegistrationTools::MAX_ERROR_CONVERGENCE, 0.01, 5000, finalerror);

Why the result is always return ICP_ERROR_DIST_COMPUTATION=102 ??? Is there something wrong to use the CCLIB ? Please help me,thanks a lot.
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Why CCLib::ICPRegistrationTools::RegisterClouds Return E

Post by daniel »

Hard to tell! Nothing obvious at least.

There are multiple reasons why the distance computation can fail (a cloud with a null bonding-box, not enough memory, etc.). You should run CC in debug mode and place a breakpoint before the call to DistanceComputationTools::computeHausdorffDistance (RegistrationTools.cpp, line 243). Step inside and try to find what causes the method to return an error.
Daniel, CloudCompare admin
bingyu1413
Posts: 19
Joined: Tue Oct 28, 2014 5:53 am

Re: Why CCLib::ICPRegistrationTools::RegisterClouds Return E

Post by bingyu1413 »

I have debug into CClib,and I find the error caused by no bounding box,maybe I will try something to fix this problem.
Thanks a lot!
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Why CCLib::ICPRegistrationTools::RegisterClouds Return E

Post by daniel »

If the bounding-box is null, then you should check what you actually push in the cloud structure (i.e. either model_cop or part_cop).
Daniel, CloudCompare admin
Post Reply