Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend cpp for model-based semantic segmentation #33

Merged
merged 39 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ed64d49
FIX: the joint detector was not updated strange, now it's ok
9and3 Jun 2, 2024
6b67948
FIX: cleaning needless prints
9and3 Jun 2, 2024
4d7e015
FIX: for load mesh from file back to good version
9and3 Jun 2, 2024
ad3a8cb
WIP-FIX. got rid of pycache in gitignore
9and3 Jun 2, 2024
41da968
FIX: cleaning pycache directory
9and3 Jun 2, 2024
b585881
ADD: for box-like studs have a small catch in the detector
9and3 Jun 2, 2024
8331e35
ADD: OBB added for both dfmesh and dfcloud + bindings
9and3 Jun 6, 2024
d7349fb
WIP-CAP: working version for new joint detector
9and3 Jun 8, 2024
41bea3f
WIP: almost there, need packaging the new algorithm in the itnernal d…
9and3 Jun 8, 2024
029c5d2
WIP-CAP: need cleaning but the new joint detector is in place
9and3 Jun 9, 2024
9e48a88
CAP: new joint detector + 3 components + xml export refactor
9and3 Jun 10, 2024
4255081
ADD: example file for assembly system
9and3 Jun 11, 2024
394a621
Merge branch 'fix_joint_detector'
9and3 Jun 13, 2024
b4e6e24
WIP-MERGE: cleaning from merge diffcheck joint detector
9and3 Jun 13, 2024
56dff2e
FIX: compiling fix in c++ solved
9and3 Jun 13, 2024
4030226
WIP: light readme cleaning
9and3 Jun 19, 2024
803fee2
FIX: typo on mermaid plan
9and3 Jun 19, 2024
f6fd4e9
WIP-ADD: AssociateSegments function created
DamienGilliard Jun 24, 2024
1adc9de
FIX: renaming of cilantro segmentation wrap following review
DamienGilliard Jun 24, 2024
e320d64
Merge branch 'semantic_segmentation' of github.com:diffCheckOrg/diffC…
DamienGilliard Jun 24, 2024
8bff20f
WIP: creation of the aggregatino function that associates point cloud…
DamienGilliard Jun 25, 2024
58daa2a
FIX-MERGE: bringing the assembly/beam structure to the segmentation m…
9and3 Jun 29, 2024
e0b531d
ADD: small cmake utilitiy for dev convinience
9and3 Jun 29, 2024
3940e23
ADD: normal estimation to dfcloud
9and3 Jun 29, 2024
acc643c
TEMP: working on colored cluster + visualizer
9and3 Jun 29, 2024
08b09db
WIP: adding coloring for cloud and clustering
9and3 Jun 30, 2024
3eb0fc5
CAP: refactored backend for segmeentations and normal estimations
9and3 Jun 30, 2024
c9277c7
WIP: segmentation now using triangle faces + small fixes
DamienGilliard Jun 30, 2024
2010cb0
ADD: egg link to gitignore
9and3 Jun 30, 2024
73888c9
ADD-MILESTONE: wraps for normal estimation + segmentation
9and3 Jun 30, 2024
af0c8b8
commit before rebase
DamienGilliard Jul 1, 2024
b24e67f
WIP: commit before pull
DamienGilliard Jul 1, 2024
50cdc17
WIP: rebased onto 'segmentation' branch
DamienGilliard Jul 1, 2024
2503cfb
Merge branch 'semantic_segmentation' of github.com:diffCheckOrg/diffC…
DamienGilliard Jul 1, 2024
c8e9ad5
CAP: AssociateClusters function implemented in the back-end
DamienGilliard Jul 2, 2024
032f428
UPDATE: CleanUnassociatedClusters method added, and PR remarks included
DamienGilliard Jul 6, 2024
b688ec9
UPDATE-WIP: add IsPointOnFace function, and angle threshold parameter…
DamienGilliard Jul 10, 2024
111c484
UPDATE: adding some preventive checks to the methods in DFSegmentation
DamienGilliard Jul 10, 2024
38c12c5
CAP: Association functions implemented, defensive checks added, and g…
DamienGilliard Jul 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ temp/
## Python
#######################################
# Byte-compiled / optimized / DLL files
__pycache__/
**/__pycache__/
*.py[cod]
*$py.class

