Software Archive
Read-only legacy content
17061 Discussions

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

Vladyslav_S_
Beginner
409 Views

Hi, what I'm trying to do is to modify depth image acquired through PXCSManager::QuerySample() and then map it to color image acquired in the same way.

So this is what I'm doing:

 

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);
}

 

And "result" here is always null. If I pass to projection just sample->depth, sample->color then it returns valid image.

What am I doing wrong here?

 

0 Kudos
2 Replies
Vladyslav_S_
Beginner
409 Views

So for anyone with the same trouble:

I've been calling AcquireAccess with PXCImage::ACCESS_READ_WRITE (though the same true for PXCImage::ACCESS_WRITE) and PXCImage::PIXEL_FORMAT_DEPTH_F32. 

This were causing internal pixel format to be transformed from default to PIXEL_FORMAT_DEPTH_F32.

And it seems that PXCProjection is not working with the images that have this pixel format (though it's not specified in documentation, or at least I can't find any mentioning of this). And CreateColorImageMappedToDepth just returns nullptr when called with the image with this pixel format. Which is really informative =/.

PXCProjection::QueryUVMap in same situation returns STATUS_PARAM_UNSUPPORTED which is a bit more informative and led me to experimenting with pixel format.

So to sum it up: you should not use images with PIXEL_FORMAT_DEPTH_F32 as parameters to PXCProjection.

0 Kudos
Dmitry_Z_Intel
Employee
409 Views

Hi Vladyslav,

Thanks for your feedback. The functionality which allows to use PIXEL_FORMAT_DEPTH_F32 image as a parameters to PXCProjection was implemented and will be available in a future release of the SDK.

0 Kudos
Reply