Expand ar frame metadata with focal length and fnumber
This commit is contained in:
@@ -166,10 +166,16 @@ namespace OpenVulkano::AR
|
|||||||
|
|
||||||
[[nodiscard]] float GetExposureOffset() const { return frameMetadata.exposureOffset; };
|
[[nodiscard]] float GetExposureOffset() const { return frameMetadata.exposureOffset; };
|
||||||
|
|
||||||
|
[[nodiscard]] float GetFocalLength() const { return frameMetadata.focalLength; }
|
||||||
|
|
||||||
|
[[nodiscard]] float GetFNumber() const { return frameMetadata.fNumber; }
|
||||||
|
|
||||||
[[nodiscard]] bool IsSaved() const { return m_saved; };
|
[[nodiscard]] bool IsSaved() const { return m_saved; };
|
||||||
|
|
||||||
[[nodiscard]] const Scene::Texture* GetImageTexture();
|
[[nodiscard]] const Scene::Texture* GetImageTexture();
|
||||||
|
|
||||||
|
[[nodiscard]] virtual std::string GetLensModel() const { return ""; }
|
||||||
|
|
||||||
void Save();
|
void Save();
|
||||||
|
|
||||||
void SaveToFile(const std::filesystem::path& path, bool downsample = false);
|
void SaveToFile(const std::filesystem::path& path, bool downsample = false);
|
||||||
|
|||||||
@@ -109,6 +109,8 @@ namespace OpenVulkano::AR
|
|||||||
frameData.intrinsic = {intrinsic, res};
|
frameData.intrinsic = {intrinsic, res};
|
||||||
camNode["ExposureDuration"] >> frameData.exposureTime;
|
camNode["ExposureDuration"] >> frameData.exposureTime;
|
||||||
camNode["ExposureOffset"] >> frameData.exposureOffset;
|
camNode["ExposureOffset"] >> frameData.exposureOffset;
|
||||||
|
camNode["FocalLength"] >> frameData.focalLength;
|
||||||
|
camNode["FNumber"] >> frameData.fNumber;
|
||||||
uint64_t nanos;
|
uint64_t nanos;
|
||||||
root["Timestamp"] >> nanos;
|
root["Timestamp"] >> nanos;
|
||||||
frameData.timestamp = nanos;
|
frameData.timestamp = nanos;
|
||||||
@@ -145,6 +147,8 @@ namespace OpenVulkano::AR
|
|||||||
- [ {}, {}, {} ]
|
- [ {}, {}, {} ]
|
||||||
ExposureDuration: {}
|
ExposureDuration: {}
|
||||||
ExposureOffset: {}
|
ExposureOffset: {}
|
||||||
|
FocalLength: {}
|
||||||
|
FNumber: {}
|
||||||
Timestamp: {}
|
Timestamp: {}
|
||||||
TimestampDepth: {}
|
TimestampDepth: {}
|
||||||
TrackingState:
|
TrackingState:
|
||||||
@@ -165,7 +169,8 @@ Light:
|
|||||||
camMat[0][0], camMat[1][0], camMat[2][0],
|
camMat[0][0], camMat[1][0], camMat[2][0],
|
||||||
camMat[0][1], camMat[1][1], camMat[2][1],
|
camMat[0][1], camMat[1][1], camMat[2][1],
|
||||||
camMat[0][2], camMat[1][2], camMat[2][2],
|
camMat[0][2], camMat[1][2], camMat[2][2],
|
||||||
exposureTime, exposureOffset, timestamp.GetNanos(), timestampDepth.GetNanos(),
|
exposureTime, exposureOffset, focalLength, fNumber,
|
||||||
|
timestamp.GetNanos(), timestampDepth.GetNanos(),
|
||||||
trackingState.GetName(), lightIntensity, lightColorTemp
|
trackingState.GetName(), lightIntensity, lightColorTemp
|
||||||
);
|
);
|
||||||
return meta;
|
return meta;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenVulkano::AR
|
|||||||
float exposureTime, exposureOffset, lightIntensity, lightColorTemp;
|
float exposureTime, exposureOffset, lightIntensity, lightColorTemp;
|
||||||
Math::Timestamp timestamp, timestampDepth;
|
Math::Timestamp timestamp, timestampDepth;
|
||||||
ArTrackingState trackingState;
|
ArTrackingState trackingState;
|
||||||
float physicalPixelSize = 0;
|
float physicalPixelSize = 0, focalLength = 0, fNumber = 0;
|
||||||
|
|
||||||
[[nodiscard]] std::string ToYaml() const;
|
[[nodiscard]] std::string ToYaml() const;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
|
|
||||||
bool GetCameraImageAsJpeg(const std::function<void(const char*, size_t)>& handler) override;
|
bool GetCameraImageAsJpeg(const std::function<void(const char*, size_t)>& handler) override;
|
||||||
|
|
||||||
|
std::string GetLensModel() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ARFrame* m_arKitFrame;
|
ARFrame* m_arKitFrame;
|
||||||
bool m_lockedColor, m_lockedDepth;
|
bool m_lockedColor, m_lockedDepth;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#import <ARKit/ARLightEstimate.h>
|
#import <ARKit/ARLightEstimate.h>
|
||||||
#import <ARKit/ARPointCloud.h>
|
#import <ARKit/ARPointCloud.h>
|
||||||
#import <CoreVideo/CoreVideo.h>
|
#import <CoreVideo/CoreVideo.h>
|
||||||
|
#import <ImageIO/CGImageProperties.h>
|
||||||
|
|
||||||
namespace OpenVulkano::AR::ArKit
|
namespace OpenVulkano::AR::ArKit
|
||||||
{
|
{
|
||||||
@@ -88,6 +89,12 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
frameData.timestampDepth = arFrame.capturedDepthDataTimestamp;
|
frameData.timestampDepth = arFrame.capturedDepthDataTimestamp;
|
||||||
frameData.trackingState = GetArTrackingState(arFrame.camera);
|
frameData.trackingState = GetArTrackingState(arFrame.camera);
|
||||||
|
|
||||||
|
if (@available(iOS 16.0, *))
|
||||||
|
{
|
||||||
|
frameData.focalLength = [(NSNumber*)[arFrame.exifData valueForKey:(__bridge NSString*)kCGImagePropertyExifFocalLength] floatValue];
|
||||||
|
frameData.fNumber = [(NSNumber*)[arFrame.exifData valueForKey:(__bridge NSString*)kCGImagePropertyExifFNumber] floatValue];
|
||||||
|
}
|
||||||
|
|
||||||
return frameData;
|
return frameData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,4 +243,13 @@ namespace OpenVulkano::AR::ArKit
|
|||||||
[image release];
|
[image release];
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ArFrameArKit::GetLensModel() const
|
||||||
|
{
|
||||||
|
if (@available(iOS 16.0, *))
|
||||||
|
{
|
||||||
|
return [[m_arKitFrame.exifData valueForKey:(__bridge NSString*)kCGImagePropertyExifLensModel] UTF8String];
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user