修改了include文件位置,增加了version和名称
This commit is contained in:
parent
609330131c
commit
114170d248
@ -97,29 +97,45 @@ set(HOLE_DETECTION_SOURCES
|
||||
src/PlaneSegmentation.cpp
|
||||
)
|
||||
|
||||
set(HOLE_DETECTION_HEADERS
|
||||
src/HoleDetection.h
|
||||
src/GeometricFitting.h
|
||||
src/HoleDetectionParams.h
|
||||
src/ErrorCodes.h
|
||||
src/PlaneSegmentation.h
|
||||
include/VZNL_Types.h
|
||||
)
|
||||
set(HOLE_DETECTION_HEADERS
|
||||
include/HoleDetection.h
|
||||
src/GeometricFitting.h
|
||||
include/HoleDetectionParams.h
|
||||
include/ErrorCodes.h
|
||||
src/PlaneSegmentation.h
|
||||
include/VZNL_Types.h
|
||||
)
|
||||
|
||||
set(HOLE_DETECTION_EXPORT_HEADERS
|
||||
include/HoleDetection.h
|
||||
include/HoleDetectionParams.h
|
||||
include/ErrorCodes.h
|
||||
include/VZNL_Types.h
|
||||
)
|
||||
|
||||
# Create library as SHARED (dynamic library)
|
||||
add_library(HoleDetectionLib SHARED
|
||||
${HOLE_DETECTION_SOURCES}
|
||||
${HOLE_DETECTION_HEADERS}
|
||||
)
|
||||
add_library(HoleDetectionLib SHARED
|
||||
${HOLE_DETECTION_SOURCES}
|
||||
${HOLE_DETECTION_HEADERS}
|
||||
)
|
||||
|
||||
target_include_directories(HoleDetectionLib
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include/DetectHole>
|
||||
PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${EIGEN3_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
# Set library properties
|
||||
set_target_properties(HoleDetectionLib PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION 1
|
||||
PUBLIC_HEADER "${HOLE_DETECTION_HEADERS}"
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
VISIBILITY_INLINES_HIDDEN ON
|
||||
)
|
||||
set_target_properties(HoleDetectionLib PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION 1
|
||||
PUBLIC_HEADER "${HOLE_DETECTION_EXPORT_HEADERS}"
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
VISIBILITY_INLINES_HIDDEN ON
|
||||
)
|
||||
|
||||
# Set UTF-8 encoding for MSVC
|
||||
if(MSVC)
|
||||
@ -141,12 +157,12 @@ add_custom_command(TARGET HoleDetectionLib POST_BUILD
|
||||
)
|
||||
|
||||
# Copy each header file
|
||||
foreach(header ${HOLE_DETECTION_HEADERS})
|
||||
get_filename_component(header_name ${header} NAME)
|
||||
add_custom_command(TARGET HoleDetectionLib POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CMAKE_SOURCE_DIR}/${header}"
|
||||
"${EXPORT_INCLUDE_DIR}/${header_name}"
|
||||
foreach(header ${HOLE_DETECTION_EXPORT_HEADERS})
|
||||
get_filename_component(header_name ${header} NAME)
|
||||
add_custom_command(TARGET HoleDetectionLib POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CMAKE_SOURCE_DIR}/${header}"
|
||||
"${EXPORT_INCLUDE_DIR}/${header_name}"
|
||||
COMMENT "Copying ${header_name} to Export/include"
|
||||
)
|
||||
endforeach()
|
||||
@ -221,9 +237,9 @@ install(TARGETS HoleDetectionLib
|
||||
PUBLIC_HEADER DESTINATION include/DetectHole
|
||||
)
|
||||
|
||||
install(FILES ${HOLE_DETECTION_HEADERS}
|
||||
DESTINATION include/DetectHole
|
||||
)
|
||||
install(FILES ${HOLE_DETECTION_EXPORT_HEADERS}
|
||||
DESTINATION include/DetectHole
|
||||
)
|
||||
|
||||
# Enable testing
|
||||
enable_testing()
|
||||
|
||||
@ -16,12 +16,11 @@ if(MSVC)
|
||||
target_compile_options(PointCloudUtils PRIVATE /utf-8)
|
||||
endif()
|
||||
|
||||
# Include directories
|
||||
target_include_directories(PointCloudUtils PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
)
|
||||
# Include directories
|
||||
target_include_directories(PointCloudUtils PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
# Installation
|
||||
install(TARGETS PointCloudUtils
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#ifndef POINT_CLOUD_LOADER_H
|
||||
#define POINT_CLOUD_LOADER_H
|
||||
|
||||
#include "../../include/VZNL_Types.h"
|
||||
#include "../../src/ErrorCodes.h"
|
||||
#include "VZNL_Types.h"
|
||||
#include "ErrorCodes.h"
|
||||
|
||||
/**
|
||||
* @brief Load point cloud from TXT file
|
||||
|
||||
@ -195,11 +195,10 @@ if exist build\%BUILD_TYPE%\HoleDetectionLib.pdb (
|
||||
)
|
||||
|
||||
REM 复制头文件(仅复制库的公共 API 头文件)
|
||||
copy /Y src\HoleDetection.h Export\include\
|
||||
copy /Y src\GeometricFitting.h Export\include\
|
||||
copy /Y src\HoleDetectionParams.h Export\include\
|
||||
copy /Y src\ErrorCodes.h Export\include\
|
||||
copy /Y include\VZNL_Types.h Export\include\
|
||||
if exist include\HoleDetection.h copy /Y include\HoleDetection.h Export\include\
|
||||
if exist include\HoleDetectionParams.h copy /Y include\HoleDetectionParams.h Export\include\
|
||||
if exist include\ErrorCodes.h copy /Y include\ErrorCodes.h Export\include\
|
||||
if exist include\VZNL_Types.h copy /Y include\VZNL_Types.h Export\include\
|
||||
echo 已复制: 头文件 -^> Export\include\
|
||||
echo.
|
||||
|
||||
|
||||
@ -597,11 +597,15 @@ int main(int argc, char* argv[]) {
|
||||
// Set up detection parameters (using defaults from constructor)
|
||||
SHoleDetectionParams detectionParams;
|
||||
detectionParams.minRadius = 0.5f;
|
||||
detectionParams.angleThresholdPos = 50;
|
||||
detectionParams.angleThresholdNeg = -50;
|
||||
SHoleFilterParams filterParams;
|
||||
std::cout << "=== Hole Detection Visualization Demo ===" << std::endl;
|
||||
|
||||
const char* lpszVer = GetAlgorithmVersion();
|
||||
|
||||
const char* lpszName = GetAlgorithmName();
|
||||
|
||||
std::cout << "Algorithm: " << (lpszName ? lpszName : "Unknown") << "version: " << (lpszVer? lpszVer:"Unknown") << std::endl;
|
||||
|
||||
// Check if batch directory mode
|
||||
if (batchDir) {
|
||||
std::cout << "Mode: Batch Directory Processing" << std::endl;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include "HoleDetectionParams.h"
|
||||
#include "ErrorCodes.h"
|
||||
#include "../include/VZNL_Types.h"
|
||||
#include "VZNL_Types.h"
|
||||
|
||||
// Export macro for shared library
|
||||
#ifdef _WIN32
|
||||
@ -12,13 +12,13 @@
|
||||
#else
|
||||
#define HOLE_DETECTION_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#ifdef HOLE_DETECTION_EXPORTS
|
||||
#define HOLE_DETECTION_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define HOLE_DETECTION_API
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#ifdef HOLE_DETECTION_EXPORTS
|
||||
#define HOLE_DETECTION_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define HOLE_DETECTION_API
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Boundary point with grid location (for debug callbacks)
|
||||
@ -231,21 +231,33 @@ struct SHoleDetectionDebugCallbacks {
|
||||
* @post If return value is 0, result contains detected holes
|
||||
* @post Caller must free result->holes using delete[]
|
||||
*/
|
||||
HOLE_DETECTION_API int DetectMultipleHoles(
|
||||
const SVzNLPointXYZ* points,
|
||||
int rows,
|
||||
int cols,
|
||||
const SHoleDetectionParams& detectionParams,
|
||||
HOLE_DETECTION_API int DetectMultipleHoles(
|
||||
const SVzNLPointXYZ* points,
|
||||
int rows,
|
||||
int cols,
|
||||
const SHoleDetectionParams& detectionParams,
|
||||
const SHoleFilterParams& filterParams,
|
||||
SMultiHoleResult* result,
|
||||
const SHoleDetectionDebugCallbacks* debugCallbacks = nullptr
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Print detection results to console in a formatted way
|
||||
*
|
||||
* @param [in] result Detection result structure
|
||||
* @param [in] verbose If true, print detailed information for each hole
|
||||
SMultiHoleResult* result,
|
||||
const SHoleDetectionDebugCallbacks* debugCallbacks = nullptr
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Get algorithm name and version information
|
||||
*
|
||||
* Returned pointers refer to internal static strings and must not be freed
|
||||
* or modified by the caller. Either output parameter can be nullptr.
|
||||
*
|
||||
* @param [out] algorithmName Output algorithm name string
|
||||
* @param [out] algorithmVersion Output algorithm version string
|
||||
*/
|
||||
HOLE_DETECTION_API const char* GetAlgorithmVersion();
|
||||
HOLE_DETECTION_API const char* GetAlgorithmName();
|
||||
|
||||
/**
|
||||
* @brief Print detection results to console in a formatted way
|
||||
*
|
||||
* @param [in] result Detection result structure
|
||||
* @param [in] verbose If true, print detailed information for each hole
|
||||
*/
|
||||
HOLE_DETECTION_API void PrintDetectionResults(const SMultiHoleResult& result, bool verbose = true);
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
#define HOLE_DETECTION_PARAMS_H
|
||||
|
||||
#include <cmath>
|
||||
#include "../include/VZNL_Types.h" // 使用 VZNL_Types.h 中定义的类型
|
||||
#include "VZNL_Types.h" // 使用 VZNL_Types.h 中定义的类型
|
||||
|
||||
/**
|
||||
* @brief 孔洞检测算法的检测参数
|
||||
*/
|
||||
struct SHoleDetectionParams {
|
||||
// 凹坑检测参数
|
||||
float angleThresholdPos; // 正角度阈值,单位:度(默认值:30.0)
|
||||
float angleThresholdNeg; // 负角度阈值,单位:度(默认值:-30.0)
|
||||
float angleThresholdPos; // 正角度阈值,单位:度(默认值:50.0)
|
||||
float angleThresholdNeg; // 负角度阈值,单位:度(默认值:-50.0)
|
||||
float angleSearchDistance; // Method1 前后搜索距离 A,单位:mm
|
||||
float minPitDepth; // 最小凹坑深度,单位:mm(默认值:1.0)
|
||||
|
||||
@ -39,8 +39,8 @@ struct SHoleDetectionParams {
|
||||
|
||||
// 构造函数,设置默认值
|
||||
SHoleDetectionParams()
|
||||
: angleThresholdPos(30.0f)
|
||||
, angleThresholdNeg(-30.0f)
|
||||
: angleThresholdPos(50.0f)
|
||||
, angleThresholdNeg(-50.0f)
|
||||
, angleSearchDistance(2.0f)
|
||||
, minPitDepth(1.0f)
|
||||
, minRadius(2.0f)
|
||||
@ -11,6 +11,9 @@
|
||||
|
||||
namespace {
|
||||
|
||||
const static char* g_algo_name = "DetectHole";
|
||||
const static char* g_algo_ver = "1.0.0";
|
||||
|
||||
|
||||
void PrintHoleResult(const SHoleResult& hole, int index) {
|
||||
std::cout << "\nHole #" << index << ":" << std::endl;
|
||||
@ -368,6 +371,14 @@ int DetectMultipleHoles(
|
||||
return HD_SUCCESS;
|
||||
}
|
||||
|
||||
const char* GetAlgorithmVersion() {
|
||||
return g_algo_ver;
|
||||
}
|
||||
|
||||
const char* GetAlgorithmName() {
|
||||
return g_algo_name;
|
||||
}
|
||||
|
||||
void PrintDetectionResults(const SMultiHoleResult& result, bool verbose) {
|
||||
std::cout << "\n========== Detection Results ==========" << std::endl;
|
||||
std::cout << "Total candidates: " << result.totalCandidates << std::endl;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user