Fix xmp create date

This commit is contained in:
Georg Hagen
2025-02-14 12:03:45 +01:00
parent 496807b616
commit c3b23734d1
3 changed files with 9 additions and 1 deletions

View File

@@ -126,7 +126,7 @@ namespace OpenVulkano::AR
auto exif = exifBuilder.Build();
Image::XmpBuilder xmpBuilder;
xmpBuilder.SetPose(arFrame->GetPose());
xmpBuilder.SetCreateDate(exifBuilder.dateTaken); //TODO
xmpBuilder.SetCreateDateNow();
xmpBuilder.SetExposureTime(arFrame->GetExposureTime());
xmpBuilder.SetFocalLength(arFrame->GetFocalLength());
xmpBuilder.SetCameraIntrinsic(arFrame->GetCameraIntrinsic());

View File

@@ -95,6 +95,13 @@ namespace OpenVulkano::Image
return *this;
}
[[maybe_unused]] XmpBuilder& XmpBuilder::SetCreateDateNow()
{
std::chrono::system_clock::now();
std::time_t currentTime = std::chrono::system_clock::to_time_t(now);
SetCreateDate(currentTime);
}
[[maybe_unused]] XmpBuilder& XmpBuilder::SetCreateDate(const std::time_t time)
{
return SetCreateDate(fmt::format("{:%FT%T%Ez}", fmt::localtime(time)));

View File

@@ -28,6 +28,7 @@ namespace OpenVulkano::Image
[[maybe_unused]] XmpBuilder& SetFocalLength(float focalLengthMM);
[[maybe_unused]] XmpBuilder& SetExposureTime(double exposureTime);
[[maybe_unused]] XmpBuilder& SetCreateDateNow();
[[maybe_unused]] XmpBuilder& SetCreateDate(const std::time_t time);
[[maybe_unused]] XmpBuilder& SetCreateDate(const std::string& createDate);