Table of Contents

Class CameraParameters

Namespace
easyar

Camera parameters, including image size, focal length, principal point, camera type, and the rotation angle of the camera relative to the natural orientation of the device.

CameraParameters

Constructors

CameraParameters

void easyar_CameraParameters__ctor(easyar_Vec2I imageSize, easyar_Vec2F focalLength, easyar_Vec2F principalPoint, easyar_CameraDeviceType cameraDeviceType, int cameraOrientation, easyar_CameraParameters * * Return)
CameraParameters(Vec2I imageSize, Vec2F focalLength, Vec2F principalPoint, CameraDeviceType cameraDeviceType, int cameraOrientation)
public CameraParameters(@Nonnull Vec2I imageSize, @Nonnull Vec2F focalLength, @Nonnull Vec2F principalPoint, int cameraDeviceType, int cameraOrientation)
constructor(imageSize: Vec2I, focalLength: Vec2F, principalPoint: Vec2F, cameraDeviceType: Int, cameraOrientation: Int)
+ (easyar_CameraParameters *) create:(easyar_Vec2I *)imageSize focalLength:(easyar_Vec2F *)focalLength principalPoint:(easyar_Vec2F *)principalPoint cameraDeviceType:(easyar_CameraDeviceType)cameraDeviceType cameraOrientation:(int)cameraOrientation
public convenience init(_ imageSize: Vec2I, _ focalLength: Vec2F, _ principalPoint: Vec2F, _ cameraDeviceType: CameraDeviceType, _ cameraOrientation: Int32)
public CameraParameters(Vec2I imageSize, Vec2F focalLength, Vec2F principalPoint, CameraDeviceType cameraDeviceType, int cameraOrientation)

Parameters

imageSize Vec2I
focalLength Vec2F
principalPoint Vec2F
cameraDeviceType CameraDeviceType
cameraOrientation Int32

Methods

size

Image size.

easyar_Vec2I easyar_CameraParameters_size(const easyar_CameraParameters * This)
Vec2I size()
public @Nonnull Vec2I size()
fun size(): Vec2I
- (easyar_Vec2I *)size
public func size() -> Vec2I
public virtual Vec2I size()

Returns

Vec2I

focalLength

Focal length. The distance from the equivalent optical center of the camera to the CCD plane divided by the unit pixel density in the width and height directions. Unit: pixels.

easyar_Vec2F easyar_CameraParameters_focalLength(const easyar_CameraParameters * This)
Vec2F focalLength()
public @Nonnull Vec2F focalLength()
fun focalLength(): Vec2F
- (easyar_Vec2F *)focalLength
public func focalLength() -> Vec2F
public virtual Vec2F focalLength()

Returns

Vec2F

principalPoint

Principal point. The pixel coordinates of the intersection of the camera's principal optical axis on the CCD plane to the top-left corner of the image. Unit: pixels.

easyar_Vec2F easyar_CameraParameters_principalPoint(const easyar_CameraParameters * This)
Vec2F principalPoint()
public @Nonnull Vec2F principalPoint()
fun principalPoint(): Vec2F
- (easyar_Vec2F *)principalPoint
public func principalPoint() -> Vec2F
public virtual Vec2F principalPoint()

Returns

Vec2F

cameraModelType

Camera model.

easyar_CameraModelType easyar_CameraParameters_cameraModelType(const easyar_CameraParameters * This)
CameraModelType cameraModelType()
public int cameraModelType()
fun cameraModelType(): Int
- (easyar_CameraModelType)cameraModelType
public func cameraModelType() -> CameraModelType
public virtual CameraModelType cameraModelType()

Returns

CameraModelType

cameraDeviceType

Camera device type. Default camera, rear camera, or front camera. Desktop devices are all default cameras, and mobile devices distinguish between rear cameras and front cameras.

