mutex - Fast triangulation in PCL -


I want to make point cloud triangle after applying passstra filter to them. It's compiled but the viewer does not show anything.

Here is my source code:

  #include & lt; Boost / thread / thread.hpp & gt; # Include & lt; Boost / date_time / posix_time / posix_time.hpp & gt; # Include & lt; Pcl / point_cloud.h & gt; # Include & lt; Pcl / point_types.h & gt; # Include & lt; Pcl / io / openni_grabber.h & gt; # Include & lt; Pcl / io / pcd_io.h & gt; # Include & lt; Pcl / io / openni_camera / openni_driver.h & gt; # Include & lt; Pcl / surface / organized_fast_mesh.h & gt; # Include & lt; Pcl / console / parse.h & gt; # Include & lt; Pcl / general / time.h & gt; # Include & lt; Pcl / console / time.h & gt; # Include & lt; PCL / Visualization / Cloud_view H & gt; # Include & lt; Pcl / filter / passthrough.h & gt; Using Namespace PCL; Namespace PCL :: Using Visualization; using namespace std; #define FPS_CALC (_WHAT_) \ do \ {\ static unsigned number = 0; \ Fixed Double End = PCL :: Friendly (); \ If (++ count == 100) \ {\ double now = pcl :: getTime); \ Std :: cout & lt; & Lt; "Average framerate (" <"; & lt; _WHAT_ & lt; & lt;"): "& lt; & Lt; Double (count) / double (now - last) & lt; & Lt; "Hertz" & lt; & Lt; Std :: endl; \ Count = 0; \ Last = now; \} \} While (false) template & lt; Typename pointType & gt; Class OpenNIFastMesh {Public: Typed PEL :: Point Cloud & Lieutenant; Pleetype & gt; cloud; Typipepet typemanem Cloud :: PTR CloudPrint; Type-FIP Typemen: Cloud :: Constant Cloud Cust PTR; OpenNifastMesh (const std :: string and device_id = ""): device_id_ (device_id), collectors_ () {ofm.setTrianglePixelSize (3); Ofm.setTriangulationType (PCL :: Organized Fast Mesh & lt; PleiType>: QUAD_MESH); Pass_.setFilterFieldName ("Z"); Pass_.setFilterLimits (0.0, 1.0); } Zero cloud_cb (const CloudConstPtr & Cloud) {FPS_CALC ("calculation"); Boost :: mutex :: scoped_lock lock (mtx_); Cloudy_ = cloud; } Zero run (int argc, char ** argv) {pcl :: Grabber * interface = new pcl :: OpenNigrabber (device_id_); Promotion :: Function & lt; Void (const CloudConstPtr & amp;) & gt; F = boost :: bind (& OpenNIFastMesh :: cloud_cb, this, _1); Boost :: signals2 :: connection c = interface- & gt; Register Callback (F); View.reset (New PLC :: Visualization :: PCLVilizer (RGR, AGRV, "PCL OpenNi Mesh Viewer")); Interface-> Start (); CloudConstPtr temp_cloud; Std :: vector & lt; :: share_ptr's & lt boost PCL :: Corner & gt; & Gt; Temp_verts; PCL :: Console :: TicketT T1; While (! View-> Closed ()) {if (! Cloud_ ||! Mtx_.try_lock ()) {boost :: this_thread :: sleep (boost :: posix_time :: milliseconds (1)); to continue; } // CloudPtr temp; //temp.reset (new cloud); //pass_.setInputCloud(cloud_); //pass_.filter(*temp); Ofm.setInputCloud (cloud_); Std :: vector & lt; :: share_ptr's & lt boost PCL :: Corner & gt; & Gt; Temp_verts (new std :: vector & lt; pcl :: vertex & gt;); Ofm.reconstruct (* temp_verts); // vertices_ = temp_verts; Mtx_.unlock (); If (! See-> Update polygon mesh & lt; PleiType & gt; (cloud_, * vertical_, "surface")) {view-> Plus polygonal mesh & lt; Pleetype & gt; (Cloud_, * meridian, "surface"); } FPS_CALC ("Visualization"); See- & gt; SpinOn (1); } Interface-> Stop (); } PCL :: Organized Fistash & gt; Pleetype & gt; OFM; PCL :: Paushrough's & lt; PointType & gt; pass_; Std :: string device_id_; Boost :: mutex mtx_; CloudConstPtr cloud_; Std :: vector & lt; :: share_ptr's & lt boost PCL :: Corner & gt; & Gt; Vertices_; PCL :: Polygon Mesh :: PTR Mesh_; Promote: shared_ptr & lt; PCL :: View :: PCLVisualizer & gt; opinion; }; Int main (int argc, char ** argv) {OpenNifastMesh & lt; Pcl :: pointXYZ & gt; V (""); V.run (argc, argv); Return (0); }   

I think the probe comes from mutex.

You have inserted the code "Run" in the Look function

  Ofm.setInputCloud (cloud_); Std :: vector & lt; :: share_ptr's & lt boost PCL :: Corner & gt; & Gt; Temp_verts (new TD :: vector & lt; pcl :: vertex & gt;); Ofm.reconstruct (* temp_verts);   

In the wrong place.

They should be in the call back function "cloud_cb_", not in "run". When a new pointcloud is available, it should be excited.

For more information, look at the source folder of PCL, which is in app / src / openni_fast_mash.cpp.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -