Click here to Skip to main content
15,899,314 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have point cloud data which contains NAN which I want remove from the point cloud data. I donot want to use PCL libraries and want it done in C++ open cv visual studio.

What I have tried:

I tried making NAN to -1. But I cannot completely remove the NAN.
Posted
Updated 4-Apr-16 2:53am
Comments
Sergey Alexandrovich Kryukov 2-Apr-16 17:48pm    
Utterly bad idea. Don't "remove" those values, they are important.
—SA

1 solution

Bad idea. NaN and −1 are totally different objects. Learn to use NaN and Inf. There are designed for real productive use, not to give you some useless hassles.

If you use −1 as a "lack of number" or "uninitialized number", you loose the ability to use it as a valid number, which is what it is. That would be the worse you could do.

Don't invent what is already invented, standardized and justified by huge volume of malpractice. The massive malpractice of using −1, 0, or other inappropriate objects as "not numbers" cannot justify anything. Moreover, such malpractice already caused a lot of mess up and bugs.

Instead, use to learn NaN and Inf. They can participate in calculations; they can be assigned to aa floating-point object, checked up, and so on. Inf can even be used in numeric expressions and give correct results. In particular, you can divide by zero and obtain infinity, which can further be used in calculations.

Please see:
Floating point — Wikipedia, the free encyclopedia[^],
IEEE floating point — Wikipedia, the free encyclopedia[^],
NaN — Wikipedia, the free encyclopedia[^].

In C++:
nan — C++ Reference[^],
NAN — C++ Reference[^],
isnan — C++ Reference[^];
isinf — C++ Reference[^],
isfinite — C++ Reference[^],
isnormal — C++ Reference[^],
isfinite — C++ Reference[^].

—SA
 
Share this answer
 
Comments
riivv 4-Apr-16 8:54am    
Actually I have a point cloud data which contains NAN values and I have to detect planes in point cloud data. I am using RANSAC for that. In RANSAC for plane detection I select 3 random points from point cloud data and then I check the remaining as outliers or inliers. Then here i have to check that if its NAN then that should not be considered while selecting the random points and also if its an NAN it should always be an outlier. I wanted a solution for this
Sergey Alexandrovich Kryukov 4-Apr-16 12:58pm    
What do you think is still missing. You got a comprehensive set of links.
Read those articles and you will see. Are you going to accept the answer formally?

If you have some doubts, your follow-up questions will be welcome, only clearly explain them.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900