Wednesday, January 7, 2015

MeshLab issue ...


A post by Victor Lamoine in PCL mailing list

Hello,

If you are using MeshLab to load and save point clouds/meshes, you might
have encountered problems loading MeshLab ASCII files into PCL.

MeshLab is using  the decimal separator/mark
<https://en.wikipedia.org/wiki/Decimal_mark>  defined in the locale, so for
example if your Linux distribution is in French, the comma mark is used.
Most (if not all) PLY files are written with a dot mark as a decimal mark.
PCL is only able to read files with the dot mark.

A solution is to launch MeshLab with the C locale, this way MeshLab will
always read/write with the dot separator:

> echo "export LANG=C && meshlab" | sudo tee –a
> /usr/share/applications/meshlab_en.sh &&
> sudo sed 's/Exec=meshlab/Exec=\/usr\/share\/applications\/meshlab_en.sh/g'
> -i /usr/share/applications/meshlab.desktop

The problem should also happen on Windows but I don't know the fix.

Bye

Tuesday, December 30, 2014

Updating CMake

http://cameo54321.blogspot.sg/2014/02/installing-cmake-288-or-higher-on.html

Wednesday, December 10, 2014

UBUNTU SOFTWARE CENTER NOT RESPONDING...


source : http://glamanate.com/2013/02/12/ubuntu-software-center-not-responding

Open up terminal and paste:
rm ~/.cache/software-center -R
Then...
unity --reset &



Sunday, November 23, 2014

Square of an Integer N

The square of an integer N = the square of (N-1) integer + N'th Odd Number.

For Example :
4 = 1 + 3
9 = 4 + 5
16 = 9 + 7
25 = 16 + 9
36 = 25 + 11
49 = 36 + 13
64 = 49 + 15

Look at the third column, they are all odd numbers, while the second column is the square of the previous integer. :) 

https://plus.google.com/107229543234337812645/posts/VbY5aQHeRLs

Thursday, November 6, 2014

How to build and install Boost Libraries










One can use

  •  ./bootstrap.sh --prefix=/usr/include

for the installation path.


Cheers

Monday, September 15, 2014

Call any subscriber to a topic only ONCE in ROS

In short:


sensor_msgs::PointCloud2ConstPtr msg = ros::topic::waitForMessage("/camera/depth/points");

cloud_cb(msg);





Tuesday, August 26, 2014

finding eigen values of a covariance matrix using Eigen library

Eigen::Vector4f xyz_centroid;
            
Eigen::Matrix3f covariance_matrix;
            
compute3DCentroid (voxel_cloud, pointIdxRadiusSearch, xyz_centroid);
            
pcl17::computeCovarianceMatrix (voxel_cloud, pointIdxRadiusSearch, xyz_centroid, covariance_matrix);
                
                
Eigen::SelfAdjointEigenSolver<Eigen::Matrix3f> eigen_solver(covariance_matrix);
                
//std::cout << "From Eigen Solver :  \n " << eigen_solver.eigenvalues() <<  std::endl;
                
Eigen::Vector3f temp1;

                
temp1 = eigen_solver.eigenvalues();

QT is by far the best IDE for C/C++

QT (pronounced as 'cute') is amazingly cute IDE for C/C++ :)

Wednesday, August 13, 2014

astyle is amazing

If you want your program to be indented automatically in a systematic/coherent way

Then here you go :

check this out
http://astyle.sourceforge.net/

Convert Point Cloud to Range Image to OpenCV Mat


source :
http://www.pcl-users.org/Convert-point-cloud-to-range-image-td4035137.html

Good tutorial

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

Question:

HI,everyone, I'm trying to convert a 3d point cloud to a opencv mat. So here is my plan: 

1.convert the point cloud to a range image 

2.convert the range image to mat image 
Yet, I'm facing some problems, when I generate the range image by the example code with a terrain point cloud, it only gives me a very small window and nothing show up (other pcd file works). Is it because the pcd file too large? 