Expand Down Expand Up @@ -243,4 +243,7 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#.idea/

# egg-info
*.egg-info/
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"cwctype": "cpp",
"memory_resource": "cpp",
"scoped_allocator": "cpp",
"strstream": "cpp"
"strstream": "cpp",
"core": "cpp"
}
}
49 changes: 39 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,6 @@ target_include_directories(${APP_NAME_EXE}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
)

#--------------------------------------------------------------------------
# Tests
#--------------------------------------------------------------------------

# include(CTest)
# enable_testing()

# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/global_registrations)

#--------------------------------------------------------------------------
# pybind11
#--------------------------------------------------------------------------
Expand Down Expand Up @@ -171,4 +162,42 @@ if (BUILD_PYTHON_MODULE)
)
endforeach()

endif()
endif()

#--------------------------------------------------------------------------
# Tests
#--------------------------------------------------------------------------

# include(CTest)
# enable_testing()
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/googletest)
# set(TESTS_OUT_DIR ${CMAKE_BINARY_DIR}/tests/)


# # Unit testing ------------------------------------------------------------
# set(UNIT_TESTS unit_tests)
# add_executable(${UNIT_TESTS} tests/unit_tests/DFPointCloudTest.cc)
# set_target_properties(${UNIT_TESTS} PROPERTIES
# RUNTIME_OUTPUT_DIRECTORY ${TESTS_OUT_DIR}
# )

# target_link_libraries(${UNIT_TESTS} gtest gtest_main)
# target_link_libraries(${UNIT_TESTS} ${SHARED_LIB_NAME})

# add_test(NAME ${UNIT_TESTS} COMMAND ${UNIT_TESTS})

# Integration testing -----------------------------------------------------
# Component testing -------------------------------------------------------
# etc ---------------------------------------------------------------------

# # TODO: a better way to copy the dlls to the tests directory for the tests
# # get all the files -dlls in the bin directory and copy them one by one to tests dir
# file(GLOB files ${CMAKE_BINARY_DIR}/bin/Release/*.dll)
# foreach(file ${files})
# message(STATUS "Copying ${file} to ${TESTS_OUT_DIR}")
# add_custom_command(TARGET ${UNIT_TESTS} POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy
# ${file}
# ${TESTS_OUT_DIR}/Release
# )
# endforeach()
25 changes: 6 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ gantt
Data collection and evaluation :dataeval, after fabrob, 4w
```

```mermaid
gantt
dateFormat YYYY-MM-DD
title diffCheck - backend dev
excludes weekends

