Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd321fa4bb |
+64
-50
@@ -8,12 +8,12 @@ option( PLUGIN_G3POINT "Install example plugin" OFF )
|
|||||||
|
|
||||||
if ( PLUGIN_G3POINT )
|
if ( PLUGIN_G3POINT )
|
||||||
project( G3PointPlugin )
|
project( G3PointPlugin )
|
||||||
|
|
||||||
AddPlugin( NAME ${PROJECT_NAME} )
|
AddPlugin( NAME ${PROJECT_NAME} )
|
||||||
|
|
||||||
target_sources(G3PointPlugin
|
target_sources(G3PointPlugin
|
||||||
PRIVATE
|
PRIVATE
|
||||||
ui/WolmanCustomPlot.ui
|
ui/WolmanCustomPlot.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
set(QG3POINT_PLUGIN_VERSION "0.6")
|
set(QG3POINT_PLUGIN_VERSION "0.6")
|
||||||
@@ -22,36 +22,50 @@ target_sources(G3PointPlugin
|
|||||||
add_subdirectory( src )
|
add_subdirectory( src )
|
||||||
add_subdirectory( ui )
|
add_subdirectory( ui )
|
||||||
|
|
||||||
# target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) # for mlpack
|
# EIGEN
|
||||||
|
set( EIGEN_ROOT_DIR "" CACHE PATH "Eigen root (contains the Eigen directory)" )
|
||||||
|
if ( NOT EIGEN_ROOT_DIR )
|
||||||
|
message( SEND_ERROR "No Eigen root directory specified (EIGEN_ROOT_DIR)" )
|
||||||
|
else()
|
||||||
|
message( STATUS "EIGEN_ROOT_DIR " ${EIGEN_ROOT_DIR} )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# BOOST
|
||||||
|
find_package(Boost REQUIRED)
|
||||||
|
message(STATUS "Boost_VERSION: ${Boost_VERSION}")
|
||||||
|
message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
# OPEN3D
|
||||||
|
find_package( Open3D REQUIRED ) # Find installed Open3D, which exports Open3D::Open3D
|
||||||
|
message( "Open3D_DIR ${Open3D_DIR}" )
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set( OPENCV_DEP_DLL_FILES
|
||||||
|
${Open3D_DIR}/../bin/Open3D.dll
|
||||||
|
${Open3D_DIR}/../bin/tbb12_debug.dll)
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
|
set( OPENCV_DEP_DLL_FILES
|
||||||
|
${Open3D_DIR}/../bin/Open3D.dll
|
||||||
|
${Open3D_DIR}/../bin/tbb12.dll)
|
||||||
|
endif()
|
||||||
|
copy_files( "${OPENCV_DEP_DLL_FILES}" "${CLOUDCOMPARE_DEST_FOLDER}" 1) #mind the quotes!
|
||||||
|
|
||||||
target_include_directories( ${PROJECT_NAME} PRIVATE
|
|
||||||
C:/opt/eigen-3.4.0
|
|
||||||
C:/Users/PaulLeroy/miniconda3/envs/env_4_CloudCompare/include
|
|
||||||
C:/opt/open3d-devel-windows-amd64-0.19.0/include
|
|
||||||
C:/opt/GeometricTools/GTE
|
|
||||||
C:/opt/boost_1_77_0
|
|
||||||
)
|
|
||||||
|
|
||||||
# may be needed for debug
|
# may be needed for debug
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
|
||||||
|
|
||||||
#============
|
target_include_directories( ${PROJECT_NAME} PRIVATE
|
||||||
|
${GEOMETRIC_TOOLS_DIR}/GTE
|
||||||
|
${EIGEN_ROOT_DIR}
|
||||||
|
${Boost_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
target_link_libraries( ${PROJECT_NAME} Open3D::Open3D )
|
||||||
|
|
||||||
# QCUSTOMPLOT
|
# QCUSTOMPLOT
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
QCustomPlot
|
QCustomPlot
|
||||||
Qt5::PrintSupport
|
Qt5::PrintSupport
|
||||||
)
|
)
|
||||||
|
|
||||||
# Find installed Open3D, which exports Open3D::Open3D
|
# Copy OpenGL shaders
|
||||||
find_package( Open3D REQUIRED )
|
|
||||||
target_link_libraries( ${PROJECT_NAME} Open3D::Open3D )
|
|
||||||
|
|
||||||
message( "Open3D_DIR ${Open3D_DIR}" )
|
|
||||||
set( OPENCV_DEP_DLL_FILES
|
|
||||||
${Open3D_DIR}/../bin/Open3D.dll
|
|
||||||
${Open3D_DIR}/../bin/tbb12.dll
|
|
||||||
)
|
|
||||||
copy_files( "${OPENCV_DEP_DLL_FILES}" "${CLOUDCOMPARE_DEST_FOLDER}" 1) #mind the quotes!
|
|
||||||
copy_files( "${CMAKE_CURRENT_SOURCE_DIR}/shaders/DrawGrains.vs" "${CLOUDCOMPARE_DEST_FOLDER}/shaders/G3Point" 1) #mind the quotes!
|
copy_files( "${CMAKE_CURRENT_SOURCE_DIR}/shaders/DrawGrains.vs" "${CLOUDCOMPARE_DEST_FOLDER}/shaders/G3Point" 1) #mind the quotes!
|
||||||
copy_files( "${CMAKE_CURRENT_SOURCE_DIR}/shaders/DrawGrains.fs" "${CLOUDCOMPARE_DEST_FOLDER}/shaders/G3Point" 1) #mind the quotes!
|
copy_files( "${CMAKE_CURRENT_SOURCE_DIR}/shaders/DrawGrains.fs" "${CLOUDCOMPARE_DEST_FOLDER}/shaders/G3Point" 1) #mind the quotes!
|
||||||
|
|
||||||
@@ -59,38 +73,38 @@ target_sources(G3PointPlugin
|
|||||||
# git commit hash
|
# git commit hash
|
||||||
# Get the current working branch
|
# Get the current working branch
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git rev-parse --abbrev-ref HEAD
|
COMMAND git rev-parse --abbrev-ref HEAD
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_BRANCH_G3POINT
|
OUTPUT_VARIABLE GIT_BRANCH_G3POINT
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
# Get the latest commit hash
|
# Get the latest commit hash
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git rev-parse --short HEAD
|
COMMAND git rev-parse --short HEAD
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_COMMIT_HASH_G3POINT
|
OUTPUT_VARIABLE GIT_COMMIT_HASH_G3POINT
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
# Get the latest commit hash
|
# Get the latest commit hash
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git describe
|
COMMAND git describe
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_TAG_G3POINT
|
OUTPUT_VARIABLE GIT_TAG_G3POINT
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
# Get the current working branch
|
# Get the current working branch
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git rev-parse --abbrev-ref HEAD
|
COMMAND git rev-parse --abbrev-ref HEAD
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_BRANCH_CC
|
OUTPUT_VARIABLE GIT_BRANCH_CC
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
# Get the latest commit hash
|
# Get the latest commit hash
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git rev-parse --short HEAD
|
COMMAND git rev-parse --short HEAD
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_COMMIT_HASH_CC
|
OUTPUT_VARIABLE GIT_COMMIT_HASH_CC
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
message(${PROJECT_NAME} " " GIT_BRANCH_G3POINT " " ${GIT_BRANCH_G3POINT})
|
message(${PROJECT_NAME} " " GIT_BRANCH_G3POINT " " ${GIT_BRANCH_G3POINT})
|
||||||
message(${PROJECT_NAME} " " GIT_COMMIT_HASH_G3POINT " " ${GIT_COMMIT_HASH_G3POINT})
|
message(${PROJECT_NAME} " " GIT_COMMIT_HASH_G3POINT " " ${GIT_COMMIT_HASH_G3POINT})
|
||||||
@@ -100,12 +114,12 @@ target_sources(G3PointPlugin
|
|||||||
message(${PROJECT_NAME} " " QG3POINT_VERSION " " ${QG3POINT_PLUGIN_VERSION})
|
message(${PROJECT_NAME} " " QG3POINT_VERSION " " ${QG3POINT_PLUGIN_VERSION})
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
GIT_BRANCH_CC="${GIT_BRANCH_CC}"
|
GIT_BRANCH_CC="${GIT_BRANCH_CC}"
|
||||||
GIT_COMMMIT_HASH_CC="${GIT_COMMIT_HASH_CC}"
|
GIT_COMMMIT_HASH_CC="${GIT_COMMIT_HASH_CC}"
|
||||||
PUBLIC GIT_BRANCH_G3POINT="${GIT_BRANCH_G3POINT}"
|
PUBLIC GIT_BRANCH_G3POINT="${GIT_BRANCH_G3POINT}"
|
||||||
GIT_COMMMIT_HASH_G3POINT="${GIT_COMMIT_HASH_G3POINT}"
|
GIT_COMMMIT_HASH_G3POINT="${GIT_COMMIT_HASH_G3POINT}"
|
||||||
GIT_TAG_G3POINT="${GIT_TAG_G3POINT}"
|
GIT_TAG_G3POINT="${GIT_TAG_G3POINT}"
|
||||||
G3POINT_VERSION="${QG3POINT_PLUGIN_VERSION}"
|
G3POINT_VERSION="${QG3POINT_PLUGIN_VERSION}"
|
||||||
)
|
)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ private:
|
|||||||
bool updateLocalMaximumIndexes();
|
bool updateLocalMaximumIndexes();
|
||||||
bool updateLabelsAndColors();
|
bool updateLabelsAndColors();
|
||||||
bool checkStacks(const std::vector<std::vector<int>>& stacks, int count);
|
bool checkStacks(const std::vector<std::vector<int>>& stacks, int count);
|
||||||
void addToStackBraunWillett(int index, const Eigen::ArrayXi& delta, const Eigen::ArrayXi &Di, std::vector<int>& stack, int local_maximum);
|
void addToStackBraunWillett(int index, const Eigen::ArrayXi& delta, const Eigen::ArrayXi& Di, std::vector<int>& stack, int local_maximum);
|
||||||
int segmentLabelsBraunWillett();
|
int segmentLabelsBraunWillett();
|
||||||
void getNeighborsDistancesSlopes(unsigned index);
|
void getNeighborsDistancesSlopes(unsigned index, std::vector<char>& duplicates);
|
||||||
void computeNodeSurfaces();
|
void computeNodeSurfaces();
|
||||||
bool computeNormalsAndOrientThemWithCloudCompare();
|
bool computeNormalsAndOrientThemWithCloudCompare();
|
||||||
void orientNormals(const Eigen::Vector3d &sensorCenter);
|
void orientNormals(const Eigen::Vector3d &sensorCenter);
|
||||||
|
|||||||
+22
-8
@@ -1047,7 +1047,7 @@ void G3PointAction::fit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void G3PointAction::exportResults()
|
void G3PointAction::exportResults()
|
||||||
{
|
{
|
||||||
if (m_grainsAsEllipsoids)
|
if (m_grainsAsEllipsoids)
|
||||||
{
|
{
|
||||||
m_grainsAsEllipsoids->exportResultsAsCloud();
|
m_grainsAsEllipsoids->exportResultsAsCloud();
|
||||||
@@ -1648,7 +1648,7 @@ int G3PointAction::segmentLabelsBraunWillett()
|
|||||||
return nLabels;
|
return nLabels;
|
||||||
}
|
}
|
||||||
|
|
||||||
void G3PointAction::getNeighborsDistancesSlopes(unsigned index)
|
void G3PointAction::getNeighborsDistancesSlopes(unsigned index, std::vector<char>& duplicates)
|
||||||
{
|
{
|
||||||
const CCVector3* P = m_cloud->getPoint(index);
|
const CCVector3* P = m_cloud->getPoint(index);
|
||||||
|
|
||||||
@@ -1670,7 +1670,15 @@ void G3PointAction::getNeighborsDistancesSlopes(unsigned index)
|
|||||||
float distance = (*P - *neighbor).norm();
|
float distance = (*P - *neighbor).norm();
|
||||||
m_neighborsDistances(index, k) = distance;
|
m_neighborsDistances(index, k) = distance;
|
||||||
// compute the slope to the neighbor
|
// compute the slope to the neighbor
|
||||||
m_neighborsSlopes(index, k) = (P->z - neighbor->z) / distance;
|
if (distance != 0)
|
||||||
|
{
|
||||||
|
m_neighborsSlopes(index, k) = (P->z - neighbor->z) / distance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_neighborsSlopes(index, k) = 0.; // it is possible to have duplicates in the cloud
|
||||||
|
duplicates[index] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1810,7 +1818,7 @@ bool G3PointAction::computeNormalsWithOpen3D()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool G3PointAction::queryNeighbors(ccPointCloud* cloud, ccMainAppInterface* appInterface, bool useParallelStrategy)
|
bool G3PointAction::queryNeighbors(ccPointCloud* cloud, ccMainAppInterface* appInterface, bool useParallelStrategy)
|
||||||
{
|
{
|
||||||
QString errorStr;
|
QString errorStr;
|
||||||
|
|
||||||
ccProgressDialog progressDlg(true, appInterface->getMainWindow());
|
ccProgressDialog progressDlg(true, appInterface->getMainWindow());
|
||||||
@@ -1838,8 +1846,8 @@ bool G3PointAction::queryNeighbors(ccPointCloud* cloud, ccMainAppInterface* appI
|
|||||||
|
|
||||||
size_t nPoints = m_cloud->size();
|
size_t nPoints = m_cloud->size();
|
||||||
CCCoreLib::DgmOctree::NearestNeighboursSearchStruct nNSS;
|
CCCoreLib::DgmOctree::NearestNeighboursSearchStruct nNSS;
|
||||||
std::vector<unsigned> pointsIndexes;
|
std::vector<unsigned> pointsIndexes(nPoints);
|
||||||
pointsIndexes.resize(nPoints);
|
std::vector<char> duplicates(nPoints, 0);
|
||||||
|
|
||||||
if (useParallelStrategy)
|
if (useParallelStrategy)
|
||||||
{
|
{
|
||||||
@@ -1850,17 +1858,23 @@ bool G3PointAction::queryNeighbors(ccPointCloud* cloud, ccMainAppInterface* appI
|
|||||||
int threadCount = std::max(1, ccQtHelpers::GetMaxThreadCount() - 2);
|
int threadCount = std::max(1, ccQtHelpers::GetMaxThreadCount() - 2);
|
||||||
std::cout << "[query_neighbor] parallel strategy, thread count " << threadCount << std::endl;
|
std::cout << "[query_neighbor] parallel strategy, thread count " << threadCount << std::endl;
|
||||||
QThreadPool::globalInstance()->setMaxThreadCount(threadCount);
|
QThreadPool::globalInstance()->setMaxThreadCount(threadCount);
|
||||||
QtConcurrent::blockingMap(pointsIndexes, [=](int index){getNeighborsDistancesSlopes(index);});
|
QtConcurrent::blockingMap(pointsIndexes, [&](int index){getNeighborsDistancesSlopes(index, duplicates);});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//manually call the static per-point method!
|
//manually call the static per-point method!
|
||||||
for (unsigned i = 0; i < nPoints; ++i)
|
for (unsigned i = 0; i < nPoints; ++i)
|
||||||
{
|
{
|
||||||
getNeighborsDistancesSlopes(i);
|
getNeighborsDistancesSlopes(i, duplicates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto trueCount = std::count(duplicates.begin(), duplicates.end(), 1);
|
||||||
|
if (trueCount)
|
||||||
|
{
|
||||||
|
ccLog::Warning("[G3Point] You have duplicates (" + QString::number(trueCount) + "), the algorithm will continue but you may think of cleaning your cloud.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user