And is there any other way to convert the point cloud to opencv mat. Now I'm only caring about x,y data. So it's like a projection of point cloud and convert to a mat image. 


Thanks so much for your help~




Solution


If that is what you need it is exactly what you can do with the project 
inliers filter. 
http://docs.pointclouds.org/trunk/classpcl_1_1_project_inliers.html

just project the point cloud on the xy-Plane there is a tutorial for that: 
http://pointclouds.org/documentation/tutorials/project_inliers.php

after that you can the bounds of the plane by using pcl::getMinMax3D. 
Now you can define a top left and a bottom right corner (defining a rect) and 
compute a scale factor to match your image size. Say you want a 1000x1000px 
Image use 1000 / rect.width for x scale factor and 1000 / rect.height as y 
scale factor after that you can iterate over all points and set the 
corresponding pixels in the mat. cv::Mat::at(pt.x*scaleX, pt.y * scaleY) = 
pt.z After that you might have to to some interpolation to fill in the missing 
pixels and you have your opencv image. 

Saturday, July 26, 2014

When to Use 'A,' 'An,' or 'The'

When to Use 'A,' 'An,' or 'The'

There are several exceptions, or more complicated situations than the above chart covers. Below we have laid out some of the general and specific rules about using A, AN, and THE.
Remember, in order to use A, AN, and THE properly, you must know whether or not a noun is a Count or Non-Count Noun. (A count noun is the name of something that can be counted: one book, two books, three books. A non-count noun is the name of something that cannot be counted: milk, flour, freedom, justice).

Use "a" or "an"Use "the"Don't Use "a," "an," or "the"
General RulesUse "a" or "an" with a singular count noun when you mean "one of many," "any," "in general."
  • Bob is a student (one of many students).
  • I like a good movie (one of many movies).
Use "the" with any noun when the meaning is specific; for example, when the noun names the only one (or one) of a kind. 
  • Adam was the first man (the only 'first man').
  • New York is the largest city in the United States (only one city can be 'the largest').
  • We live on the earth (the only Earth we know).
  • Have you heard the news (specific news)?
Don't Use "a," "an," or "the" with a non-count noun when you mean "any," "in general."
  • We believe in love (in general).
  • He gave me information (not specific).
Use "a" or "an" the first time you use a noun in a paragraph.
  • I saw a movie last night.
  • A man ran into the street.
Use "the" the second time you use that same noun in the same paragraph.
  • I saw a movie last night. The movie was entertaining.
  • A man ran into the street. A car hit the man.
Don't Use "a," "an," or "the" with a plural count noun when you mean "some of many things," "any," "in general."
  • Movies are entertaining (some movies; movies in general).
  • She likes men (in general).
For more detailed ....
visit source http://www.gallaudet.edu/tip/english_works/grammar_and_vocabulary/when_to_use_a_an_or_the.html


Wednesday, May 28, 2014

Finding the plane coefficients from three points

This is a discussion on Point Cloud Library...thanks for the answer, Victor lamoine and Anders Glent Buch and Matteo Munaro :)

source: http://www.pcl-users.org/Method-finding-plane-equation-crossing-3-points-tc4034211.html#a4034214


Does PCL provide function for finding plane crossing 3 given points in 3D? 

Method should find plane coefficients A B C D from equation Ax+By+Cz+D=0 and it should save the found coefficients to pcl::ModelCoefficients class. 

Does PCL have such functionality?


If you denote your 3D points p1, p2 and p3, take the cross product of the in-plane vectors (p2 - p1) x (p3 - p1) to get the normal vector, and normalize it. Now you have the A, B and C coefficients already by these three components. To get D, just take the negative dot product between this vector and p1.




