feat: expose read-only detection ROI
This commit is contained in:
parent
953921c684
commit
ee4a6625eb
@ -1624,10 +1624,45 @@ bool VizumCamera::SetConfig(const std::string& configJson)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VizumCamera::GetDetectROI(ROIRect& leftROI, ROIRect& rightROI)
|
||||
{
|
||||
#ifdef ENABLE_VIZUM_CAMERA
|
||||
const std::lock_guard<std::mutex> deviceLock(m_deviceAccessMutex);
|
||||
if (!m_isConnected || !m_deviceHandle) {
|
||||
LOG_WARN("[VizumCamera] GetDetectROI failed: device not connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
SVzNLROIRect sdkLeft{};
|
||||
SVzNLROIRect sdkRight{};
|
||||
const int ret = VzNL_GetConfigDetectROI(m_deviceHandle, &sdkLeft, &sdkRight);
|
||||
if (ret != 0) {
|
||||
char errorMsg[256] = {0};
|
||||
VzNL_GetErrorInfo(ret, errorMsg);
|
||||
LOG_ERROR("[VizumCamera] VzNL_GetConfigDetectROI failed: {} (error code: {})",
|
||||
errorMsg, ret);
|
||||
return false;
|
||||
}
|
||||
|
||||
leftROI = {sdkLeft.left, sdkLeft.right, sdkLeft.top, sdkLeft.bottom};
|
||||
rightROI = {sdkRight.left, sdkRight.right, sdkRight.top, sdkRight.bottom};
|
||||
LOG_INFO("[VizumCamera] Detect ROI read only: left=[{}, {}, {}, {}], "
|
||||
"right=[{}, {}, {}, {}]",
|
||||
leftROI.left, leftROI.right, leftROI.top, leftROI.bottom,
|
||||
rightROI.left, rightROI.right, rightROI.top, rightROI.bottom);
|
||||
return true;
|
||||
#else
|
||||
(void)leftROI;
|
||||
(void)rightROI;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VizumCamera::SetCalibROIEnabled(bool enable)
|
||||
{
|
||||
#ifdef ENABLE_VIZUM_CAMERA
|
||||
if (!m_deviceHandle) {
|
||||
const std::lock_guard<std::mutex> deviceLock(m_deviceAccessMutex);
|
||||
if (!m_isConnected || !m_deviceHandle) {
|
||||
LOG_WARN("[VizumCamera] SetCalibROIEnabled({}) failed: device not connected", enable);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -14,6 +14,13 @@
|
||||
|
||||
namespace StructuredLight {
|
||||
|
||||
struct ROIRect {
|
||||
int left = 0;
|
||||
int right = 0;
|
||||
int top = 0;
|
||||
int bottom = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 伟景智能 Vizum 结构光相机实现类
|
||||
*/
|
||||
@ -128,6 +135,14 @@ public:
|
||||
*/
|
||||
bool SetCalibROIEnabled(bool enable);
|
||||
|
||||
/**
|
||||
* @brief 读取当前左右目检测 ROI,不修改相机配置
|
||||
* @param[out] leftROI 左目检测 ROI(全幅图坐标)
|
||||
* @param[out] rightROI 右目检测 ROI(全幅图坐标)
|
||||
* @return 是否成功
|
||||
*/
|
||||
bool GetDetectROI(ROIRect& leftROI, ROIRect& rightROI);
|
||||
|
||||
/**
|
||||
* @brief 启动自动检测模式进行摆镜扫描采集点云
|
||||
* @param[out] pointCloud 输出点云
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user