33
44#include < iostream>
55#include < fstream>
6+
7+ // checking computation time
68#include < chrono>
79
810int main ()
911{
12+ auto initTime = std::chrono::high_resolution_clock::now ();
13+
1014 std::shared_ptr<diffCheck::geometry::DFPointCloud> pcdSrc = std::make_shared<diffCheck::geometry::DFPointCloud>();
15+ std::vector<std::shared_ptr<diffCheck::geometry::DFMesh>> meshSrc = std::vector<std::shared_ptr<diffCheck::geometry::DFMesh>>();
1116 std::vector<std::shared_ptr<diffCheck::geometry::DFPointCloud>> segments;
12- std::string pathPcdSrc = R"( C:\Users\andre\Downloads\moved_04.ply)" ;
17+ std::vector<std::string> meshPaths;
18+
19+ std::string meshesFolderPath = R"( C:\Users\localuser\Desktop\again_other_meshes_for_diffCheck\)" ;
20+
21+ for (int i = 1 ; i <= 4 ; i++)
22+ {
23+ std::string meshPath = meshesFolderPath + std::to_string (i) + " .ply" ;
24+ std::shared_ptr<diffCheck::geometry::DFMesh> mesh = std::make_shared<diffCheck::geometry::DFMesh>();
25+ mesh->LoadFromPLY (meshPath);
26+ meshSrc.push_back (mesh);
27+ }
28+
29+ std::string pathPcdSrc = R"( C:\Users\localuser\Desktop\cleaned_AC_pc_90deg.ply)" ;
1330
1431 pcdSrc->LoadFromPLY (pathPcdSrc);
1532
@@ -28,10 +45,39 @@ int main()
2845 diffCheck::segmentation::DFSegmentation::AssociateSegments (meshSrc, segments, 0.15 );
2946
3047 diffCheck::visualizer::Visualizer vis;
31- vis.AddMesh (meshSrc);
32- for (auto segment : segments)
33- vis->AddPointCloud (segment);
34-
48+ for (auto segment : std::get<1 >(unifiedSegments))
49+ {
50+ // colorize the segments with random colors
51+ double r = static_cast <double >(rand ()) / RAND_MAX;
52+ double g = static_cast <double >(rand ()) / RAND_MAX;
53+ double b = static_cast <double >(rand ()) / RAND_MAX;
54+
55+ for (int i = 0 ; i < segment->Points .size (); i++)
56+ {
57+ segment->Colors .push_back (Eigen::Vector3d (r, g, b));
58+ }
59+ vis.AddPointCloud (segment);
60+
61+ // // colorize the segments with random colors
62+ // double r = static_cast<double>(rand()) / RAND_MAX;
63+ // double g = static_cast<double>(rand()) / RAND_MAX;
64+ // double b = static_cast<double>(rand()) / RAND_MAX;
65+ // for (int i = 0; i < std::get<0>(unifiedSegments)->Points.size(); i++)
66+ // {
67+ // std::get<0>(unifiedSegments)->Colors.push_back(Eigen::Vector3d(r, g, b));
68+ // }
69+ // vis.AddPointCloud(std::get<0>(unifiedSegments));
70+
71+ // for (auto segemt : std::get<1>(unifiedSegments))
72+ // {
73+ // for (int i = 0; i < segemt->Points.size(); i++)
74+ // {
75+ // segemt->Colors.push_back(Eigen::Vector3d(0, 0, 1));
76+ // }
77+ // vis.AddPointCloud(segemt);
78+ // }
79+
80+ }
3581 for (auto mesh : meshSrc)
3682 {
3783 vis.AddMesh (mesh);
0 commit comments