void 
threePointsToPlane (const PointT &point_a, 
                            const PointT &point_b, 
                            const PointT &point_c, 
                            const pcl::ModelCoefficients::Ptr plane) 

  // Create Eigen plane through 3 points 
  Eigen::Hyperplane eigen_plane = 
    Eigen::Hyperplane::Through (point_a.getArray3fMap (), 
                                                          point_b.getArray3fMap (), 
                                                          point_c.getArray3fMap ()); 

  plane->values.resize (4); 

  for (int i = 0; i < plane->values.size (); i++) 
    plane->values[i] = eigen_plane.coeffs ()[i]; 
}



// Ground plane estimation:
  Eigen::VectorXf ground_coeffs;
  ground_coeffs.resize(4);
  std::vector<int> clicked_points_indices;
  for (unsigned int i = 0; i < clicked_points_3d->points.size(); i++)
    clicked_points_indices.push_back(i);
  pcl::SampleConsensusModelPlane<PointT> model_plane(clicked_points_3d);
  model_plane.computeModelCoefficients(clicked_points_indices,ground_coeffs);
  std::cout << "Ground plane: " << ground_coeffs(0) << " " << ground_coeffs(1) << " " << ground_coeffs(2) << " " << ground_coeffs(3) << std::endl;

Monday, May 26, 2014

Error and its solution : undefined symbol: _ZN5pcl177PCLBaseINS_8PointXYZEEC2Ev

Error :  undefined symbol: _ZN5pcl177PCLBaseINS_8PointXYZEEC2Ev


While working with ROS and PCL , I encountered this error.
 undefined symbol: _ZN5pcl177PCLBaseINS_8PointXYZEEC2Ev


Solution : 


From the CMakeLists.txt, just comment 


find_package(PCL 1.x REQUIRED)

This solved the issue for me....Of course the pcl pcl_ros pcl1x pcl1x_ros are in the manifest.xml


Have a Good daY!

Sunday, May 4, 2014

kindaaa... crazy

You can construct a Transform from an abstract transformation, like this:
Transform t(AngleAxis(angle,axis));

or like this:

Transform t;
t = AngleAxis(angle,axis);

But note that unfortunately, because of how C++ works, you can not do this:
Transform t = AngleAxis(angle,axis);



Explanation: In the C++ language, this would require Transform to have a non-explicit conversion constructor from AngleAxis, but we really don't want to allow implicit casting here.


source : http://eigen.tuxfamily.org/dox-devel/group__TutorialGeometry.html

Tuesday, April 29, 2014

Error



In file included from /usr/include/boost/graph/breadth_first_search.hpp:21:0,
                 from /usr/include/boost/graph/dijkstra_shortest_paths.hpp:21,
                 from /home/sai/workspace/pcl-pcl-1.7.0/registration/include/pcl/registration/boost.h:49,
                 from /home/sai/workspace/pcl-pcl-1.7.0/registration/include/pcl/registration/registration.h:50,
                 from /home/sai/workspace/pcl-pcl-1.7.0/registration/include/pcl/registration/icp.h:47,
                 from /home/sai/pcl_testing/narf_keypoint_extraction/sure_narf_fpfh_matching.cpp:34:
/usr/include/boost/graph/graph_concepts.hpp: In destructor ‘boost::concepts::AdjacencyMatrix::~AdjacencyMatrix()’:
/usr/include/boost/graph/graph_concepts.hpp:368:17: error: missing template arguments before ‘(’ token
/usr/include/boost/graph/graph_concepts.hpp: In member function ‘void boost::concepts::AdjacencyMatrix::const_constraints(const G&)’:
/usr/include/boost/graph/graph_concepts.hpp:372:17: error: missing template arguments before ‘(’ token
make[2]: *** [CMakeFiles/sure_narf_fpfh_matching.dir/sure_narf_fpfh_matching.cpp.o] Error 1
make[1]: *** [CMakeFiles/sure_narf_fpfh_matching.dir/all] Error 2

make: *** [all] Error 2


Solution

Just copy the header file 

#include "pcl/registration/icp.h"


to the beginning of all the header files.

This will solve the issue

Good day!