RealSense投影::CreateColorImageMappedToDepth返回Null,如果其中一个内部参数通

RealSense Projection::CreateColorImageMappedToDepth returns Null if one of the parameters internals were accessed through AcquireAccess

本文关键字:一个 内部 参数 返回 CreateColorImageMappedToDepth 投影 Null RealSense 如果      更新时间:2023-10-16

我想做的是修改通过PXCSManager::QuerySample()获取的深度图像,然后将其映射到以同样的方式获取的彩色图像。

这就是我要做的:

void SampleProcessor::CaptureFrame(PXCSenseManager* pxcsManager, const PXCCapture::Sample* sample, char lastCapturedCharacter) {
    defaultFilter(sample->depth, pxcsManager->QueryCaptureManager()->QueryDevice()->QueryDepthLowConfidenceValue());
    auto result = _projection->CreateColorImageMappedToDepth(timage, sample->color);
}
void SampleProcessor::defaultFilter(PXCImage * toFilter, const pxcF32 & defaultValue) {
    auto imageData = PXCImage::ImageData(); //Todo: think about removing duplication with save function. Alternative to python decorators?
    if (toFilter->AcquireAccess(PXCImage::ACCESS_READ_WRITE, PXCImage::PIXEL_FORMAT_DEPTH_F32, &imageData) < PXC_STATUS_NO_ERROR) {
        return;
    }
    filterDepth(imageData, toFilter->QueryInfo(), [](pxcF32) { return true; }, defaultValue);
    toFilter->ReleaseAccess(&imageData);
}

这里的"result"总是null。如果我将sample->depth, sample->color传递给投影,那么它将返回有效的图像。

我在这里做错了什么?

所以对于有同样问题的人:

我一直在用PXCImage::ACCESS_READ_WRITE称呼AcquireAccess(尽管PXCImage::ACCESS_WRITE也是如此)和PXCImage::PIXEL_FORMAT_DEPTH_F32

这将导致内部像素格式从默认转换为PIXEL_FORMAT_DEPTH_F32

似乎PXCProjection不与具有这种像素格式的图像一起工作(尽管它没有在文档中指定,或者至少我找不到任何提及这一点)。当使用这种像素格式的图像调用CreateColorImageMappedToDepth时,只返回nullptr。真有见地=/.

PXCProjection::QueryUVMap在相同的情况下返回STATUS_PARAM_UNSUPPORTED,这是更多的信息,并导致我尝试像素格式。

所以总结一下:你不应该使用PIXEL_FORMAT_DEPTH_F32作为PXCProjection参数的图像