This commit is contained in:
Georg Hagen
2025-05-27 19:40:05 +02:00
parent f042c5f37a
commit bb65670f48
4 changed files with 14 additions and 8 deletions

View File

@@ -12,10 +12,10 @@
namespace OpenVulkano::AR
{
float ArFrame::GetConfidenceNormalisationFactor() const
{
return m_session->GetSessionMetadata().GetConfidenceNormalisationFactor();
}
ArFrame::ArFrame(const std::shared_ptr<ArSession>& session, size_t frameId)
: m_session(session), m_frameId(frameId)
, m_confidenceNormalisationFactor(session ? session->GetSessionMetadata().GetConfidenceNormalisationFactor() : 0.5f)
{}
void ArFrame::Save()
{

View File

@@ -107,14 +107,14 @@ namespace OpenVulkano::AR
std::shared_ptr<ArSession> m_session;
size_t m_frameId;
Scene::Texture* m_texture = nullptr;
const float m_confidenceNormalisationFactor;
bool m_saved = false;
bool m_highRes = false;
protected:
ArFrameMetadata frameMetadata;
ArFrame(const std::shared_ptr<ArSession>& session, size_t frameId) : m_session(session), m_frameId(frameId)
{}
ArFrame(const std::shared_ptr<ArSession>& session, size_t frameId);
public:
virtual ~ArFrame();
@@ -160,7 +160,7 @@ namespace OpenVulkano::AR
[[nodiscard]] virtual Math::Matrix4f GetCameraProjection(Math::Vector2f viewportSize, float near = 0.25f, float far = 250.0f) = 0;
[[nodiscard]] float GetConfidenceNormalisationFactor() const;
[[nodiscard]] float GetConfidenceNormalisationFactor() const { return m_confidenceNormalisationFactor; }
[[nodiscard]] float GetColorTemperature() const { return frameMetadata.lightColorTemp; };

View File

@@ -57,6 +57,7 @@ namespace OpenVulkano::AR::Playback
}
colorImgData.channels = ColorImg::RGBA; // TODO test if defaulting to NV12
colorImgData.Decode(Utils::ReadFile(imagePath));
SetColorImgInfo();
SetDepthImgInfo(dImage);
SetSaved();
}

View File

@@ -74,10 +74,15 @@ namespace OpenVulkano::AR::Playback
{
ColorImg img;
img.channels = ColorImg::RGBA; // TODO test if defaulting to NV12
ReadColorImage(img);
return img;
}
void ReadColorImage(ColorImg& img)
{
std::optional<std::pair<FileDescription, Array<char>>> file = ReadColorImageRaw();
img.Decode(file->second);
m_imgReadSize += 1000 + file.value().first.size;
return img;
}
std::optional<std::pair<FileDescription, Array<char>>> ReadColorImageRaw() { return m_archiveColor.GetNextFile(); }