Quantcast

After using iterative closest point I have a line pattern in my cloud

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

After using iterative closest point I have a line pattern in my cloud

phuser
This post has NOT been accepted by the mailing list yet.
Hello,

I want to align two clouds, but after using iterative closest point (icp.align()) I get a line pattern in my cloud.

This is my code:

...
...
pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
    icp.setInputCloud(sourceCloud);
    icp.setInputTarget(targetCloud);

    pcl::PointCloud<pcl::PointXYZ> finalCloud;
    icp.align(finalCloud);
...
...

Original cloud:


After Iterative Closest Point:


Do you know why?
Thanks in advance.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: After using iterative closest point I have a line pattern in my cloud

phuser
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Ah, I think it's because of the pcl::io::loadPCDFile().

My code to read in the clouds:

pcl::PointCloud<pcl::PointXYZ>::Ptr sourceCloud (new pcl::PointCloud<pcl::PointXYZ>);
    pcl::PointCloud<pcl::PointXYZ>::Ptr targetCloud (new pcl::PointCloud<pcl::PointXYZ>);

    if (pcl::io::loadPCDFile<pcl::PointXYZ> ("nocolorcloud.pcd", *sourceCloud) == -1){
        PCL_ERROR("Couldn't read source cloud\n");
        return -1;
    }



    if (pcl::io::loadPCDFile<pcl::PointXYZ> ("lscloud.pcd", *targetCloud) == -1){
        PCL_ERROR("Couldn't read target cloud\n");
        return -1;
    }

The cloud already have a line pattern after reading in.

loadPCDFile() changes the xyz points from this:

334240.15190125 5690924.18934631 44.68482208
334241.36547852 5690924.78383636 44.13171005
334241.30612183 5690924.15018463 44.22806931
334241.74838257 5690924.02891541 43.98544312
334241.70080566 5690923.28207397 44.03520584
334242.46086121 5690925.58966827 43.29489136
334241.64414978 5690921.17449951 44.01313400
334240.95860291 5690920.98533630 44.10452652
334239.48410034 5690923.73198700 44.71825790
334241.20785522 5690921.14075470 44.24439621

to this:


    334240 5.69092e+06 44.6848
    334241 5.69092e+06 44.1317
    334241 5.69092e+06 44.2281
    334242 5.69092e+06 43.9854
    334242 5.69092e+06 44.0352
    334242 5.69093e+06 43.2949
    334242 5.69092e+06 44.0131
    334241 5.69092e+06 44.1045
    334239 5.69092e+06 44.7183
    334241 5.69092e+06 44.2444

Do you know why loadPCDFile() does this?


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: After using iterative closest point I have a line pattern in my cloud

stanly
This post has NOT been accepted by the mailing list yet.
Hi,
are you sure you are not using any filter (e.g. Voxel Grid Filter)?

5.69092e+06 is just another representation of 5690924.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: After using iterative closest point I have a line pattern in my cloud

phuser
This post has NOT been accepted by the mailing list yet.
This post was updated on .
I am sure.
The problem is, that I can't read in the file right.
I have this program from http://pointclouds.org/documentation/tutorials/reading_pcd.php#reading-pcd

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

int
main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test_pcd.pcd", *cloud) == -1) //* load the file
  {
    PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
    return (-1);
  }
  std::cout << "Loaded "
            << cloud->width * cloud->height
            << " data points from test_pcd.pcd with the following fields: "
            << std::endl;
  for (size_t i = 0; i < cloud->points.size (); ++i)
    std::cout << "    " << cloud->points[i].x
              << " "    << cloud->points[i].y
              << " "    << cloud->points[i].z << std::endl;

  return (0);
}


This is the test_pcd.pcd file:

# .PCD v0.7 - Point Cloud Data file format
VERSION 0.7
FIELDS x y z
SIZE 4 4 4
TYPE F F F
COUNT 1 1 1
WIDTH 5
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 5
DATA ascii
334240.15190125 5690924.18934631 44.68482208
334241.36547852 5690924.78383636 44.13171005
334241.30612183 5690924.15018463 44.22806931
334241.74838257 5690924.02891541 43.98544312
334241.70080566 5690923.28207397 44.03520584


Output after running the program:

Loaded 5 data points from test_pcd.pcd with the following fields:
    334240 5.69092e+06 44.6848
    334241 5.69092e+06 44.1317
    334241 5.69092e+06 44.2281
    334242 5.69092e+06 43.9854
    334242 5.69092e+06 44.0352

It seems that my points are too big?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: After using iterative closest point I have a line pattern in my cloud

engin
Two things

Those coordinate values are large. When writing these kinds of values on the console increase the precision.
http://en.cppreference.com/w/cpp/io/manip/setprecision

Because the values are large the lines you are seeing may be visualization artifacts. Center your cloud by subtracting the center of mass from your cloud and look at them again.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: After using iterative closest point I have a line pattern in my cloud

phuser
This post has NOT been accepted by the mailing list yet.
Alright, thank you! That makes sense.
I didn't know that std::cout is inaccurate.
Loading...