easyar_CameraDeviceType easyar_CameraParameters_cameraDeviceType(const easyar_CameraParameters * This)
CameraDeviceType cameraDeviceType()
public int cameraDeviceType()
fun cameraDeviceType(): Int
- (easyar_CameraDeviceType)cameraDeviceType
public func cameraDeviceType() -> CameraDeviceType
public virtual CameraDeviceType cameraDeviceType()

Returns

CameraDeviceType

cameraOrientation

The angle that the camera image needs to be rotated clockwise when displayed in the natural orientation of the device. Range: [0, 360). Android phones and some Android tablets are 90 degrees. Android glasses and some Android tablets are 0 degrees. All existing iOS devices are 90 degrees.

int easyar_CameraParameters_cameraOrientation(const easyar_CameraParameters * This)
int cameraOrientation()
public int cameraOrientation()
fun cameraOrientation(): Int
- (int)cameraOrientation
public func cameraOrientation() -> Int32
public virtual int cameraOrientation()

Returns

Int32

createWithDefaultIntrinsics

Create CameraParameters with default camera intrinsics. The default camera intrinsics (focal length, principal point) are automatically calculated according to the image size, but are not particularly accurate.

void easyar_CameraParameters_createWithDefaultIntrinsics(easyar_Vec2I imageSize, easyar_CameraDeviceType cameraDeviceType, int cameraOrientation, easyar_CameraParameters * * Return)
static std::shared_ptr<CameraParameters> createWithDefaultIntrinsics(Vec2I imageSize, CameraDeviceType cameraDeviceType, int cameraOrientation)
public static @Nonnull CameraParameters createWithDefaultIntrinsics(@Nonnull Vec2I imageSize, int cameraDeviceType, int cameraOrientation)
companion object fun createWithDefaultIntrinsics(imageSize: Vec2I, cameraDeviceType: Int, cameraOrientation: Int): CameraParameters
+ (easyar_CameraParameters *)createWithDefaultIntrinsics:(easyar_Vec2I *)imageSize cameraDeviceType:(easyar_CameraDeviceType)cameraDeviceType cameraOrientation:(int)cameraOrientation
public static func createWithDefaultIntrinsics(_ imageSize: Vec2I, _ cameraDeviceType: CameraDeviceType, _ cameraOrientation: Int32) -> CameraParameters
public static CameraParameters createWithDefaultIntrinsics(Vec2I imageSize, CameraDeviceType cameraDeviceType, int cameraOrientation)

Parameters

imageSize Vec2I
cameraDeviceType CameraDeviceType
cameraOrientation Int32

Returns

CameraParameters

tryCreateWithCustomIntrinsics

Create CameraParameters with custom camera intrinsics. Need to specify camera intrinsics (focal length, principal point, distortion coefficient) and camera model. The camera model supports referring to CameraModelType. Note: Use this interface with caution. Incorrect input data may cause the creation of the object to fail and return empty.

void easyar_CameraParameters_tryCreateWithCustomIntrinsics(easyar_Vec2I imageSize, easyar_ListOfFloat * cameraParamList, easyar_CameraModelType cameraModel, easyar_CameraDeviceType cameraDeviceType, int cameraOrientation, easyar_OptionalOfCameraParameters * Return)
static std::optional<std::shared_ptr<CameraParameters>> tryCreateWithCustomIntrinsics(Vec2I imageSize, std::vector<float> cameraParamList, CameraModelType cameraModel, CameraDeviceType cameraDeviceType, int cameraOrientation)
public static @Nullable CameraParameters tryCreateWithCustomIntrinsics(@Nonnull Vec2I imageSize, java.util.@Nonnull ArrayList<java.lang.@Nonnull Float> cameraParamList, int cameraModel, int cameraDeviceType, int cameraOrientation)
companion object fun tryCreateWithCustomIntrinsics(imageSize: Vec2I, cameraParamList: ArrayList<Float>, cameraModel: Int, cameraDeviceType: Int, cameraOrientation: Int): CameraParameters?
+ (easyar_CameraParameters *)tryCreateWithCustomIntrinsics:(easyar_Vec2I *)imageSize cameraParamList:(NSArray<NSNumber *> *)cameraParamList cameraModel:(easyar_CameraModelType)cameraModel cameraDeviceType:(easyar_CameraDeviceType)cameraDeviceType cameraOrientation:(int)cameraOrientation
public static func tryCreateWithCustomIntrinsics(_ imageSize: Vec2I, _ cameraParamList: [Float], _ cameraModel: CameraModelType, _ cameraDeviceType: CameraDeviceType, _ cameraOrientation: Int32) -> CameraParameters?
public static Optional<CameraParameters> tryCreateWithCustomIntrinsics(Vec2I imageSize, List<float> cameraParamList, CameraModelType cameraModel, CameraDeviceType cameraDeviceType, int cameraOrientation)

