Skip to content

Commit 2503cfb

Browse files
Merge branch 'semantic_segmentation' of github.com:diffCheckOrg/diffCheck into semantic_segmentation
2 parents 50cdc17 + c9277c7 commit 2503cfb

File tree

2 files changed

+51
-6
lines changed

2 files changed

+51
-6
lines changed

src/diffCheck/segmentation/DFSegmentation.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ namespace diffCheck::segmentation
6060
else
6161
{
6262
cilantro::RadiusNeighborhoodSpecification<float> neighborhood(radiusNeighborhoodSize);
63-
6463
cilantro::NormalsProximityEvaluator<float, 3> similarityEvaluator(
6564
cilantroPointCloud->normals,
6665
normalThresholdDegree*M_PI/180.0f);

src/diffCheckApp.cc

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,30 @@
33

44
#include <iostream>
55
#include <fstream>
6+
7+
// checking computation time
68
#include <chrono>
79

810
int 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

Comments
 (0)