CameraParameters Class

Description

Camera parameters, including image size, focal length, principal point, camera type and camera rotation against natural orientation.

Constructor

C

void easyar_CameraParameters__ctor(easyar_Vec2I imageSize, easyar_Vec2F focalLength, easyar_Vec2F principalPoint, easyar_CameraDeviceType cameraDeviceType, int cameraOrientation, easyar_CameraParameters * * Return)

C++

CameraParameters(Vec2I imageSize, Vec2F focalLength, Vec2F principalPoint, CameraDeviceType cameraDeviceType, int cameraOrientation)

Java

public CameraParameters(@Nonnull Vec2I imageSize, @Nonnull Vec2F focalLength, @Nonnull Vec2F principalPoint, int cameraDeviceType, int cameraOrientation)

Kotlin

constructor(imageSize: Vec2I, focalLength: Vec2F, principalPoint: Vec2F, cameraDeviceType: Int, cameraOrientation: Int)

Objective-C

+ (easyar_CameraParameters *) create:(easyar_Vec2I *)imageSize focalLength:(easyar_Vec2F *)focalLength principalPoint:(easyar_Vec2F *)principalPoint cameraDeviceType:(easyar_CameraDeviceType)cameraDeviceType cameraOrientation:(int)cameraOrientation

Swift

public convenience init(_ imageSize: Vec2I, _ focalLength: Vec2F, _ principalPoint: Vec2F, _ cameraDeviceType: CameraDeviceType, _ cameraOrientation: Int32)

C#

public CameraParameters(Vec2I imageSize, Vec2F focalLength, Vec2F principalPoint, CameraDeviceType cameraDeviceType, int cameraOrientation)

size

Image size.

C

easyar_Vec2I easyar_CameraParameters_size(const easyar_CameraParameters * This)

C++

Vec2I size()

Java

public @Nonnull Vec2I size()

Kotlin

fun size(): Vec2I

Objective-C

- (easyar_Vec2I *)size

Swift

public func size() -> Vec2I

C#

public virtual Vec2I size()

focalLength

Focal length, the distance from effective optical center to CCD plane, divided by unit pixel density in width and height directions. The unit is pixel.

C

easyar_Vec2F easyar_CameraParameters_focalLength(const easyar_CameraParameters * This)

C++

Vec2F focalLength()

Java

public @Nonnull Vec2F focalLength()

Kotlin

fun focalLength(): Vec2F

Objective-C

- (easyar_Vec2F *)focalLength

Swift

public func focalLength() -> Vec2F

C#

public virtual Vec2F focalLength()

principalPoint

Principal point, coordinates of the intersection point of principal axis on CCD plane against the left-top corner of the image. The unit is pixel.

C

easyar_Vec2F easyar_CameraParameters_principalPoint(const easyar_CameraParameters * This)

C++

Vec2F principalPoint()

Java

public @Nonnull Vec2F principalPoint()

Kotlin

fun principalPoint(): Vec2F

Objective-C

- (easyar_Vec2F *)principalPoint

Swift

public func principalPoint() -> Vec2F

C#

public virtual Vec2F principalPoint()

cameraDeviceType

Camera device type. Default, back or front camera. On desktop devices, there are only default cameras. On mobile devices, there is a differentiation between back and front cameras.

C

easyar_CameraDeviceType easyar_CameraParameters_cameraDeviceType(const easyar_CameraParameters * This)

C++

CameraDeviceType cameraDeviceType()

Java

public int cameraDeviceType()

Kotlin

fun cameraDeviceType(): Int

Objective-C

- (easyar_CameraDeviceType)cameraDeviceType

Swift

public func cameraDeviceType() -> CameraDeviceType

C#

public virtual CameraDeviceType cameraDeviceType()

cameraOrientation

Angles rotation required to rotate clockwise and display camera image on device with natural orientation. The range is [0, 360).

For Android phones and some Android tablets, this value is 90 degrees.

For Android eye-wear and some Android tablets, this value is 0 degrees.

For all current iOS devices, this value is 90 degrees.