Parameters

imageSize Vec2I
cameraParamList List<Single>
cameraModel CameraModelType
cameraDeviceType CameraDeviceType
cameraOrientation Int32

Returns

Optional<>

getResized

Get the equivalent CameraParameters after the camera image size is changed.

void easyar_CameraParameters_getResized(easyar_CameraParameters * This, easyar_Vec2I imageSize, easyar_CameraParameters * * Return)
std::shared_ptr<CameraParameters> getResized(Vec2I imageSize)
public @Nonnull CameraParameters getResized(@Nonnull Vec2I imageSize)
fun getResized(imageSize: Vec2I): CameraParameters
- (easyar_CameraParameters *)getResized:(easyar_Vec2I *)imageSize
public func getResized(_ imageSize: Vec2I) -> CameraParameters
public virtual CameraParameters getResized(Vec2I imageSize)

Parameters

imageSize Vec2I

Returns

CameraParameters

imageOrientation

Calculate the angle required for the image to be rotated clockwise relative to the screen to align with the screen. screenRotation is the angle by which the screen image is rotated clockwise relative to the natural orientation. For iOS, there are

  • UIInterfaceOrientationPortrait: screenRotation = 0
  • UIInterfaceOrientationLandscapeRight: screenRotation = 90
  • UIInterfaceOrientationPortraitUpsideDown: screenRotation = 180
  • UIInterfaceOrientationLandscapeLeft: screenRotation = 270 For Android, there are
  • Surface.ROTATION_0: screenRotation = 0
  • Surface.ROTATION_90: screenRotation = 90
  • Surface.ROTATION_180: screenRotation = 180
  • Surface.ROTATION_270: screenRotation = 270
int easyar_CameraParameters_imageOrientation(const easyar_CameraParameters * This, int screenRotation)
int imageOrientation(int screenRotation)
public int imageOrientation(int screenRotation)
fun imageOrientation(screenRotation: Int): Int
- (int)imageOrientation:(int)screenRotation
public func imageOrientation(_ screenRotation: Int32) -> Int32
public virtual int imageOrientation(int screenRotation)

Parameters

screenRotation Int32

Returns

Int32

imageHorizontalFlip

Calculate whether the image needs to be flipped horizontally. When rendering the image, rotation is performed first, and then flipping. When cameraDeviceType is the front camera, it will be flipped automatically, and on this basis, pass in manualHorizontalFlip to superimpose a manual flip.

bool easyar_CameraParameters_imageHorizontalFlip(const easyar_CameraParameters * This, bool manualHorizontalFlip)
bool imageHorizontalFlip(bool manualHorizontalFlip)
public boolean imageHorizontalFlip(boolean manualHorizontalFlip)
fun imageHorizontalFlip(manualHorizontalFlip: Boolean): Boolean
- (bool)imageHorizontalFlip:(bool)manualHorizontalFlip
public func imageHorizontalFlip(_ manualHorizontalFlip: Bool) -> Bool
public virtual bool imageHorizontalFlip(bool manualHorizontalFlip)

Parameters

manualHorizontalFlip Boolean

Returns

Boolean

projection

