Stay organized with collectionsSave and categorize content based on your preferences.
public classCameraIntrinsics
Provides information about the physical characteristics of the device camera, for the camera
image (CPU) or texture (GPU). TheCameraIntrinsicsis a long-lived object, and the
properties of CameraIntrinsics may be updated every time Session.update() is called.
The focal length is conventionally represented in pixels. For a detailed explanation, please
seeDisecting the Camera Matrix, Part
3: The Intrinsic Matrix. Pixels-to-meters conversion can useSENSOR_INFO_PHYSICAL_SIZEandSENSOR_INFO_PIXEL_ARRAY_SIZEin the Android
Characteristics API.
Details
Returns
afloat[2]containing the focal length. The order of values is {fx, fy}.
public
void
getFocalLength
(float[] focalLength, int offset)
The focal length is conventionally represented in pixels. For a detailed explanation, please
seeDisecting the Camera Matrix, Part
3: The Intrinsic Matrix. Pixels-to-meters conversion can useSENSOR_INFO_PHYSICAL_SIZEandSENSOR_INFO_PIXEL_ARRAY_SIZEin the Android
Characteristics API.
Details
Parameters
focalLength
storage for at least 2 floats representing the focal length. The order of
values is {fx, fy}.
offset
the offset infocalLengthat which to begin writing the focal length
values.
public
void
getImageDimensions
(int[] dimensions, int offset)
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eCameraIntrinsics\u003c/code\u003e provides essential information about the device camera's physical characteristics, like focal length and image dimensions, for both CPU and GPU processing.\u003c/p\u003e\n"],["\u003cp\u003eThis object is long-lived, and its properties can update every time the session is refreshed using \u003ccode\u003eSession.update()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eKey methods include \u003ccode\u003egetFocalLength()\u003c/code\u003e, \u003ccode\u003egetImageDimensions()\u003c/code\u003e, and \u003ccode\u003egetPrincipalPoint()\u003c/code\u003e which return critical camera parameters.\u003c/p\u003e\n"],["\u003cp\u003eFocal length is expressed in pixels and requires conversion to meters using Android's sensor information APIs if needed.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can retrieve these camera characteristics to perform tasks like image correction, 3D calculations, and augmented reality experiences.\u003c/p\u003e\n"]]],[],null,["# CameraIntrinsics\n\n`\npublic class\n`**CameraIntrinsics**`\n` \nProvides information about the physical characteristics of the device camera, for the camera\nimage (CPU) or texture (GPU). The `CameraIntrinsics` is a long-lived object, and the\nproperties of CameraIntrinsics may be updated every time Session.update() is called. \n\nPublic Methods\n--------------\n\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` float[] ` | [getFocalLength](/ar/reference/java/com/google/ar/core/CameraIntrinsics#getFocalLength())`()` Returns the camera's focal length in pixels. |\n| ` void ` | [getFocalLength](/ar/reference/java/com/google/ar/core/CameraIntrinsics#getFocalLength(float[],%20int))`(float[] focalLength, int offset)` Returns the camera's focal length in pixels. |\n| ` void ` | [getImageDimensions](/ar/reference/java/com/google/ar/core/CameraIntrinsics#getImageDimensions(int[],%20int))`(int[] dimensions, int offset)` Returns the camera's image dimensions. |\n| ` int[] ` | [getImageDimensions](/ar/reference/java/com/google/ar/core/CameraIntrinsics#getImageDimensions())`()` Returns a `int[2]` containing the image dimensions. |\n| ` float[] ` | [getPrincipalPoint](/ar/reference/java/com/google/ar/core/CameraIntrinsics#getPrincipalPoint())`()` Returns a `float[2]` containing the principal point. |\n| ` void ` | [getPrincipalPoint](/ar/reference/java/com/google/ar/core/CameraIntrinsics#getPrincipalPoint(float[],%20int))`(float[] principalPoint, int offset)` Returns the camera's principal point. |\n\nInherited Methods\n-----------------\n\nFrom `class\njava.lang.Object` \n\n|---------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|\n| ` `[Object](https://developer.android.com/reference/java/lang/Object)` ` | clone`()` |\n| ` boolean ` | equals`(`[Object](https://developer.android.com/reference/java/lang/Object)` arg0)` |\n| ` void ` | finalize`()` |\n| ` final `[Class](https://developer.android.com/reference/java/lang/Class)`\u003c?\u003e ` | getClass`()` |\n| ` int ` | hashCode`()` |\n| ` final void ` | notify`()` |\n| ` final void ` | notifyAll`()` |\n| ` `[String](https://developer.android.com/reference/java/lang/String)` ` | toString`()` |\n| ` final void ` | wait`(long arg0, int arg1)` |\n| ` final void ` | wait`(long arg0)` |\n| ` final void ` | wait`()` |\n\nPublic Methods\n--------------\n\n#### public\nfloat\\[\\]\ngetFocalLength\n()\n\n### getFocalLength\n\n```java\npublic float[] getFocalLength()\n``` \nReturns the camera's focal length in pixels.\n\nThe focal length is conventionally represented in pixels. For a detailed explanation, please\nsee [Disecting the Camera Matrix, Part\n3: The Intrinsic Matrix](https://ksimek.github.io/2013/08/13/intrinsic). Pixels-to-meters conversion can use `SENSOR_INFO_PHYSICAL_SIZE` and `SENSOR_INFO_PIXEL_ARRAY_SIZE` in the Android\nCharacteristics API.\n\n| Details ||\n| Returns | a `float[2]` containing the focal length. The order of values is {fx, fy}. |\n|---------|----------------------------------------------------------------------------|\n\n#### public\nvoid\ngetFocalLength\n(float\\[\\] focalLength, int offset)\n\n### getFocalLength\n\n```java\npublic void getFocalLength(\n float[] focalLength,\n int offset\n)\n``` \nReturns the camera's focal length in pixels.\n\nThe focal length is conventionally represented in pixels. For a detailed explanation, please\nsee [Disecting the Camera Matrix, Part\n3: The Intrinsic Matrix](https://ksimek.github.io/2013/08/13/intrinsic). Pixels-to-meters conversion can use `SENSOR_INFO_PHYSICAL_SIZE` and `SENSOR_INFO_PIXEL_ARRAY_SIZE` in the Android\nCharacteristics API.\n\n| Details ||\n| Parameters | |---------------|-----------------------------------------------------------------------------------------------| | `focalLength` | storage for at least 2 floats representing the focal length. The order of values is {fx, fy}. | | `offset` | the offset in `focalLength` at which to begin writing the focal length values. | |\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public\nvoid\ngetImageDimensions\n(int\\[\\] dimensions, int offset)\n\n### getImageDimensions\n\n```java\npublic void getImageDimensions(\n int[] dimensions,\n int offset\n)\n``` \nReturns the camera's image dimensions. The order of values is {width, height}.\n\n| Details ||\n| Parameters | |--------------|------------------------------------------------------------------------------------| | `dimensions` | storage for at least 2 ints representing the image's width and height. | | `offset` | the offset in `dimensions` at which to begin writing the image dimension's values. | |\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public\nint\\[\\]\ngetImageDimensions\n()\n\n### getImageDimensions\n\n```java\npublic int[] getImageDimensions()\n``` \nReturns a `int[2]` containing the image dimensions. The order of values is {width,\nheight}.\n\n#### public\nfloat\\[\\]\ngetPrincipalPoint\n()\n\n### getPrincipalPoint\n\n```java\npublic float[] getPrincipalPoint()\n``` \nReturns a `float[2]` containing the principal point. The order of values is {cx, cy}.\n\n#### public\nvoid\ngetPrincipalPoint\n(float\\[\\] principalPoint, int offset)\n\n### getPrincipalPoint\n\n```java\npublic void getPrincipalPoint(\n float[] principalPoint,\n int offset\n)\n``` \nReturns the camera's principal point. The order of values is {cx, cy}.\n\n| Details ||\n| Parameters | |------------------|----------------------------------------------------------------------------------------| | `principalPoint` | storage for at least 2 floats representing the principal point. | | `offset` | the offset in `principalPoint` at which to begin writing the principal point's values. | |\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|"]]