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 minRange = metaNode.child("minConfidence").text().as_int();
|
||||||
int maxRange = metaNode.child("maxConfidence").text().as_int();
|
int maxRange = metaNode.child("maxConfidence").text().as_int();
|
||||||
const char* depthType = metaNode.child("depthType").text().as_string();
|
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),
|
return { ArType::GetFromHumanReadableName(type),
|
||||||
ArDepthFormat::GetFromAltName(depthType).value_or(ArDepthFormat::UNAVAILABLE),
|
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 {
|
return {
|
||||||
ArType::GetFromName(meta["Type"].Scalar()),
|
ArType::GetFromName(meta["Type"].Scalar()),
|
||||||
ArDepthFormat::GetFromName(meta["DepthType"].Scalar()).value_or(ArDepthFormat::UNAVAILABLE),
|
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 << "<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.min) << "</minConfidence>\n\t<maxConfidence>";
|
||||||
ss << static_cast<int>(confidenceRange.max) << "</maxConfidence>\n\t<depthType>";
|
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();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +97,8 @@ namespace OpenVulkano::AR
|
|||||||
ss << "Type: " << type.GetName() << "\nDepthType: " << depthFormat.GetName();
|
ss << "Type: " << type.GetName() << "\nDepthType: " << depthFormat.GetName();
|
||||||
ss << "\nMinConfidence: " << static_cast<int>(confidenceRange.min);
|
ss << "\nMinConfidence: " << static_cast<int>(confidenceRange.min);
|
||||||
ss << "\nMaxConfidence: " << static_cast<int>(confidenceRange.max);
|
ss << "\nMaxConfidence: " << static_cast<int>(confidenceRange.max);
|
||||||
|
ss << "\nResolution: \"(" << imageResolution.x << "," << imageResolution.y << ")\"";
|
||||||
|
ss << "\nFrameRate: " << frameRate;
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "AR/ArType.hpp"
|
#include "AR/ArType.hpp"
|
||||||
#include "AR/ArDepthFormat.hpp"
|
#include "AR/ArDepthFormat.hpp"
|
||||||
#include "Math/Range.hpp"
|
#include "Math/Range.hpp"
|
||||||
|
#include "Math/Math.hpp"
|
||||||
|
|
||||||
namespace OpenVulkano::AR
|
namespace OpenVulkano::AR
|
||||||
{
|
{
|
||||||
@@ -17,14 +18,16 @@ namespace OpenVulkano::AR
|
|||||||
ArType type;
|
ArType type;
|
||||||
ArDepthFormat depthFormat;
|
ArDepthFormat depthFormat;
|
||||||
Math::Range<uint8_t> confidenceRange;
|
Math::Range<uint8_t> confidenceRange;
|
||||||
|
Math::Vector2ui imageResolution;
|
||||||
|
float frameRate;
|
||||||
bool playback = false;
|
bool playback = false;
|
||||||
|
|
||||||
ArSessionMetadata() noexcept
|
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
|
ArSessionMetadata(ArType type, ArDepthFormat format, Math::Range<uint8_t> confRange, Math::Vector2ui resolution, float frameRate) noexcept
|
||||||
: type(type), depthFormat(format), confidenceRange(confRange)
|
: type(type), depthFormat(format), confidenceRange(confRange), imageResolution(resolution), frameRate(frameRate)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ArSessionMetadata(const std::string& dirPath);
|
ArSessionMetadata(const std::string& dirPath);
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
return capabilities;
|
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
|
//TODO resolution handling
|
||||||
}
|
}
|
||||||
LogFormat("Using video format", m_arConfig.videoFormat);
|
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];
|
m_arSession = [ARSession new];
|
||||||
|
|||||||
Reference in New Issue
Block a user