fix: accept raw full-frame image dimensions
This commit is contained in:
parent
3cae03037b
commit
7bf543ec0a
@ -1055,17 +1055,6 @@ bool VizumCamera::CaptureFullFrameLeftImage(SLImage& image, std::string& frameId
|
||||
return false;
|
||||
}
|
||||
|
||||
SVzVideoResolution resolution{};
|
||||
ret = VzNL_GetResolution(m_deviceHandle, &resolution);
|
||||
if (ret != 0 || resolution.nFrameWidth == 0 || resolution.nFrameHeight == 0) {
|
||||
char errorMsg[256] = {0};
|
||||
VzNL_GetErrorInfo(ret, errorMsg);
|
||||
LOG_ERROR("[VizumCamera] Full-frame capture cannot read device resolution: {} "
|
||||
"(error code: {}, size={}x{})", errorMsg, ret,
|
||||
resolution.nFrameWidth, resolution.nFrameHeight);
|
||||
return false;
|
||||
}
|
||||
|
||||
OutputRoiModeRestoreGuard outputModeGuard(m_deviceHandle);
|
||||
if (!outputModeGuard.IsReady())
|
||||
return false;
|
||||
@ -1091,16 +1080,15 @@ bool VizumCamera::CaptureFullFrameLeftImage(SLImage& image, std::string& frameId
|
||||
const bool rightReleased = rightImageGuard.ReleaseNow();
|
||||
const bool imagesReleased = leftReleased && rightReleased;
|
||||
|
||||
const bool exactFullFrame = converted
|
||||
&& image.originX == 0 && image.originY == 0
|
||||
&& image.width == resolution.nFrameWidth
|
||||
&& image.height == resolution.nFrameHeight;
|
||||
if (converted && !exactFullFrame) {
|
||||
LOG_ERROR("[VizumCamera] SDK output-mode switch did not return an exact full frame; "
|
||||
"capture rejected without zero-padding: image={}x{} origin=({}, {}), "
|
||||
"device={}x{}",
|
||||
image.width, image.height, image.originX, image.originY,
|
||||
resolution.nFrameWidth, resolution.nFrameHeight);
|
||||
// CalibROI=false returns the raw eye frame (for example 1216x1920), while
|
||||
// VzNL_GetResolution may report the calibrated output canvas (for example
|
||||
// 1336x2115). They are different coordinate spaces and must not be compared.
|
||||
const bool validFullFrame = converted && !image.empty()
|
||||
&& image.originX == 0 && image.originY == 0;
|
||||
if (converted && !validFullFrame) {
|
||||
LOG_ERROR("[VizumCamera] Raw full-frame image has an invalid origin or empty payload: "
|
||||
"image={}x{} origin=({}, {})",
|
||||
image.width, image.height, image.originX, image.originY);
|
||||
}
|
||||
|
||||
const bool imageModesRestored = outputModeGuard.RestoreNow();
|
||||
@ -1135,7 +1123,7 @@ bool VizumCamera::CaptureFullFrameLeftImage(SLImage& image, std::string& frameId
|
||||
currentRightROI.top, currentRightROI.bottom);
|
||||
}
|
||||
|
||||
if (!exactFullFrame || !imagesReleased || !imageModesRestored || !roiUnchanged) {
|
||||
if (!validFullFrame || !imagesReleased || !imageModesRestored || !roiUnchanged) {
|
||||
image.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -129,9 +129,9 @@ public:
|
||||
|
||||
/**
|
||||
* @brief 不修改检测 ROI,临时关闭 CalibROI/ROI输出并采集真实全幅左目图像
|
||||
* @param[out] image SDK 原始返回的设备全分辨率图像(原点必须为(0,0))
|
||||
* @param[out] image SDK 原始返回的全幅眼图(CalibROI=false 坐标系,原点必须为(0,0))
|
||||
* @param[out] frameId 本次采集帧编号
|
||||
* @return 采集、SDK 图像释放、精确全幅校验、模式恢复及检测 ROI 未变化校验是否全部成功
|
||||
* @return 采集、SDK 图像释放、全幅原点校验、模式恢复及检测 ROI 未变化校验是否全部成功
|
||||
* @note 检测 ROI 始终只读;任何失败路径都会恢复原 CalibROI 和 ROI 图输出模式
|
||||
*/
|
||||
bool CaptureFullFrameLeftImage(SLImage& image, std::string& frameId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user