Article From:https://www.cnblogs.com/z-web-2017/p/9688564.html

       Now that the blog is finally starting to update, leaving the days of imaginative scientific research behind, I’m still more at ease. During the tormented and tormented period of two years before my academic career, I wasn’t able to express my inner thoughts in that environment (most people don’t think so).Yes), the examples around me make me more convinced, to be an unknown lamb, and I am glad that this experience did not accompany my learning and life all the time, after the teacher’s return to school all this is premature, in the next few days I still realized what is scientific research, so it is not a waste of time.The only thing I’m sorry about is that it’s a little late. At the same time, I especially hope that my experience is just an accident (I’d better think more, everyone else is fine!) Remembering the past, feeling the importance of personal choice and self-motivation, has been a constant obstacle in dealing with the former.My self-driven spirit strives to maintain a high degree of recognition of technical knowledge. Last week, I operated on the power line patrol software of a company in Beijing. Then I did a simple rehearsal of the software implementation process on my own platform. After all, it is a rehearsal, and my platform will not sell money.No one will buy, so do a rough end, just put some of their previous things directly in the power line to use it;

         Then let the dust-laden four-month-old cloud com pare source reopen, Baidu search has been how to develop, browsing the entire page seems to have little value, but has been accustomed to, after all, I am Baidu search is not Google, every day a variety of technical exchanges group, has been waiting for the skyIf you drop your pie, you won’t lose it at last. So still have to be honest directly on the source code, an afternoon plus a night, through several examples of debugging, it seems to find the legendary “gourd”, so then draw ladles, once really successful! Once the door of success is opened, I will turn on the P of my point cloud.CL library packed in, and then you can swim, before opening a blog, but for the one who can only hold the tail as a person, I did not have any effect, so I soon forgot, these days ready to reopen the blog, these do not have any core competitiveness of knowledge to share with you, after allIt can provide a little help for beginners to enter the gate of CC development.

                                                                                                                                                    (a)Software startup interface

             

       This is the scene that the young partners of the lab happily discussed the scientific research together. Every time I start the software, it will stimulate my life-long passion for scientific research. I don’t know if they are doing scientific research. After all, I was not in front of the computer at that time, right, otherwise I began to doubt life again.

                                                                                                                                                      (b)Chinese version CloudCompare

     

       Every time I look for a function, I have to silently open the Baidu translation, has wasted a lot of time, so, in a sleepless night pain resolved to change it into a Chinese version, and to illustrate that I really do CC source code made some minor changes, because usually like black and gray tone, soBoldly changed the style of the platform.

                                                                                                                                                  (c) Extraction of Ground Points from Case Analysis

     

            Finally, paste a piece of core code to everyone, in fact, there is nothing complicated, I am not a computer professional, the real time to learn C + + is less than half a year, can follow the gourd painting ladle, the gods will no longer speak, I believe that you will soon enter the state of intelligence!

//Get the point cloud object of CC
    ccHObject::Container selectedEntities = m_selectedEntities; // The currently selected point cloud objects//To access files in point cloud -- a test code that you added.
    size_t selNum = selectedEntities.size();
    if (selNum != 1)
    {
        /*    m_app->dispToConsole("Please select two cloud!", ccMainAppInterface::ERR_CONSOLE_MESSAGE);*/
        return;
    }
    ccHObject* ent = selectedEntities[0];
    assert(ent);
    ccPointCloud* m_cloud = static_cast<ccPointCloud*>(ent);
    pcl::PointCloud<pcl::PointXYZ>::Ptr clouds(new pcl::PointCloud<pcl::PointXYZ>);
    CCcloudToPCLcloud(m_cloud,clouds);


    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_ground(new pcl::PointCloud<pcl::PointXYZ>);
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_ground_remove(new pcl::PointCloud<pcl::PointXYZ>);
    pcl::PointIndicesPtr ground(new pcl::PointIndices);

    // Creating morphological filter objects
    pcl::ProgressiveMorphologicalFilter<pcl::PointXYZ> pmf;
    pmf.setInputCloud(clouds);

    // Set the maximum window size for filter points.
    pmf.setMaxWindowSize(10);

    // Set the slope value that calculates the height threshold - that is the slope.
    pmf.setSlope(1.0f);

    // Setting the initial height parameter is considered the ground point.
    pmf.setInitialDistance(0.5f);

    // Set the maximum height considered to be the ground point.
    pmf.setMaxDistance(3.0f);
    pmf.extract(ground->indices);

    // Create the filtering object
    pcl::ExtractIndices<pcl::PointXYZ> extract;
    extract.setInputCloud(clouds);
    extract.setIndices(ground);
    extract.filter(*cloud_ground);

    // Extraction of non ground surface
    extract.setNegative(true);
    extract.filter(*cloud_ground_remove);


    //-------Then update them to dbtree.//1。You need to convert cloud from PCL to CC.
    ccPointCloud *cloudGround = new ccPointCloud();
    ccPointCloud *cloudNoGround = new ccPointCloud();

    PCLcloudToCCcloud(cloud_ground, cloudGround);
    PCLcloudToCCcloud(cloud_ground_remove, cloudNoGround);

    //Set colors to differentiate.
    cloudGround->setRGBColor(255,0,0);
    cloudGround->showColors(true);//Display color
    cloudGround->setPointSize(2);

    cloudNoGround->setRGBColor(0, 255, 0);
    cloudNoGround->showColors(true);
    cloudNoGround->setPointSize(3);



    m_cloud->setEnabled(false);
    
    //Add a new set of DB entities
    ccHObject* cloudContainer = new ccHObject(m_cloud->getName() + QString::fromLocal8Bit("Split scene - ground point"));//Parent directory//Set up new point cloud and add it to entity.
    cloudGround->setVisible(true);
    cloudGround->setName(QString::fromLocal8Bit("zxThe ground point!"));//Subdirectory
    cloudContainer->addChild(cloudGround);
    //Add entities to DB tree
    addToDB(cloudContainer);

    //Add a new set of DB entities
    ccHObject* cloudContainer1 = new ccHObject(m_cloud->getName() + QString::fromLocal8Bit("Split scene - non ground point"));//Parent directory//Set up new point cloud and add it to entity.
    cloudNoGround->setVisible(true);
    cloudNoGround->setName(QString::fromLocal8Bit("zxThe non ground point!"));//Subdirectory
    cloudContainer1->addChild(cloudNoGround);
    //Add entities to DB tree
    addToDB(cloudContainer1);

    //Refresh
    refreshAll();

    QMessageBox::about(this, QString::fromLocal8Bit("Success"), QString::fromLocal8Bit("This is the development of Momou."));
    return;

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *