Open petrasvestartas opened 3 years ago
Nice summary of how to use the All-In-One-installer - would be nice if you would contribute it as a tutorial perhaps :)
Maybe a bit of rewording here and there.
I second @larshg here. The tutorials are located in docs/tutorials/content
and use RST (how-to-start, primer). You can create a PR and add the images in the subfolder.
Step 3 would be easier since you can simply refer to the source file
You helped me a lot!!! I really, truly appreciate you!
Your work has saved me a lot of time!!!
many thx for your effort and work, you save me a lot of time.
This ended 3 weeks of frustrating fighting vcpkg.
Any tutorial to run the qt visualiser example?
Thank you so much!
Thank you so much for this! I spent a week struggling to install PCL on Windows 10, resulting in different levels of failure - for example the vcpkg version would install, but lacked the visualization components that are honestly critical to a 3D program. I got to the point of compiling everything myself from scratch, following a mix-and-match of tutorials like the official one and the UnaNancyOwen one, but those ultimately failed too.
Your guide actually worked. And even better, it's really the easiest guide to follow. The only thing I can add is that I had to set the startup project as cloud_viewer rather than ALL_BUILD, and that's a relatively easy step.
Your guide should be the official documentation, and the other documentation should be clearly deprecated and retired.
This should be official guide. I spent several hours to build from source and with vcpkg. none of them actually worked. On top of that, vcpkg takes like 6-7 hours for installation. Thank you so much!
We have a windows docker image as well: pointcloudlibrary/env:winx86
and pointcloudlibrary/env:winx64
(based on 2019 Server Core image) that come with vcpkg installed (and other dependencies of PCL, but not PCL)
This should be official guide
Adding this as an official tutorial is quite easy (hence the tags). Please feel free to create a PR in the docs module of PCL
Thank you
Hi, where can i find those documents from point 3 (CMakeLists.txt and .cpp file)
Hi, where can i find those documents from point 3 (CMakeLists.txt and .cpp file)
@xlulak just use the link he provided: https://pcl.readthedocs.io/projects/tutorials/en/latest/cloud_viewer.html#cloud-viewer There you will find the CMake file and the .cpp
Hello, The all in one installer works only in release mode, debug, release with debug, results in a crash.
int
main()
{
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new pcl::visualization::PCLVisualizer("3D Viewer"));
pcl::PCLPointCloud2::Ptr cloud(new pcl::PCLPointCloud2);
pcl::io::loadPCDFile("188261.pcd", *cloud);
// Convert data to PointCloud<T>
PointCloud<PointXYZ>::Ptr xyz(new PointCloud<PointXYZ>);
fromPCLPointCloud2(*cloud, *xyz);
// Refine the plane indices
using SampleConsensusModelPlanePtr = SampleConsensusModelPlane<PointXYZ>::Ptr;
SampleConsensusModelPlanePtr model(new SampleConsensusModelPlane<PointXYZ>(xyz));
RandomSampleConsensus<PointXYZ> sac(model, 0.05);
sac.setMaxIterations(1000);
bool res = sac.computeModel();
pcl::Indices inliers;
sac.getInliers(inliers);
Eigen::VectorXf coefficients;
sac.getModelCoefficients(coefficients);
if (!res || inliers.empty())
{
PCL_ERROR("No planar model found. Relax thresholds and continue.\n");
return 0;
}
sac.refineModel(2, 50);
sac.getInliers(inliers);
sac.getModelCoefficients(coefficients);
print_info("Model coefficients: [");
print_value("%g %g %g %g", coefficients[0], coefficients[1], coefficients[2], coefficients[3]); print_info("]\n");
// Instead of returning the planar model as a set of inliers, return the outliers, but perform a cluster segmentation first
// Remove the plane indices from the data
PointIndices::Ptr everything_but_the_plane(new PointIndices);
std::vector<int> indices_fullset(xyz->size());
for (int p_it = 0; p_it < static_cast<int> (indices_fullset.size()); ++p_it)
indices_fullset[p_it] = p_it;
std::sort(inliers.begin(), inliers.end());
set_difference(indices_fullset.begin(), indices_fullset.end(),
inliers.begin(), inliers.end(),
inserter(everything_but_the_plane->indices, everything_but_the_plane->indices.begin()));
// Extract largest cluster minus the plane
std::vector<PointIndices> cluster_indices;
EuclideanClusterExtraction<PointXYZ> ec;
ec.setClusterTolerance(0.02); // 2cm
ec.setMinClusterSize(100);
ec.setInputCloud(xyz);
ec.setIndices(everything_but_the_plane);
ec.extract(cluster_indices);
pcl::PointCloud<pcl::PointXYZ>::Ptr cluster(new pcl::PointCloud<pcl::PointXYZ>);
pcl::PCLPointCloud2 output;
// Convert data back
copyPointCloud(*cloud, cluster_indices[0].indices, output);
fromPCLPointCloud2(output, *cluster);
pcl::MomentOfInertiaEstimation <PointXYZ> feature_extractor;
feature_extractor.setInputCloud(cluster);
feature_extractor.compute();
std::vector <float> moment_of_inertia;
std::vector <float> eccentricity;
pcl::PointXYZ min_point_AABB;
pcl::PointXYZ max_point_AABB;
pcl::PointXYZ min_point_OBB;
pcl::PointXYZ max_point_OBB;
pcl::PointXYZ position_OBB;
Eigen::Matrix3f rotational_matrix_OBB;
float major_value, middle_value, minor_value;
Eigen::Vector3f major_vector, middle_vector, minor_vector;
Eigen::Vector3f mass_center;
feature_extractor.getMomentOfInertia(moment_of_inertia);
feature_extractor.getEccentricity(eccentricity);
feature_extractor.getAABB(min_point_AABB, max_point_AABB);
feature_extractor.getOBB(min_point_OBB, max_point_OBB, position_OBB, rotational_matrix_OBB);
feature_extractor.getEigenValues(major_value, middle_value, minor_value);
feature_extractor.getEigenVectors(major_vector, middle_vector, minor_vector);
feature_extractor.getMassCenter(mass_center);
pcl::PointXYZ center(mass_center(0), mass_center(1), mass_center(2));
pcl::PointXYZ x_axis(major_vector(0) + mass_center(0), major_vector(1) + mass_center(1), major_vector(2) + mass_center(2));
pcl::PointXYZ y_axis(middle_vector(0) + mass_center(0), middle_vector(1) + mass_center(1), middle_vector(2) + mass_center(2));
pcl::PointXYZ z_axis(minor_vector(0) + mass_center(0), minor_vector(1) + mass_center(1), minor_vector(2) + mass_center(2));
viewer->addLine(center, x_axis, 1.0f, 0.0f, 0.0f, "major eigen vector");
viewer->addLine(center, y_axis, 0.0f, 1.0f, 0.0f, "middle eigen vector");
viewer->addLine(center, z_axis, 0.0f, 0.0f, 1.0f, "minor eigen vector");
viewer->addPointCloud<pcl::PointXYZ>(cluster, "Moment Of Inertia (PCA Eigen Vector Axes)");
pcl::io::savePLYFileBinary("filtered.ply", *cluster);
while (!viewer->wasStopped())
{
viewer->spinOnce(100);
}
and here is the sample point cloud https://www.mediafire.com/file/epglzuigetuw0n2/188262.pcd/file
it works only in release mode.
Can anyone help me, to include PCL lib path when create empty project Visual Studio 2019 (do not use Cmake to complie project) i want to add pcl libraries into a prevous project.
Awesome!
I think i'm just to dumb for Point 3. I have no idea on how to find these two documents. Also why do i have 340 .txt documents in the files that i had to download in Point 1 ? https://pcl.readthedocs.io/projects/tutorials/en/latest/cloud_viewer.html#cloud-viewer
Could someone please help me? Maybe with pictures or so ?
@petrasvestartas i'm appreciate about the tutorial. I have spend a week to compile it from source and the other tutorials from pcl homepage.
But i have one problem an i hope one of you can help me. I have downloaded the 188262.pcd file from the Link that @AndreAhmed has posted.
I build the project and run it in debug and release mode but i only have the colorful screen below.
For the script i have copied the "more complete sample" from here: https://pcl.readthedocs.io/projects/tutorials/en/latest/cloud_viewer.html#cloud-viewer
@petrasvestartas i'm appreciate about the tutorial. I have spend a week to compile it from source and the other tutorials from pcl homepage.
But i have one problem an i hope one of you can help me. I have downloaded the 188262.pcd file from the Link that @AndreAhmed has posted.
I build the project and run it in debug and release mode but i only have the colorful screen below.
For the script i have copied the "more complete sample" from here: https://pcl.readthedocs.io/projects/tutorials/en/latest/cloud_viewer.html#cloud-viewer
Just press R or scroll with curser on the window. This change the camera view, which only shows the coordinate axises close up :-)
Thank you so much! It works for me. Before finding your tutorial, I have spent a whole day installing PCL using vcpkg, which is a nightmare...
Hello, this tutorial is great. But there is one thing not working on my PCL in VS2019. Intellisense ist not working with PCL. Does anybody else has this problem?
Have you tried to disable intellisense in VS? Like setting 'Build Only'
Have you tried to disable intellisense in VS? Like setting 'Build Only'
Hello, thank you for your answer. i meant that in visual studio the autocorrection or code suggestions from intellisense does not work in a PCL project. Does the autocorrection work for you?
@HanzDieter are you work with the PCL-examples or with a new custom project?
In the PCL-examples InteliSense does not work. In a custom projekt it works fine with PCL.
I can run the code but I am getting this error on the list, what is the problem? C++ command-line error: invalid macro definition: BOOST_ALL_NO_LIB-DBOOST_ALL_NO_LIB
Maybe the viewer.h is needed Boost at one point. Can you include a boost library in your Code? Make Sure boost is installed and correctly linked. Maybe its helps if you add boost in the projectsettings as additional include path.
Its a bug with dublicate defines, pleqse search for similiar issue and fix.
Solved by changing "BOOST_ALL_NO_LIB-DBOOST_ALL_NO_LIB" line to two separate definitions.
please tell me where can i find CMakeLists.txt and .cpp file (point 3)
please tell me where can i find CMakeLists.txt and .cpp file (point 3)
Please look for the tutorial in point 3. You have to copy the code an create the files by yourself.
please tell me where can i find CMakeLists.txt and .cpp file (point 3)
Please look for the tutorial in point 3. You have to copy the code and create the files by yourself.
Okay Thanks, I understood that I have to copy it to the cmakelist.text and cloud_compare.cpp
But where I will find these file
Any help will be appreciated.
You should create these files by yourself. You can't find them anywhere.
You should create these files by yourself. You can't find them anywhere.
I am new to this field. Can you give me some idea on how to create it?
Thanks in advance
You should create these files by yourself. You can't find them anywhere.
ToDo:
Create a empty folder ( e.g. your project name - here cloud_viewer)
create the file cloud_viewer.cpp in the new folder and copy the cpp-code from the tutorial to this file. (61 lines in this tutorial)
Create the file CMakeLists.txt in the new folder and copy the Code from the tutorial in this file. (12 lines in this tutorial)
now you can go to step 4. Please be aware with the paths and reference your newly createt project folder.
Thanks a lot. It worked.
Would you please explain point 5? What you did in visual studio and how?
thanking you
You should create these files by yourself. You can't find them anywhere.
ToDo:
* Create a empty folder ( e.g. your project name - here cloud_viewer) * create the file cloud_viewer.cpp in the new folder and copy the cpp-code from the tutorial to this file. (61 lines in this tutorial) * Create the file CMakeLists.txt in the new folder and copy the Code from the tutorial in this file. (12 lines in this tutorial) * now you can go to step 4. Please be aware with the paths and reference your newly createt project folder.
Thanks a lot. It worked.
Would you please explain point 5? What you did in visual studio and how?
thanking you
You haven't looked on the picture on point five?
Open the "solution explorer" Make a right click on the "cloud_viewer" project. Klick in the opened contextmenu on "Set as startup" project.
Sorry, but it's not that difficult. You have worked with visual Studio before?
Any tutorial to run the qt visualiser example?
You found any ??
Does this tutorial work for Visual Studio 2022?
Does this tutorial work for Visual Studio 2022?
Yes. I am using VS2022. And It works
Hi,
Thank you very much for this awesome guide. However, following this tutorial when you try to add more source/header files to the project (not only main.cpp or cloudviewer.cpp or whatever), VS2022 creates them in a different directory than the one CMake takes. Thus you have to manually move them which feels weird.
Any idea?
Hi,
We went through a painful process of PCL installation. In order to save someone else time, I would strongly recommend to include these steps in PCL github ReadMe file.
TRYING TO INSTALL PCL FOR DAYS, WEEKS, MONTHS AND YEARS FOR WINDOWS X64 VISUAL STUDIO 2019? READ CAREFULLY STEPS BELOW:
We tried VCPKG packages, but it did not work because of Eigen, and the only way was to install via all in one installer.
name:Path C:\Program Files\OpenNI2 C:\Program Files\PCL 1.11.1\bin C:\Program Files\PCL 1.11.1\3rdParty C:\Program Files\PCL 1.11.1\3rdParty\VTK\bin C:\Program Files\OpenNI2\Tools
name: OPENNI2_INCLUDE64 value: C:\Program Files\OpenNI2\Include\
name: OPENNI2_LIB64 value: C:\Program Files\OpenNI2\Lib\
name: OPENNI2_REDIST64 value: C:\Program Files\OpenNI2\Redist\