C

int easyar_CameraParameters_cameraOrientation(const easyar_CameraParameters * This)

C++

int cameraOrientation()

Java

public int cameraOrientation()

Kotlin

fun cameraOrientation(): Int

Objective-C

- (int)cameraOrientation

Swift

public func cameraOrientation() -> Int32

C#

public virtual int cameraOrientation()

createWithDefaultIntrinsics

Creates CameraParameters with default camera intrinsics. Default intrinsics are calculated by image size, which is not very precise.

C

void easyar_CameraParameters_createWithDefaultIntrinsics(easyar_Vec2I imageSize, easyar_CameraDeviceType cameraDeviceType, int cameraOrientation, easyar_CameraParameters * * Return)

C++

static std::shared_ptr<CameraParameters> createWithDefaultIntrinsics(Vec2I imageSize, CameraDeviceType cameraDeviceType, int cameraOrientation)

Java

public static @Nonnull CameraParameters createWithDefaultIntrinsics(@Nonnull Vec2I imageSize, int cameraDeviceType, int cameraOrientation)

Kotlin

companion object fun createWithDefaultIntrinsics(imageSize: Vec2I, cameraDeviceType: Int, cameraOrientation: Int): CameraParameters

Objective-C

+ (easyar_CameraParameters *)createWithDefaultIntrinsics:(easyar_Vec2I *)imageSize cameraDeviceType:(easyar_CameraDeviceType)cameraDeviceType cameraOrientation:(int)cameraOrientation

Swift

public static func createWithDefaultIntrinsics(_ imageSize: Vec2I, _ cameraDeviceType: CameraDeviceType, _ cameraOrientation: Int32) -> CameraParameters

C#

public static CameraParameters createWithDefaultIntrinsics(Vec2I imageSize, CameraDeviceType cameraDeviceType, int cameraOrientation)

getResized

Get equivalent CameraParameters for a different camera image size.

C

void easyar_CameraParameters_getResized(easyar_CameraParameters * This, easyar_Vec2I imageSize, easyar_CameraParameters * * Return)

C++

std::shared_ptr<CameraParameters> getResized(Vec2I imageSize)

Java

public @Nonnull CameraParameters getResized(@Nonnull Vec2I imageSize)

Kotlin

fun getResized(imageSize: Vec2I): CameraParameters

Objective-C

- (easyar_CameraParameters *)getResized:(easyar_Vec2I *)imageSize

Swift

public func getResized(_ imageSize: Vec2I) -> CameraParameters

C#

public virtual CameraParameters getResized(Vec2I imageSize)

imageOrientation

Calculates the angle required to rotate the camera image clockwise to align it with the screen.

screenRotation is the angle of rotation of displaying screen image against device natural orientation in clockwise in degrees.

For iOS(UIInterfaceOrientationPortrait as natural orientation):

  • UIInterfaceOrientationPortrait: rotation = 0

  • UIInterfaceOrientationLandscapeRight: rotation = 90

  • UIInterfaceOrientationPortraitUpsideDown: rotation = 180

  • UIInterfaceOrientationLandscapeLeft: rotation = 270

For Android:

  • Surface.ROTATION_0 = 0

  • Surface.ROTATION_90 = 90

  • Surface.ROTATION_180 = 180

  • Surface.ROTATION_270 = 270

C

int easyar_CameraParameters_imageOrientation(const easyar_CameraParameters * This, int screenRotation)

C++

int imageOrientation(int screenRotation)

Java

public int imageOrientation(int screenRotation)

Kotlin

fun imageOrientation(screenRotation: Int): Int

Objective-C

- (int)imageOrientation:(int)screenRotation

Swift

public func imageOrientation(_ screenRotation: Int32) -> Int32

C#

public virtual int imageOrientation(int screenRotation)

imageHorizontalFlip

Calculates whether the image needed to be flipped horizontally. The image is rotated, then flipped in rendering. When cameraDeviceType is front, a flip is automatically applied. Pass manualHorizontalFlip with true to add a manual flip.

C

