I'm trying to implement the "Compute cloud/cloud distance" in a Qt project. I have been able to run the ccViewer in Qt. and, also, I'm capable of visualize clouds dropped on the viewer window or from a file read in the code.
My main problem is that, when I compute the distances, I get a mean distance and deviaton of zero. I also have to resize the clouds in order to avoid errors. It's like the ccPointCloud doesn't have any points even though the reading function returns CC_FERR_NO_ERROR and the cloud it's correctly displayed.
I leave here the function I have made to read the .asc files and get the information in a ccHObject.
Code: Select all
CC_FILE_ERROR readASCPointCloud(QString path, ccHObject &container, ccViewer* widget)
{
AsciiFilter *mFilter= new AsciiFilter;
CCVector3d loadCoordinatesShift(0,0,0);
bool loadCoordinatesTransEnabled = true;
FileIOFilter::LoadParameters mParam;
{
mParam.alwaysDisplayLoadDialog = false;//true to see the window
mParam.shiftHandlingMode = ccGlobalShiftManager::DIALOG_IF_NECESSARY;
mParam.coordinatesShift = &loadCoordinatesShift;
mParam.coordinatesShiftEnabled = &loadCoordinatesTransEnabled;
mParam.parentWidget = widget;
}
return mFilter->loadFile(path,container, mParam);
}
Code: Select all
...
ccViewer w;
...
//Reading the Ascii files
ccHObject* comp_example=ccHObject::New(CC_TYPES::POINT_CLOUD);
CC_FILE_ERROR read_comp;
read_comp=readASCPointCloud(path1, *comp_example, &w);
ccHObject* src_example=ccHObject::New(CC_TYPES::POINT_CLOUD);
CC_FILE_ERROR read_ref;
read_ref=readASCPointCloud(path2, *src_example, &w);
//Casting
ccPointCloud* compCloud = ccHObjectCaster::ToPointCloud(comp_example);
ccPointCloud* srcCloud = ccHObjectCaster::ToPointCloud(src_example);
//Display in viewer
w.addToDB(srcCloud);
w.addToDB(compCloud);
//Avoiding error -1
compCloud->resize(80589);
srcCloud->resize(80589);
//Computing distances
w.ComputePointCloudDistances(compCloud, srcCloud);
w.addToDB(compCloud);
Does anyone know what I'm doing wrong? Any kind of help will be useful.
Thanks in advance!
Álvaro