Calculate the perspective projection matrix required to render virtual objects, transforming points in the camera coordinate system into the clip coordinate system ([-1, 1]^4) (including rotation around the z-axis). The perspective projection matrix is in the same form as OpenGL, where the matrix is multiplied on the right by the column vector of the homogeneous coordinates of the point, not the matrix of Direct3D multiplied on the left by the homogeneous coordinates of the point. However, the data is arranged in row-major order, which is opposite to OpenGL's column-major order. The definitions of the clip coordinate system and the normalized device coordinate system are the same as the default in OpenGL.

easyar_Matrix44F easyar_CameraParameters_projection(const easyar_CameraParameters * This, float nearPlane, float farPlane, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)
Matrix44F projection(float nearPlane, float farPlane, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)
public @Nonnull Matrix44F projection(float nearPlane, float farPlane, float viewportAspectRatio, int screenRotation, boolean combiningFlip, boolean manualHorizontalFlip)
fun projection(nearPlane: Float, farPlane: Float, viewportAspectRatio: Float, screenRotation: Int, combiningFlip: Boolean, manualHorizontalFlip: Boolean): Matrix44F
- (easyar_Matrix44F *)projection:(float)nearPlane farPlane:(float)farPlane viewportAspectRatio:(float)viewportAspectRatio screenRotation:(int)screenRotation combiningFlip:(bool)combiningFlip manualHorizontalFlip:(bool)manualHorizontalFlip
public func projection(_ nearPlane: Float, _ farPlane: Float, _ viewportAspectRatio: Float, _ screenRotation: Int32, _ combiningFlip: Bool, _ manualHorizontalFlip: Bool) -> Matrix44F
public virtual Matrix44F projection(float nearPlane, float farPlane, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)

Parameters

nearPlane Single
farPlane Single
viewportAspectRatio Single
screenRotation Int32
combiningFlip Boolean
manualHorizontalFlip Boolean

Returns

Matrix44F

imageProjection

Calculate the orthographic projection matrix required to render the camera background image, transforming points in the image rectangle coordinate system ([-1, 1]^2) into the clip coordinate system ([-1, 1]^4) (including rotation around the z-axis), and the undefined two dimensions remain unchanged. The orthographic projection matrix is in the same form as OpenGL, where the matrix is multiplied on the right by the homogeneous coordinates of the point, not the matrix of Direct3D multiplied on the left by the homogeneous coordinates of the point. However, the data is arranged in row-major order, which is opposite to OpenGL's column-major order. The definitions of the clip coordinate system and the normalized device coordinate system are the same as the default in OpenGL.

easyar_Matrix44F easyar_CameraParameters_imageProjection(const easyar_CameraParameters * This, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)
Matrix44F imageProjection(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)
public @Nonnull Matrix44F imageProjection(float viewportAspectRatio, int screenRotation, boolean combiningFlip, boolean manualHorizontalFlip)
fun imageProjection(viewportAspectRatio: Float, screenRotation: Int, combiningFlip: Boolean, manualHorizontalFlip: Boolean): Matrix44F
- (easyar_Matrix44F *)imageProjection:(float)viewportAspectRatio screenRotation:(int)screenRotation combiningFlip:(bool)combiningFlip manualHorizontalFlip:(bool)manualHorizontalFlip
public func imageProjection(_ viewportAspectRatio: Float, _ screenRotation: Int32, _ combiningFlip: Bool, _ manualHorizontalFlip: Bool) -> Matrix44F
public virtual Matrix44F imageProjection(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip)

Parameters

viewportAspectRatio Single
screenRotation Int32
combiningFlip Boolean
manualHorizontalFlip Boolean

Returns

Matrix44F

screenCoordinatesFromImageCoordinates

Transform from the image coordinate system ([0, 1]^2) to the screen coordinate system ([0, 1]^2). Both coordinate systems have the x-axis to the right, the y-axis downward, and the origin at the top-left corner.