data i/o :active, dataio, 2024-03-15, 3w
global registration :glbreg, 2024-03-29, 2w
semantic seg. from 3D model :semseg, after glbreg, 1w
local registration :locreg, after semseg, 2w
error computation + results :errcomp, after locreg, 1w
```

## 3rd party libraries

The project uses the following 3rd party libraries:
Expand All @@ -63,22 +50,22 @@ To build and test the project, follow the following steps:
```terminal
cmake/config.bat
cmake/build.bat
./build/bin/Release/diffCheckApp.exe <-- for prototyping
./build/bin/Release/diffCheckApp.exe <-- for prototyping in c++
```

## Prototype diffCheck in C++
To prototype:
1) add a header/source file in `src/diffCheck` and include the header in `diffCheck.hh` interface
1) test it in `diffCheckApp` (the cmake will output an executable in bin)
2) test it in `diffCheckApp` (the cmake will output an executable in bin)

See the [CONTRIBUTING.md](https://github.com/diffCheckOrg/diffCheck/blob/main/CONTRIBUTING.md) for more information on how to prototype with diffCheck (code guidelines, visualizer, utilities, etc).

## Component roadmap
From the 3/5/2024 meeting, the architecture of the different grasshopper components was discussed as following:
- [ ] PLY loader point cloud: @eleni: loads the pointcloud ply files and converts it into rg.PointCloud (+ cvt submodule)
- [ ] PLY loader mesh: @eleni: loads the mesh ply files and converts it into rg.Mesh (+ cvt submodule)
- [ ] Global registration: @andrea: to align the scan to the reference model
- [ ] Refined registration: @andrea: to refine the alignement
- [x] PLY loader point cloud: @eleni: loads the pointcloud ply files and converts it into rg.PointCloud (+ cvt submodule)
- [x] PLY loader mesh: @eleni: loads the mesh ply files and converts it into rg.Mesh (+ cvt submodule)
- [x] Global registration: @andrea: to align the scan to the reference model
- [x] Refined registration: @andrea: to refine the alignement
- [ ] Semantic segmentation additive: to identify the pieces or joints in the point cloud
- [ ] Semantic segmentation subtractive: to identify the pieces or joints in the point cloud
- [ ] Per-joint refinement to refine the global registration to each joints (only in the "substractive" case)
Expand Down
41 changes: 41 additions & 0 deletions ScreenCamera_2024-06-30-00-00-53.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"class_name" : "PinholeCameraParameters",
"extrinsic" :
[
0.78518600604290978,
-0.4688467948733368,
0.4045560762754441,
0.0,
-0.61432912235314374,
-0.67201447960085037,
0.41351695084435719,
0.0,
0.077991444038432445,
-0.57321830234544802,
-0.81568260525341763,
0.0,
1416.8243739322577,
908.62300697364822,
1063.1264987715035,
1.0
],
"intrinsic" :
{
"height" : 800,
"intrinsic_matrix" :
[
692.82032302755101,
0.0,
0.0,
0.0,
692.82032302755101,
0.0,
499.5,
399.5,
1.0
],
"width" : 1000
},
"version_major" : 1,
"version_minor" : 0
}
41 changes: 41 additions & 0 deletions ScreenCamera_2024-06-30-11-58-46.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"class_name" : "PinholeCameraParameters",
"extrinsic" :
[
0.76239913059926834,
-0.422274821893041,
0.49033818988192268,
0.0,
-0.54132130094127906,
-0.00099240450767756894,
0.8408152378974435,
0.0,
-0.35456849099817256,
-0.90646731321570218,
-0.22934296427574399,
0.0,
1550.6223360557265,
197.24908733414611,
336.92784140962624,
1.0
],
"intrinsic" :
{
"height" : 800,
"intrinsic_matrix" :
[
692.82032302755101,
0.0,
0.0,
0.0,
692.82032302755101,
0.0,
499.5,
399.5,
1.0
],
"width" : 1000
},
"version_major" : 1,
"version_minor" : 0
}
Binary file added ScreenCapture_2024-06-30-00-00-53.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ScreenCapture_2024-06-30-11-58-46.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/icon_pool/cloud1.png
Binary file not shown.
Binary file removed assets/icon_pool/cloud1.xcf
Binary file not shown.
Binary file removed assets/icon_pool/cloud2.png
Binary file not shown.
Binary file removed assets/icon_pool/cloud2.xcf
Binary file not shown.
Binary file removed assets/icon_pool/code_xml_export.png
Binary file not shown.
Binary file removed assets/icon_pool/code_xml_export.xcf
Binary file not shown.
Binary file removed assets/icon_pool/code_xml_export2.png
Binary file not shown.
Binary file removed assets/icon_pool/code_xml_export2.xcf
Binary file not shown.
Binary file removed assets/icon_pool/df_test_import.png
Binary file not shown.
Binary file removed assets/icon_pool/df_test_import.xcf
Binary file not shown.
File renamed without changes.
File renamed without changes
Binary file added assets/icon_pool/icon_large_assemblytoxml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/icon_large_buildassembly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/icon_large_deconstructbeam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/icon_small_buildassembly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/icon_small_buildassembly.xcf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/icon_small_deconstructbeam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/icon_small_xmlexport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added assets/icon_pool/logo_pixelized_bwvioelt.png
Binary file added assets/icon_pool/normal.png
Binary file added assets/icon_pool/normal_cloud.png
Binary file added assets/icon_pool/normal_cloud.xcf
Binary file not shown.
Binary file added assets/icon_pool/normal_segment.png
Binary file added assets/icon_pool/normal_segmenter.png
Binary file added assets/icon_pool/normal_segmenter.xcf
Binary file not shown.
1 change: 1 addition & 0 deletions cmake/build_run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.\cmake\build.bat ; if ($?) { .\build\bin\Release\diffCheckApp.exe }
2 changes: 1 addition & 1 deletion deps/eigen
Submodule eigen updated from f78dfe to d791d4
2 changes: 1 addition & 1 deletion deps/pybind11
Submodule pybind11 updated 112 files
2 changes: 2 additions & 0 deletions src/diffCheck.hh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <open3d/Open3D.h>
#include <loguru.hpp>

#include <cilantro/cilantro.hpp>

// diffCheck includes
#include "diffCheck/log.hh"
const diffCheck::Log LOG = diffCheck::Log();
Expand Down
24 changes: 24 additions & 0 deletions src/diffCheck/geometry/DFMesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,30 @@ namespace diffCheck::geometry
this->Cvt2DFMesh(O3DTriangleMesh);
}

std::vector<Eigen::Vector3d> DFMesh::GetTightBoundingBox()
{
auto O3DTriangleMesh = this->Cvt2O3DTriangleMesh();
open3d::geometry::OrientedBoundingBox tightOOBB = O3DTriangleMesh->GetMinimalOrientedBoundingBox();
std::vector<Eigen::Vector3d> bboxPts = tightOOBB.GetBoxPoints();
return bboxPts;
}

Eigen::Vector3d DFMesh::GetFirstNormal()
{
if (this->NormalsFace.size() == 0)
{
std::shared_ptr<open3d::geometry::TriangleMesh> O3DTriangleMesh = this->Cvt2O3DTriangleMesh();
O3DTriangleMesh->ComputeTriangleNormals();
this->NormalsFace.resize(O3DTriangleMesh->triangle_normals_.size());
for (size_t i = 0; i < O3DTriangleMesh->triangle_normals_.size(); i++)
{
this->NormalsFace[i] = O3DTriangleMesh->triangle_normals_[i];
}

}
return this->NormalsFace[0];
}

void DFMesh::LoadFromPLY(const std::string &path)
{
std::shared_ptr<diffCheck::geometry::DFMesh> tempMesh_ptr = diffCheck::io::ReadPLYMeshFromFile(path);
Expand Down
16 changes: 16 additions & 0 deletions src/diffCheck/geometry/DFMesh.hh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ namespace diffCheck::geometry
*/
void ApplyTransformation(const diffCheck::transformation::DFTransformation &transformation);

public: ///< Utils
/**
* @brief Get the mesh tight bounding box
*
* @return std::vector<Eigen::Vector3d> A vector of two Eigen::Vector3d, with the first one being the minimum
* point and the second one the maximum point of the bounding box.
*/
std::vector<Eigen::Vector3d> GetTightBoundingBox();

/**
* @brief Get the first normal of the mesh. Meant for planar meshes
*
* @return Eigen::Vector3d the normal
*/
Eigen::Vector3d GetFirstNormal();

public: ///< I/O loader
/**
* @brief Read a mesh from a file
Expand Down
Loading