I want to subsample a cloud in my plugin.
When I execute these codes, it is ok:
Code: Select all
......
ccHObject *loadedObj = m_app->getSelectedEntities()[0]; // I opened a cloud "airplane_0001.txt" in CloudCompare
ccPointCloud* pc = static_cast<ccPointCloud*>(loadedObj);
ReferenceCloud* SubsampledEnt = CloudSamplingTools::subsampleCloudRandomly(pc, (unsigned int)1024); // OK
......
Code: Select all
......
//Load Parameters:
QString txtfile = "D:/HJ/test/airplane_0001.txt"; //file_path
FileIOFilter::LoadParameters loadp;
loadp.alwaysDisplayLoadDialog = false;
loadp.shiftHandlingMode = ccGlobalShiftManager::NO_DIALOG_AUTO_SHIFT;
loadp.autoComputeNormals = false;
loadp.parentWidget = m_app->getMainWindow();
loadp.sessionStart = true;
CC_FILE_ERROR res;
ccHObject *loadedObj = FileIOFilter::LoadFromFile(txtfile, loadp, res, AsciiFilter::GetFileFilter());
ccPointCloud* pc = static_cast<ccPointCloud*>(loadedObj);
ReferenceCloud* SubsampledEnt = CloudSamplingTools::subsampleCloudRandomly(pc, (unsigned int)1024); //always crush here
......
This phenomenon means that the objects loaded by CloudCompare and by manual are different.