easyar_Vec2F easyar_CameraParameters_screenCoordinatesFromImageCoordinates(const easyar_CameraParameters * This, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, easyar_Vec2F imageCoordinates)
Vec2F screenCoordinatesFromImageCoordinates(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, Vec2F imageCoordinates)
public @Nonnull Vec2F screenCoordinatesFromImageCoordinates(float viewportAspectRatio, int screenRotation, boolean combiningFlip, boolean manualHorizontalFlip, @Nonnull Vec2F imageCoordinates)
fun screenCoordinatesFromImageCoordinates(viewportAspectRatio: Float, screenRotation: Int, combiningFlip: Boolean, manualHorizontalFlip: Boolean, imageCoordinates: Vec2F): Vec2F
- (easyar_Vec2F *)screenCoordinatesFromImageCoordinates:(float)viewportAspectRatio screenRotation:(int)screenRotation combiningFlip:(bool)combiningFlip manualHorizontalFlip:(bool)manualHorizontalFlip imageCoordinates:(easyar_Vec2F *)imageCoordinates
public func screenCoordinatesFromImageCoordinates(_ viewportAspectRatio: Float, _ screenRotation: Int32, _ combiningFlip: Bool, _ manualHorizontalFlip: Bool, _ imageCoordinates: Vec2F) -> Vec2F
public virtual Vec2F screenCoordinatesFromImageCoordinates(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, Vec2F imageCoordinates)

Parameters

viewportAspectRatio Single
screenRotation Int32
combiningFlip Boolean
manualHorizontalFlip Boolean
imageCoordinates Vec2F

Returns

Vec2F

imageCoordinatesFromScreenCoordinates

Transform from the screen coordinate system ([0, 1]^2) to the image coordinate system ([0, 1]^2). Both coordinate systems have the x-axis to the right, the y-axis downward, and the origin at the top-left corner.

easyar_Vec2F easyar_CameraParameters_imageCoordinatesFromScreenCoordinates(const easyar_CameraParameters * This, float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, easyar_Vec2F screenCoordinates)
Vec2F imageCoordinatesFromScreenCoordinates(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, Vec2F screenCoordinates)
public @Nonnull Vec2F imageCoordinatesFromScreenCoordinates(float viewportAspectRatio, int screenRotation, boolean combiningFlip, boolean manualHorizontalFlip, @Nonnull Vec2F screenCoordinates)
fun imageCoordinatesFromScreenCoordinates(viewportAspectRatio: Float, screenRotation: Int, combiningFlip: Boolean, manualHorizontalFlip: Boolean, screenCoordinates: Vec2F): Vec2F
- (easyar_Vec2F *)imageCoordinatesFromScreenCoordinates:(float)viewportAspectRatio screenRotation:(int)screenRotation combiningFlip:(bool)combiningFlip manualHorizontalFlip:(bool)manualHorizontalFlip screenCoordinates:(easyar_Vec2F *)screenCoordinates
public func imageCoordinatesFromScreenCoordinates(_ viewportAspectRatio: Float, _ screenRotation: Int32, _ combiningFlip: Bool, _ manualHorizontalFlip: Bool, _ screenCoordinates: Vec2F) -> Vec2F
public virtual Vec2F imageCoordinatesFromScreenCoordinates(float viewportAspectRatio, int screenRotation, bool combiningFlip, bool manualHorizontalFlip, Vec2F screenCoordinates)

Parameters

viewportAspectRatio Single
screenRotation Int32
combiningFlip Boolean
manualHorizontalFlip Boolean
screenCoordinates Vec2F

Returns

Vec2F

equalsTo

Determine whether two sets of parameters are equal.

bool easyar_CameraParameters_equalsTo(const easyar_CameraParameters * This, easyar_CameraParameters * other)
bool equalsTo(std::shared_ptr<CameraParameters> other)
public boolean equalsTo(@Nonnull CameraParameters other)
fun equalsTo(other: CameraParameters): Boolean
- (bool)equalsTo:(easyar_CameraParameters *)other
public func equalsTo(_ other: CameraParameters) -> Bool
public virtual bool equalsTo(CameraParameters other)

Parameters

other CameraParameters

Returns

Boolean