Add front camera field to ar recording

This commit is contained in:
Georg Hagen
2025-03-25 15:06:11 +01:00
parent 38a3b5ec69
commit 35097ea606
3 changed files with 10 additions and 25 deletions

View File

@@ -61,7 +61,7 @@ namespace OpenVulkano::AR
Math::Range<uint8_t>(meta["MinConfidence"].as<uint8_t>(), meta["MaxConfidence"].as<uint8_t>()),
meta["Resolution"].as<Math::Vector2ui>(), meta["FrameRate"].as<float>(60),
meta["Device"].as<std::string>("Unknown"), meta["OS"].as<std::string>("Unknown"),
meta["Version"].as<uint32_t>(2)
meta["Version"].as<uint32_t>(3)
};
auto recNode = meta["Recording"];
@@ -71,6 +71,7 @@ namespace OpenVulkano::AR
metadata.recFrameCount = recNode["FrameCount"].as<int64_t>(-1);
metadata.recSkippedFrames = recNode["SkippedFrames"].as<int32_t>(-1);
}
metadata.frontSensor = meta["FrontSensor"].as<bool>(false);
return metadata;
}
@@ -108,23 +109,6 @@ namespace OpenVulkano::AR
playback = true;
}
std::string ArSessionMetadata::ToXML() const
{
return fmt::format(R"(<arPlatformInfo>
<type>{}</type>
<minConfidence>{}</minConfidence>
<maxConfidence>{}</maxConfidence>
<depthType>{}</depthType>
<imageResolution><width>{}</width><height>{}</height></imageResolution>
<frameRate>{}</frameRate>
<device>{}</device>
<os>{}</os>
<version>{}</version>
</arPlatformInfo>)",
type.GetHumanReadableName(), static_cast<int>(confidenceRange.min), static_cast<int>(confidenceRange.max),
depthFormat.GetAltName(), imageResolution.x, imageResolution.y, frameRate, device, os, version);
}
std::string ArSessionMetadata::FinishedRecordingInfoToYaml() const
{
if (recFrameCount < 1 && recDuration < 1 && recSkippedFrames < 1) return "";
@@ -146,10 +130,11 @@ Resolution: '({},{})'
FrameRate: {}
Device: {}
OS: {}
FrontSensor: {}
Version: {}
{}
)",
type.GetName(), depthFormat.GetName(), static_cast<int>(confidenceRange.min), static_cast<int>(confidenceRange.max),
imageResolution.x, imageResolution.y, frameRate, device, os, version, FinishedRecordingInfoToYaml());
imageResolution.x, imageResolution.y, frameRate, device, os, frontSensor, version, FinishedRecordingInfoToYaml());
}
}

View File

@@ -31,6 +31,7 @@ namespace OpenVulkano::AR
int64_t recFrameCount;
int32_t recDuration, recSkippedFrames;
bool frontSensor;
bool playback = false;
ArSessionMetadata();
@@ -38,17 +39,15 @@ namespace OpenVulkano::AR
ArSessionMetadata(ArType type, ArDepthFormat format, Math::Range<uint8_t> confRange, Math::Vector2ui resolution, float frameRate);
ArSessionMetadata(ArType type, ArDepthFormat format, Math::Range<uint8_t> confRange, Math::Vector2ui resolution,
float frameRate, const std::string& device, const std::string& os, uint32_t version = 2,
int64_t frameCount = -1, int32_t duration = -1, int32_t skippedFrames = -1)
float frameRate, const std::string& device, const std::string& os, uint32_t version = 3,
int64_t frameCount = -1, int32_t duration = -1, int32_t skippedFrames = -1, bool frontSensor = false)
: type(type), depthFormat(format), confidenceRange(confRange), imageResolution(resolution)
, frameRate(frameRate), version(version), device(device), os(os)
, recFrameCount(frameCount), recDuration(duration), recSkippedFrames(skippedFrames), frontSensor(frontSensor)
{}
ArSessionMetadata(const std::filesystem::path& dirPath);
[[deprecated]]
[[nodiscard]] std::string ToXML() const;
[[nodiscard]] std::string ToYaml() const;
[[nodiscard]] std::string FinishedRecordingInfoToYaml() const;
@@ -64,4 +63,4 @@ namespace OpenVulkano::AR
static ArSessionMetadata FromYaml(const std::filesystem::path& filePath);
};
}
}

View File

@@ -139,6 +139,7 @@ namespace OpenVulkano::AR::ArKit
metadata.imageResolution = { m_arConfig.videoFormat.imageResolution.width, m_arConfig.videoFormat.imageResolution.height };
metadata.frameRate = m_arConfig.videoFormat.framesPerSecond;
}
metadata.frontSensor = config.useFrontCamera;
}
void ArSessionArKitInternal::SetRenderer(IRenderer* renderer)