Code Monkey home page Code Monkey logo

Comments (7)

niosus avatar niosus commented on May 17, 2024

Ok, this might sound a but counter-intuitive, but for the sake of speed I never updated the points in the cloud after removing the ground from the range image. So the cloud is still the same, but every cloud has a range image attached to it, so the image attached to it is not without ground. After your changes this image will contain ground only, but the cloud does not change.

I set the image here:

cloud_copy.projection_ptr()->depth_image() = no_ground_image;

from depth_clustering.

tuandle avatar tuandle commented on May 17, 2024

@niosus Thanks for your clarification.
I see that everything is based on the range image for fast computation. What I understand so far for removing ground is as follows:

  1. You remove the ground based on the range image in depth_ground_remover. The processed range image (should contain non-zero values for non-ground points and zero values for ground point) is sent to image_based_clusterer
  2. image_based_clusterer first labels the received range image. It will only label non-ground points (depth pixels with non-zero value). Then it creates a container to store labels and their corresponding points and after that, send the container to the next client.

My approach is like this:

  1. I remove all the non-ground points (switch == to !=). The processed range image contains only the ground (with non-zero values; non-ground points are marked as zero) and is sent to the next step.
  2. I skip the labeling procedure and create a container which stores only 1 label and all the ground points from the received range image.
    I create the container like this:
void OnNewObjectReceived(const Cloud& cloud, const int sender_id) override {
    // generate a projection from a point cloud
    if (!cloud.projection_ptr()) {
      fprintf(stderr, "ERROR: projection not initialized in cloud.\n");
      fprintf(stderr, "INFO: cannot label this cloud.\n");
      return;
    }
    time_utils::Timer timer;
    // create 3d clusters from image labels
    std::unordered_map<uint16_t, Cloud> clusters;
    // assign an arbitrary ground label
    uint16_t label = 2;
    // this depth image should contain only ground points
    const cv::Mat& img_ground = cloud.projection_ptr()->depth_image();
    for (int row = 0; row < img_ground.rows; ++row) {
      for (int col = 0; col < img_ground.cols; ++col) {
        const auto& point_container = cloud.projection_ptr()->at(row, col);
        if (point_container.IsEmpty()) {
          // this is ok, just continue, nothing interesting here, no points.
          continue;
        }
        if (img_ground.at<float>(row, col) == 0) {
          // skip non-ground points
          continue;
        }
        for (const auto& point_idx : point_container.points()) {
          const auto& point = cloud.points()[point_idx];
          clusters[label].push_back(point);
        }
      }
    }

    fprintf(stderr, "INFO: prepared ground clusters in: %lu us\n",
            timer.measure());

    this->ShareDataWithAllClients(clusters);
    fprintf(stderr, "INFO: ground clusters shared: %lu us\n", timer.measure());
  }

I am not sure what I miss here so that the processed pointcloud is exactly as the original?

from depth_clustering.

tuandle avatar tuandle commented on May 17, 2024

@niosus any advice, please :)

from depth_clustering.

niosus avatar niosus commented on May 17, 2024

@tuandle I'm sorry, I am currently really in a complete lack of time to debug your problem. The idea that you have is valid and should theoretically work, but I cannot look for an error in your code right now. I will keep it here and if I find the time I will look into this, but I cannot promise when this might happen. Sorry for that.

from depth_clustering.

tuandle avatar tuandle commented on May 17, 2024

@niosus no problem, thank you for your help anyway :)

from depth_clustering.

lonlonago avatar lonlonago commented on May 17, 2024

@niosus the _para._step is 870, does that means for speed up, you do not use all the points into process?

from depth_clustering.

seboz123 avatar seboz123 commented on May 17, 2024

@tuandle Hi I would like to recreate the same thing:
Just printing publishing/ printing the removed ground of the point cloud to evaluate it against other algorithms.
Have you found a solution/implementation yet?

from depth_clustering.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.