Extracting Iss3d key points based on Cloudcompare development.
1 voidQLXPLUGINPCL::d oiss3d ()2 {3 assert (M_app);4 if(!M_app)5 return;6 7 Constcchobject::container& selectedentities = m_app->getselectedentities ();8size_t Selnum =selectedentities.size ();9 if(selnum!=1)Ten { OneM_app->disptoconsole ("Select only one cloud!", ccmainappinterface::err_console_message); A return; - } - thecchobject* ent = selectedentities[0]; - assert (ENT); - if(!ent | |!ent->IsA (cc_types::P oint_cloud)) - { +M_app->disptoconsole ("Select A real point cloud!", ccmainappinterface::err_console_message); - return; + } A atccpointcloud* M_cc_cloud = static_cast<ccpointcloud*>(ENT); - - - //Input Cloud -unsigned count = m_cc_cloud->size (); - BOOLHasnorms = m_cc_cloud->hasnormals (); in CCVector3 bbmin, Bbmax; -M_cc_cloud->Getboundingbox (Bbmin,bbmax); to Constccvector3d& Globalshift = m_cc_cloud->Getglobalshift (); + DoubleGlobalscale = m_cc_cloud->Getglobalscale (); - the Cciss3ddlg dlg; * if(!dlg.exec ()) $ return;Panax Notoginseng - DoubleS_salientradius=dlg.sbsalientradius->value (); the DoubleS_nonmaxradius =dlg.spnonmaxradius->value (); + DoubleS_threshold21 = dlg.spthreshold21->value (); A DoubleS_THRESHOLD32 = dlg.spthreshold32->value (); the +PCL::P ointcloud<pointxyz>::P tr Pcl_cloud (NewPCL::P ointcloud<pointxyz>); - Try $ { $unsigned pointcount = m_cc_cloud->size (); -Pcl_cloud->Resize (pointcount); - the for(Unsigned i =0; i < Pointcount; ++i) - {Wuyi Constccvector3* P = m_cc_cloud->GetPoint (i); thePcl_cloud->at (i). x = static_cast<float> (p->x); -Pcl_cloud->at (i). y = static_cast<float> (p->y); WuPcl_cloud->at (i). z = static_cast<float> (p->z); - } About } $ Catch(...) - { - //Any error (memory, etc.) - Pcl_cloud.reset (); A } + theprintf"read the data point cloud:%d\n",pcl_cloud->size ()); - $PCL::SEARCH::KDTREE<PCL::P ointxyz>::P tr Tree (NewPCL::SEARCH::KDTREE<PCL::P ointxyz> ()); the thePCL::P OINTCLOUD<PCL::P ointxyz>::P tr Cloud_out (NewPCL::P OINTCLOUD<PCL::P ointxyz>); the thePCL::ISSKEYPOINT3D<PCL::P OINTXYZ,PCL::P ointxyz>Iss_detector; - Iss_detector.setsearchmethod (tree); in Iss_detector.setsalientradius (S_salientradius); the Iss_detector.setnonmaxradius (S_nonmaxradius); the /*Iss_detector.setsalientradius (2.0f); About Iss_detector.setnonmaxradius (1.6f);*/ the Iss_detector.setinputcloud (pcl_cloud); the /*iss_detector.setthreshold21 (0.975); the iss_detector.setthreshold32 (0.975);*/ + iss_detector.setthreshold21 (S_THRESHOLD21); - iss_detector.setthreshold32 (S_THRESHOLD32); theIss_detector.setminneighbors (5);BayiIss_detector.setnumberofthreads (4); thecout<<"parameter Set successful"<<Endl; theIss_detector.compute (*cloud_out); - - intPointcount = cloud_out->size (); the the //static_cast<size_t> (Sm_cloud sm_cloud->width * sm_cloud->height:0); the theccpointcloud* Cccloud =NewCcpointcloud (); - if(!cccloud->reserve (static_cast<unsigned>(Pointcount))) the return ; the for(size_t i =0; i < Pointcount; ++i) the {94CCVector3 P (Cloud_out->at (i). X,cloud_out->at (i) .y,cloud_out->At (i). z); theCccloud->Addpoint (P); the } theCccloud->setname (QString ("Iss3d"));98Cccolor::rgb col =cccolor::generator::random (); AboutCccloud->Setrgbcolor (col); -Cccloud->showcolors (true);101Cccloud->setpointsize (5);102cchobject* Group =0;103 if(!Group)104Group =NewCchobject (QString ("Iss3d"). Arg (ent->getName ())); theGroup->AddChild (cccloud);106Group->setvisible (true);107M_app->Addtodb (group);108}
Interface:
[CC] plugin-extracting Iss3d key points