Store image resolution and framerate in ar metadata
This commit is contained in:
@@ -22,9 +22,19 @@ namespace OpenVulkano::AR
|
||||
int minRange = metaNode.child("minConfidence").text().as_int();
|
||||
int maxRange = metaNode.child("maxConfidence").text().as_int();
|
||||
const char* depthType = metaNode.child("depthType").text().as_string();
|
||||
uint32_t resX = 1920, resY = 1440;
|
||||
auto resNode = metaNode.child("imageResolution");
|
||||
if (!resNode.empty())
|
||||
{
|
||||
resX = resNode.child("width").text().as_uint();
|
||||
resY = resNode.child("height").text().as_uint();
|
||||
}
|
||||
float frameRate = metaNode.child("frameRate").text().as_float(60);
|
||||
return { ArType::GetFromHumanReadableName(type),
|
||||
ArDepthFormat::GetFromAltName(depthType).value_or(ArDepthFormat::UNAVAILABLE),
|
||||
Math::Range<uint8_t>(minRange, maxRange)
|
||||
Math::Range<uint8_t>(minRange, maxRange),
|
||||
Math::Vector2ui(resX, resY),
|
||||
frameRate
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,7 +45,9 @@ namespace OpenVulkano::AR
|
||||
return {
|
||||
ArType::GetFromName(meta["Type"].Scalar()),
|
||||
ArDepthFormat::GetFromName(meta["DepthType"].Scalar()).value_or(ArDepthFormat::UNAVAILABLE),
|
||||
Math::Range<uint8_t>(meta["MinConfidence"].as<uint8_t>(), meta["MaxConfidence"].as<uint8_t>())
|
||||
Math::Range<uint8_t>(meta["MinConfidence"].as<uint8_t>(), meta["MaxConfidence"].as<uint8_t>()),
|
||||
Math::Vector2ui(1), // TODO load
|
||||
meta["FrameRate"].as<float>(60)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -72,7 +84,10 @@ namespace OpenVulkano::AR
|
||||
ss << "<arPlatformInfo>\n\t<type>" << type.GetHumanReadableName() << "</type>\n\t<minConfidence>";
|
||||
ss << static_cast<int>(confidenceRange.min) << "</minConfidence>\n\t<maxConfidence>";
|
||||
ss << static_cast<int>(confidenceRange.max) << "</maxConfidence>\n\t<depthType>";
|
||||
ss << depthFormat.GetAltName() << "</depthType>\n</arPlatformInfo>";
|
||||
ss << depthFormat.GetAltName() << "</depthType>";
|
||||
ss << "\n\t<imageResolution><width>" << imageResolution.x << "</width><height>" << imageResolution.y << "</height></imageResolution>";
|
||||
ss << "\n\t<frameRate>" << frameRate << "</frameRate>";
|
||||
ss << "\n</arPlatformInfo>";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
@@ -82,6 +97,8 @@ namespace OpenVulkano::AR
|
||||
ss << "Type: " << type.GetName() << "\nDepthType: " << depthFormat.GetName();
|
||||
ss << "\nMinConfidence: " << static_cast<int>(confidenceRange.min);
|
||||
ss << "\nMaxConfidence: " << static_cast<int>(confidenceRange.max);
|
||||
ss << "\nResolution: \"(" << imageResolution.x << "," << imageResolution.y << ")\"";
|
||||
ss << "\nFrameRate: " << frameRate;
|
||||
return ss.str();
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "AR/ArType.hpp"
|
||||
#include "AR/ArDepthFormat.hpp"
|
||||
#include "Math/Range.hpp"
|
||||
#include "Math/Math.hpp"
|
||||
|
||||
namespace OpenVulkano::AR
|
||||
{
|
||||
@@ -17,14 +18,16 @@ namespace OpenVulkano::AR
|
||||
ArType type;
|
||||
ArDepthFormat depthFormat;
|
||||
Math::Range<uint8_t> confidenceRange;
|
||||
Math::Vector2ui imageResolution;
|
||||
float frameRate;
|
||||
bool playback = false;
|
||||
|
||||
ArSessionMetadata() noexcept
|
||||
: ArSessionMetadata(ArType::UNKNOWN, ArDepthFormat::UNAVAILABLE, {0,0})
|
||||
: ArSessionMetadata(ArType::UNKNOWN, ArDepthFormat::UNAVAILABLE, {0,0}, { 1920, 1440 }, 60)
|
||||
{}
|
||||
|
||||
ArSessionMetadata(ArType type, ArDepthFormat format, Math::Range<uint8_t> confRange) noexcept
|
||||
: type(type), depthFormat(format), confidenceRange(confRange)
|
||||
ArSessionMetadata(ArType type, ArDepthFormat format, Math::Range<uint8_t> confRange, Math::Vector2ui resolution, float frameRate) noexcept
|
||||
: type(type), depthFormat(format), confidenceRange(confRange), imageResolution(resolution), frameRate(frameRate)
|
||||
{}
|
||||
|
||||
ArSessionMetadata(const std::string& dirPath);
|
||||
|
||||
@@ -35,6 +35,6 @@ namespace OpenVulkano::AR::ArKit
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
ArSessionArKit::ArSessionArKit() : ArSession({ ArType::AR_KIT, ArDepthFormat::METER_FP32, { 0, 2 } })
|
||||
ArSessionArKit::ArSessionArKit() : ArSession({ ArType::AR_KIT, ArDepthFormat::METER_FP32, { 0, 2 }, { 1920, 1440 }, 60 })
|
||||
{}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ namespace OpenVulkano::AR::ArKit
|
||||
//TODO resolution handling
|
||||
}
|
||||
LogFormat("Using video format", m_arConfig.videoFormat);
|
||||
metadata.imageResolution = { m_arConfig.videoFormat.imageResolution.width, m_arConfig.videoFormat.imageResolution.height };
|
||||
metadata.frameRate = m_arConfig.videoFormat.framesPerSecond;
|
||||
}
|
||||
|
||||
m_arSession = [ARSession new];
|
||||
|
||||
Reference in New Issue
Block a user