Rift Descriptor Returns NaN

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

Rift Descriptor Returns NaN

tuna91
Hi there, 
I am pretty new with pcl and C++ so forgive me for my ignorance on some of the subjects.
I have been trying to find rift descriptors of a PCD file that I have created. One thing that I noticed when I give an organized pcd file (Width = 640 Height = 480) I get an error: Assertion failed: (point_representation_->isValid (point) && "Invalid (NaN, Inf) point coordinates given to radiusSearch!"), function radiusSearchI. But when I give an unorganized pcd file (HEIGHT =1 ; WIDTH =19200), then I do not get an error but both my intensity gradient and descriptor return NaN. I have attached the screenshots of the headers  (both the one that is giving me an error and NaN) and I put the the code I am working with below.. What am I doing wrong here? Thank you in advance.

#include <pcl/io/pcd_io.h>
#include <pcl/point_types_conversion.h>
#include <pcl/features/normal_3d.h>
#include <pcl/features/intensity_gradient.h>
#include <pcl/features/rift.h>
 
// A handy typedef.
typedef pcl::Histogram<32> RIFT32;
 
int
main(int argc, char** argv)
{
	// Object for storing the point cloud with color information.
	pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudColor(new pcl::PointCloud<pcl::PointXYZRGB>);
	// Object for storing the point cloud with intensity value.
	pcl::PointCloud<pcl::PointXYZI>::Ptr cloudIntensity(new pcl::PointCloud<pcl::PointXYZI>);
	// Object for storing the intensity gradients.
	pcl::PointCloud<pcl::IntensityGradient>::Ptr gradients(new pcl::PointCloud<pcl::IntensityGradient>);
	// Object for storing the normals.
	pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
	// Object for storing the RIFT descriptor for each point.
	pcl::PointCloud<RIFT32>::Ptr descriptors(new pcl::PointCloud<RIFT32>());
 
	// Read a PCD file from disk.
	if (pcl::io::loadPCDFile<pcl::PointXYZRGB>(argv[1], *cloudColor) != 0)
	{
		return -1;
	}
 
	// Note: you would usually perform downsampling now. It has been omitted here
	// for simplicity, but be aware that computation can take a long time.
 
	// Convert the RGB to intensity.
	pcl::PointCloudXYZRGBtoXYZI(*cloudColor, *cloudIntensity);
 
	// Estimate the normals.
	pcl::NormalEstimation<pcl::PointXYZI, pcl::Normal> normalEstimation;
	normalEstimation.setInputCloud(cloudIntensity);
	normalEstimation.setRadiusSearch(0.03);
	pcl::search::KdTree<pcl::PointXYZI>::Ptr kdtree(new pcl::search::KdTree<pcl::PointXYZI>);
	normalEstimation.setSearchMethod(kdtree);
	normalEstimation.compute(*normals);
 
	// Compute the intensity gradients.
	pcl::IntensityGradientEstimation < pcl::PointXYZI, pcl::Normal, pcl::IntensityGradient,
		pcl::common::IntensityFieldAccessor<pcl::PointXYZI> > ge;
	ge.setInputCloud(cloudIntensity);
	ge.setInputNormals(normals);
	ge.setRadiusSearch(0.03);
	ge.compute(*gradients);
 
	// RIFT estimation object.
	pcl::RIFTEstimation<pcl::PointXYZI, pcl::IntensityGradient, RIFT32> rift;
	rift.setInputCloud(cloudIntensity);
	rift.setSearchMethod(kdtree);
	// Set the intensity gradients to use.
	rift.setInputGradient(gradients);
	// Radius, to get all neighbors within.
	rift.setRadiusSearch(0.02);
	// Set the number of bins to use in the distance dimension.
	rift.setNrDistanceBins(4);
	// Set the number of bins to use in the gradient orientation dimension.
	rift.setNrGradientBins(8);
	// Note: you must change the output histogram size to reflect the previous values.
 
	rift.compute(*descriptors);
}

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

