Bring back true depth
This commit is contained in:
@@ -42,6 +42,10 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
{
|
{
|
||||||
return GetSize(arKitFrame.smoothedSceneDepth.depthMap);
|
return GetSize(arKitFrame.smoothedSceneDepth.depthMap);
|
||||||
}
|
}
|
||||||
|
if(arKitFrame.capturedDepthData)
|
||||||
|
{
|
||||||
|
return GetSize(arKitFrame.capturedDepthData.depthDataMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return { -1, -1 };
|
return { -1, -1 };
|
||||||
}
|
}
|
||||||
@@ -113,6 +117,15 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
m_depthImage.format = ArDepthFormat::METER_FP32;
|
m_depthImage.format = ArDepthFormat::METER_FP32;
|
||||||
m_depthImage.confidence.resolution = m_depthImage.depth.resolution;
|
m_depthImage.confidence.resolution = m_depthImage.depth.resolution;
|
||||||
}
|
}
|
||||||
|
else if (m_arKitFrame.capturedDepthData)
|
||||||
|
{
|
||||||
|
auto depthFormat = arKitFrame.capturedDepthData.depthDataType;
|
||||||
|
if (arKitFrame.capturedDepthData.depthDataType == kCVPixelFormatType_DepthFloat32) m_depthImage.format = ArDepthFormat::METER_FP32;
|
||||||
|
else if (arKitFrame.capturedDepthData.depthDataType == kCVPixelFormatType_DepthFloat16) m_depthImage.format = ArDepthFormat::METER_FP16;
|
||||||
|
else Logger::AR->info("Received depth frame with unsuported format: {} ({})",
|
||||||
|
depthFormat == kCVPixelFormatType_DisparityFloat16 ? "DisparityFloat16" : (depthFormat == kCVPixelFormatType_DisparityFloat32 ? "DisparityFloat32" : "Unknown"), depthFormat);
|
||||||
|
m_depthImage.confidence.resolution = { 1, 1 };
|
||||||
|
}
|
||||||
m_depthImage.intrinsic = frameMetadata.intrinsic.GetForResolution(m_depthImage.depth.resolution);
|
m_depthImage.intrinsic = frameMetadata.intrinsic.GetForResolution(m_depthImage.depth.resolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,6 +147,10 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
CVPixelBufferUnlockBaseAddress(m_arKitFrame.smoothedSceneDepth.depthMap, kCVPixelBufferLock_ReadOnly);
|
CVPixelBufferUnlockBaseAddress(m_arKitFrame.smoothedSceneDepth.depthMap, kCVPixelBufferLock_ReadOnly);
|
||||||
CVPixelBufferUnlockBaseAddress(m_arKitFrame.smoothedSceneDepth.confidenceMap, kCVPixelBufferLock_ReadOnly);
|
CVPixelBufferUnlockBaseAddress(m_arKitFrame.smoothedSceneDepth.confidenceMap, kCVPixelBufferLock_ReadOnly);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CVPixelBufferUnlockBaseAddress(m_arKitFrame.capturedDepthData.depthDataMap, kCVPixelBufferLock_ReadOnly);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[m_arKitFrame release];
|
[m_arKitFrame release];
|
||||||
}
|
}
|
||||||
@@ -184,6 +201,14 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
m_depthImage.confidence.data = CVPixelBufferGetBaseAddress(m_arKitFrame.smoothedSceneDepth.confidenceMap);
|
m_depthImage.confidence.data = CVPixelBufferGetBaseAddress(m_arKitFrame.smoothedSceneDepth.confidenceMap);
|
||||||
m_lockedDepth = true;
|
m_lockedDepth = true;
|
||||||
}
|
}
|
||||||
|
else if(m_arKitFrame.capturedDepthData)
|
||||||
|
{
|
||||||
|
CVPixelBufferLockBaseAddress(m_arKitFrame.capturedDepthData.depthDataMap, kCVPixelBufferLock_ReadOnly);
|
||||||
|
m_depthImage.depth.data = CVPixelBufferGetBaseAddress(m_arKitFrame.capturedDepthData.depthDataMap);
|
||||||
|
m_frameDepthQuality = static_cast<uint8_t>(m_arKitFrame.capturedDepthData.depthDataQuality) + static_cast<uint8_t>(m_arKitFrame.capturedDepthData.depthDataAccuracy);
|
||||||
|
m_depthImage.confidence.data = &m_frameDepthQuality;
|
||||||
|
m_lockedDepth = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return m_depthImage;
|
return m_depthImage;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
std::string SupportedVideoFormatsToString(bool frontCam)
|
std::string SupportedVideoFormatsToString(bool frontCam)
|
||||||
{
|
{
|
||||||
std::stringstream ss("[ ");
|
std::stringstream ss("[ ");
|
||||||
auto vidFormats = [ARWorldTrackingConfiguration supportedVideoFormats];
|
auto vidFormats = frontCam ? [ARFaceTrackingConfiguration supportedVideoFormats] : [ARWorldTrackingConfiguration supportedVideoFormats];
|
||||||
for (ARVideoFormat* format: vidFormats)
|
for (ARVideoFormat* format: vidFormats)
|
||||||
{
|
{
|
||||||
if (ss.tellp() > std::streampos(5)) ss << ", ";
|
if (ss.tellp() > std::streampos(5)) ss << ", ";
|
||||||
@@ -69,7 +69,13 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
: m_frameId(0)
|
: m_frameId(0)
|
||||||
{
|
{
|
||||||
m_arKitDelegate = [[ArKitDelegate alloc] initWithFrameHandler:this];
|
m_arKitDelegate = [[ArKitDelegate alloc] initWithFrameHandler:this];
|
||||||
|
if (config.useFrontCamera)
|
||||||
|
{
|
||||||
|
ARFaceTrackingConfiguration* arConfig = [ARFaceTrackingConfiguration new];
|
||||||
|
arConfig.worldTrackingEnabled = true;
|
||||||
|
m_arConfig = arConfig;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ARWorldTrackingConfiguration* arConfig = [ARWorldTrackingConfiguration new];
|
ARWorldTrackingConfiguration* arConfig = [ARWorldTrackingConfiguration new];
|
||||||
if (config.enableDepth)
|
if (config.enableDepth)
|
||||||
|
|||||||
Reference in New Issue
Block a user