Unity教程合集iOSiOS之实用技术

ARKit从入门到精通(7)-ARCamera介绍

2017-06-12  本文已影响1440人  坤小

@interface ARCamera : NSObject <NSCopying>

/**
 4x4矩阵表示相机位置,同ARAnchor
 */
@property (nonatomic, readonly) matrix_float4x4 transform;

/**
相机方向(旋转)的矢量欧拉角
分别是x/y/z
 */
@property (nonatomic, readonly) vector_float3 eulerAngles;

/**
 相机追踪状态(在下方会有枚举值介绍)
 */
@property (nonatomic, readonly) ARTrackingState trackingState NS_REFINED_FOR_SWIFT;

/**
追踪运动类型
 */
@property (nonatomic, readonly) ARTrackingStateReason trackingStateReason NS_REFINED_FOR_SWIFT;

/**
相机曲率(笔者有点费解,反复揣摩应该是与焦距相关参数)
3x3矩阵
 fx 0   px
 0  fy  py
 0  0   1
 */
@property (nonatomic, readonly) matrix_float3x3 intrinsics;

/**
摄像头分辨率
 */
@property (nonatomic, readonly) CGSize imageResolution;

/**
投影矩阵
*/
@property (nonatomic, readonly) matrix_float4x4 projectionMatrix;

/**
创建相机投影矩阵
 */
- (matrix_float4x4)projectionMatrixWithViewportSize:(CGSize)viewportSize orientation:(UIInterfaceOrientation)orientation zNear:(CGFloat)zNear zFar:(CGFloat)zFar;

@end

//相机追踪状态枚举
typedef NS_ENUM(NSInteger, ARTrackingState) {
    
    /** 不被允许 */
    ARTrackingStateNotAvailable,
    
    /** 最小 */
    ARTrackingStateLimited,
    
    /** 正常. */
    ARTrackingStateNormal,
} NS_REFINED_FOR_SWIFT;

/**
 追踪运动类型
 */
API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos)
typedef NS_ENUM(NSInteger, ARTrackingStateReason) {
    /** 无. */
    ARTrackingStateReasonNone,
    
    /** 运动. */
    ARTrackingStateReasonExcessiveMotion,
    
    /** 脸部捕捉. */
    ARTrackingStateReasonInsufficientFeatures,
} NS_REFINED_FOR_SWIFT;

上一篇 下一篇

猜你喜欢

热点阅读