Gives Error.png (79K) Download Attachment
Gives NaN.png (80K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Rift Descriptor Returns NaN

BlinksTale
I don't know what's causing the NaN issues for the unorganized pcd, but I'm fairly certain the organized PCD has to represent the number of points possible to an exact value - if it's 640*480, then it should be 307200 points. That you have it as 19200 instead would be the big issue here. Whatever "Width x Height" is, I'm fairly certain that must equal "Points" in a PCD.

http://pointclouds.org/documentation/tutorials/pcd_file_format.php
Reply | Threaded
Open this post in threaded view
|

Re: Rift Descriptor Returns NaN

tuna91
Thank you for getting me back quickly but they are actually totally different point clouds so the number of points are fine. Sorry I should had mention that earlier 

On Wednesday, June 29, 2016, BlinksTale <[hidden email]> wrote:
I don't know what's causing the NaN issues for the unorganized pcd, but I'm
fairly certain the organized PCD has to represent the number of points
possible to an exact value - if it's 640*480, then it should be 307200
points. That you have it as 19200 instead would be the big issue here.
Whatever "Width x Height" is, I'm fairly certain that must equal "Points" in
a PCD.

http://pointclouds.org/documentation/tutorials/pcd_file_format.php



--
View this message in context: http://www.pcl-users.org/Rift-Descriptor-Returns-NaN-tp4042126p4042127.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;PCL-users@pointclouds.org&#39;)">PCL-users@... / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


--
Mert Tuna Ozerdem

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Rift Descriptor Returns NaN

Sérgio Agostinho
Hey, 

Can you actually upload both files somewhere?

Also, normally when you have organized pointclouds it is common for them to have NaN points, which a lot of algorithms in PCL don't deal with/filter out. Filter the NaNs out of your pointcloud right after you load them and give it another try. 

Cheers
Sérgio


2016-06-30 0:39 GMT+01:00 Tuna Ozerdem <[hidden email]>:
Thank you for getting me back quickly but they are actually totally different point clouds so the number of points are fine. Sorry I should had mention that earlier 


On Wednesday, June 29, 2016, BlinksTale <[hidden email]> wrote:
I don't know what's causing the NaN issues for the unorganized pcd, but I'm
fairly certain the organized PCD has to represent the number of points
possible to an exact value - if it's 640*480, then it should be 307200
points. That you have it as 19200 instead would be the big issue here.
Whatever "Width x Height" is, I'm fairly certain that must equal "Points" in
a PCD.

http://pointclouds.org/documentation/tutorials/pcd_file_format.php



--
View this message in context: http://www.pcl-users.org/Rift-Descriptor-Returns-NaN-tp4042126p4042127.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


--
Mert Tuna Ozerdem

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users



_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Rift Descriptor Returns NaN

tuna91
Here are my two point clouds I mentioned earlier. I will certainly look into filtering NaNs. If you already know a function for that that would be great too. But besides everything, It seems like all of my points are returning NaN.  
Thank you.
https://www.dropbox.com/sh/lrn2a3486ril8b9/AABqnYSkPFO4Ls30xoHqImWJa?dl=0

On Thu, Jun 30, 2016 at 7:01 AM, Sérgio Agostinho <[hidden email]> wrote:
Hey, 

Can you actually upload both files somewhere?

Also, normally when you have organized pointclouds it is common for them to have NaN points, which a lot of algorithms in PCL don't deal with/filter out. Filter the NaNs out of your pointcloud right after you load them and give it another try. 

Cheers
Sérgio


2016-06-30 0:39 GMT+01:00 Tuna Ozerdem <[hidden email]>:
Thank you for getting me back quickly but they are actually totally different point clouds so the number of points are fine. Sorry I should had mention that earlier 


On Wednesday, June 29, 2016, BlinksTale <[hidden email]> wrote:
I don't know what's causing the NaN issues for the unorganized pcd, but I'm
fairly certain the organized PCD has to represent the number of points
possible to an exact value - if it's 640*480, then it should be 307200
points. That you have it as 19200 instead would be the big issue here.
Whatever "Width x Height" is, I'm fairly certain that must equal "Points" in
a PCD.

http://pointclouds.org/documentation/tutorials/pcd_file_format.php



--
View this message in context: http://www.pcl-users.org/Rift-Descriptor-Returns-NaN-tp4042126p4042127.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


--
Mert Tuna Ozerdem

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users



_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users



_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Rift Descriptor Returns NaN

adr_arroyo
Hi, I found this post in google when looking for "Rift descriptors NaN".
If you or someone receives ths:
Looks like I am dealing with a similar problem. I compute the RIFT from a cloud following the tutorial but somehow most of the values in the descriptors are NaN.
I am actually trying to compute similarity between segments of a pcl, so I want to estimate the rifts to use them as identificators of a segment and then I can match those descriptors with the ones from another segment to see if they are more or less the same.
So how did you solve the NaN problem? Is there a better way to use descriptors to compute segment or pcl similarity?

Cheers