bool easyar_CameraParameters_imageHorizontalFlip(const easyar_CameraParameters * This, bool manualHorizontalFlip)

C++

bool imageHorizontalFlip(bool manualHorizontalFlip)

Java

public boolean imageHorizontalFlip(boolean manualHorizontalFlip)

Kotlin

fun imageHorizontalFlip(manualHorizontalFlip: Boolean): Boolean

Objective-C

- (bool)imageHorizontalFlip:(bool)manualHorizontalFlip

Swift

public func imageHorizontalFlip(_ manualHorizontalFlip: Bool) -> Bool

C#

public virtual bool imageHorizontalFlip(bool manualHorizontalFlip)

projection

Calculates the perspective projection matrix needed by virtual object rendering. The projection transforms points from camera coordinate system to clip coordinate system ([-1, 1]^4) (including rotation around z-axis). The form of perspective projection matrix is the same as OpenGL, that matrix multiply column vector of homogeneous coordinates of point on the right, ant not like Direct3D, that matrix multiply row vector of homogeneous coordinates of point on the left. But data arrangement is row-major, not like OpenGL's column-major. Clip coordinate system and normalized device coordinate system are defined as the same as OpenGL's default.

C

easyar_Matrix44F easyar_CameraParameters_projection(const easyar_CameraParameters * This, float nearPlane, float farPlane, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)

C++

Matrix44F projection(float nearPlane, float farPlane, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)

Java

public @Nonnull Matrix44F projection(float nearPlane, float farPlane, float viewportAspectRatio, int screenRotation, boolean combiningFlip, boolean manualHorizontalFlip)

Kotlin

fun projection(nearPlane: Float, farPlane: Float, viewportAspectRatio: Float, screenRotation: Int, combiningFlip: Boolean, manualHorizontalFlip: Boolean): Matrix44F

Objective-C

- (easyar_Matrix44F *)projection:(float)nearPlane farPlane:(float)farPlane viewportAspectRatio:(float)viewportAspectRatio screenRotation:(int)screenRotation combiningFlip:(bool)combiningFlip manualHorizontalFlip:(bool)manualHorizontalFlip

Swift

public func projection(_ nearPlane: Float, _ farPlane: Float, _ viewportAspectRatio: Float, _ screenRotation: Int32, _ combiningFlip: Bool, _ manualHorizontalFlip: Bool) -> Matrix44F

C#

public virtual Matrix44F projection(float nearPlane, float farPlane, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)

imageProjection

Calculates the orthogonal projection matrix needed by camera background rendering. The projection transforms points from image quad coordinate system ([-1, 1]^2) to clip coordinate system ([-1, 1]^4) (including rotation around z-axis), with the undefined two dimensions unchanged. The form of orthogonal projection matrix is the same as OpenGL, that matrix multiply column vector of homogeneous coordinates of point on the right, ant not like Direct3D, that matrix multiply row vector of homogeneous coordinates of point on the left. But data arrangement is row-major, not like OpenGL's column-major. Clip coordinate system and normalized device coordinate system are defined as the same as OpenGL's default.

C

easyar_Matrix44F easyar_CameraParameters_imageProjection(const easyar_CameraParameters * This, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)

C++

Matrix44F imageProjection(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)

Java

public @Nonnull Matrix44F imageProjection(float viewportAspectRatio, int screenRotation, boolean combiningFlip, boolean manualHorizontalFlip)

Kotlin

fun imageProjection(viewportAspectRatio: Float, screenRotation: Int, combiningFlip: Boolean, manualHorizontalFlip: Boolean): Matrix44F

Objective-C

- (easyar_Matrix44F *)imageProjection:(float)viewportAspectRatio screenRotation:(int)screenRotation combiningFlip:(bool)combiningFlip manualHorizontalFlip:(bool)manualHorizontalFlip

Swift

public func imageProjection(_ viewportAspectRatio: Float, _ screenRotation: Int32, _ combiningFlip: Bool, _ manualHorizontalFlip: Bool) -> Matrix44F

C#

public virtual Matrix44F imageProjection(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)

