67 lines
2.1 KiB
C++
67 lines
2.1 KiB
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "AR/ArType.hpp"
|
|
#include "AR/ArDepthFormat.hpp"
|
|
#include "Math/Range.hpp"
|
|
#include "Math/Math.hpp"
|
|
#include <filesystem>
|
|
|
|
namespace OpenVulkano::AR
|
|
{
|
|
struct ArSessionMetadata
|
|
{
|
|
static constexpr std::string_view RECORDING_METADATA_FILENAME = "ArRecording.yml";
|
|
static constexpr std::string_view RECORDING_METADATA_FILENAME_XML = "ArRecording.xml";
|
|
static constexpr std::string_view RECORDING_METADATA_FILENAME_INFO = "arType.info";
|
|
|
|
ArType type;
|
|
ArDepthFormat depthFormat;
|
|
Math::Range<uint8_t> confidenceRange;
|
|
Math::Vector2ui imageResolution;
|
|
float frameRate;
|
|
uint32_t version;
|
|
std::string device, os;
|
|
// Recording info
|
|
int64_t recFrameCount;
|
|
int32_t recDuration, recSkippedFrames;
|
|
|
|
bool playback = false;
|
|
|
|
ArSessionMetadata();
|
|
|
|
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)
|
|
: type(type), depthFormat(format), confidenceRange(confRange), imageResolution(resolution)
|
|
, frameRate(frameRate), version(version), device(device), os(os)
|
|
{}
|
|
|
|
ArSessionMetadata(const std::filesystem::path& dirPath);
|
|
|
|
[[deprecated]]
|
|
[[nodiscard]] std::string ToXML() const;
|
|
|
|
[[nodiscard]] std::string ToYaml() const;
|
|
|
|
[[nodiscard]] std::string FinishedRecordingInfoToYaml() const;
|
|
|
|
[[nodiscard]] float GetConfidenceNormalisationFactor() const
|
|
{
|
|
return 1.0f / static_cast<float>(confidenceRange.max);
|
|
}
|
|
|
|
static bool DirHasMetadata(const std::filesystem::path& dirPath);
|
|
|
|
static ArSessionMetadata FromXML(const std::filesystem::path& filePath);
|
|
|
|
static ArSessionMetadata FromYaml(const std::filesystem::path& filePath);
|
|
};
|
|
} |