screenCoordinatesFromImageCoordinates

Transforms points from image coordinate system ([0, 1]^2) to screen coordinate system ([0, 1]^2). Both coordinate system is x-left, y-down, with origin at left-top.

C

easyar_Vec2F easyar_CameraParameters_screenCoordinatesFromImageCoordinates(const easyar_CameraParameters * This, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, easyar_Vec2F imageCoordinates)

C++

Vec2F screenCoordinatesFromImageCoordinates(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, Vec2F imageCoordinates)

Java

public @Nonnull Vec2F screenCoordinatesFromImageCoordinates(float viewportAspectRatio, int screenRotation, boolean combiningFlip, boolean manualHorizontalFlip, @Nonnull Vec2F imageCoordinates)

Kotlin

fun screenCoordinatesFromImageCoordinates(viewportAspectRatio: Float, screenRotation: Int, combiningFlip: Boolean, manualHorizontalFlip: Boolean, imageCoordinates: Vec2F): Vec2F

Objective-C

- (easyar_Vec2F *)screenCoordinatesFromImageCoordinates:(float)viewportAspectRatio screenRotation:(int)screenRotation combiningFlip:(bool)combiningFlip manualHorizontalFlip:(bool)manualHorizontalFlip imageCoordinates:(easyar_Vec2F *)imageCoordinates

Swift

public func screenCoordinatesFromImageCoordinates(_ viewportAspectRatio: Float, _ screenRotation: Int32, _ combiningFlip: Bool, _ manualHorizontalFlip: Bool, _ imageCoordinates: Vec2F) -> Vec2F

C#

public virtual Vec2F screenCoordinatesFromImageCoordinates(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, Vec2F imageCoordinates)

imageCoordinatesFromScreenCoordinates

Transforms points from screen coordinate system ([0, 1]^2) to image coordinate system ([0, 1]^2). Both coordinate system is x-left, y-down, with origin at left-top.

C

easyar_Vec2F easyar_CameraParameters_imageCoordinatesFromScreenCoordinates(const easyar_CameraParameters * This, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, easyar_Vec2F screenCoordinates)

C++

Vec2F imageCoordinatesFromScreenCoordinates(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, Vec2F screenCoordinates)

Java

public @Nonnull Vec2F imageCoordinatesFromScreenCoordinates(float viewportAspectRatio, int screenRotation, boolean combiningFlip, boolean manualHorizontalFlip, @Nonnull Vec2F screenCoordinates)

Kotlin

fun imageCoordinatesFromScreenCoordinates(viewportAspectRatio: Float, screenRotation: Int, combiningFlip: Boolean, manualHorizontalFlip: Boolean, screenCoordinates: Vec2F): Vec2F

Objective-C

- (easyar_Vec2F *)imageCoordinatesFromScreenCoordinates:(float)viewportAspectRatio screenRotation:(int)screenRotation combiningFlip:(bool)combiningFlip manualHorizontalFlip:(bool)manualHorizontalFlip screenCoordinates:(easyar_Vec2F *)screenCoordinates

Swift

public func imageCoordinatesFromScreenCoordinates(_ viewportAspectRatio: Float, _ screenRotation: Int32, _ combiningFlip: Bool, _ manualHorizontalFlip: Bool, _ screenCoordinates: Vec2F) -> Vec2F

C#

public virtual Vec2F imageCoordinatesFromScreenCoordinates(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, Vec2F screenCoordinates)

equalsTo

Checks if two groups of parameters are equal.

C

bool easyar_CameraParameters_equalsTo(const easyar_CameraParameters * This, easyar_CameraParameters * other)

C++

bool equalsTo(std::shared_ptr<CameraParameters> other)

Java

public boolean equalsTo(@Nonnull CameraParameters other)

Kotlin

fun equalsTo(other: CameraParameters): Boolean

Objective-C

- (bool)equalsTo:(easyar_CameraParameters *)other

Swift

public func equalsTo(_ other: CameraParameters) -> Bool

C#

public virtual bool equalsTo(CameraParameters other)