public class
Camera
Provides information about the camera that is used to capture images. The Camera
is a
long-lived object and the properties of Camera
are updated every time Session.update()
is called.
Public Methods
boolean
|
|
Pose
|
getDisplayOrientedPose()
Returns the virtual camera pose in world space for rendering AR content onto the latest frame.
|
CameraIntrinsics
|
getImageIntrinsics()
Returns the unrotated camera intrinsics for the CPU image.
|
Pose
|
getPose()
Returns the pose of the physical camera in world space for the latest frame.
|
void
|
getProjectionMatrix(float[] dest, int offset, float near, float far)
Returns a projection matrix for rendering virtual content on top of the camera image.
|
CameraIntrinsics
|
getTextureIntrinsics()
Returns the unrotated camera intrinsics for the GPU texture.
|
TrackingFailureReason
|
getTrackingFailureReason()
Returns the reason that
getTrackingState() is TrackingState.PAUSED . |
TrackingState
|
getTrackingState()
Returns the current motion tracking state of this camera.
|
void
|
getViewMatrix(float[] viewMatrix, int offset)
Returns the view matrix for the camera for this frame.
|
int
|
hashCode()
Returns a hash code value for the object.
|
Inherited Methods
Public Methods
public boolean equals (Object obj)
equals
public boolean equals( Object obj )
Indicates whether some other object is a Camera
referencing the same logical camera as
this one.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns | true if this object is the same as the obj argument; false otherwise. |
||
See Also |
public Pose getDisplayOrientedPose ()
getDisplayOrientedPose
public Pose getDisplayOrientedPose()
Returns the virtual camera pose in world space for rendering AR content onto the latest frame. This is an OpenGL camera pose with +X pointing right, +Y pointing up, and -Z pointing in the direction the camera is looking, with "right" and "up" being relative to current logical display orientation.
See Also:
getViewMatrix(float[], int)
to conveniently compute the OpenGL View Matrix.getPose()
for the physical pose of the camera. It will differ by a local rotation about the Z axis by a multiple of 90°.Frame.getAndroidSensorPose()
for the pose of the android sensor frame. It will differ in both orientation and location.Session.setDisplayGeometry(int, int, int)
to update the display rotation.
getTrackingState()
returns TrackingState.TRACKING
and otherwise should not be used.
public CameraIntrinsics getImageIntrinsics ()
getImageIntrinsics
public CameraIntrinsics getImageIntrinsics()
Returns the unrotated camera intrinsics for the CPU image.
public Pose getPose ()
getPose
public Pose getPose()
Returns the pose of the physical camera in world space for the latest frame. This is an OpenGL camera pose with +X pointing right, +Y pointing right up, and -Z pointing in the direction the camera is looking, with "right" and "up" being relative to the image readout in the usual left-to-right, top-to-bottom order. Specifically, this is the camera pose at the center of exposure of the center row of the image.
For applications using the SDK for ARCore 1.5 and earlier, the returned pose is rotated around the Z axis by a multiple of 90° so that the axes correspond approximately to those of the Android Sensor Coordinate System.
See Also:
getDisplayOrientedPose()
for the pose of the virtual camera. It will differ by a local rotation about the Z axis by a multiple of 90°.Frame.getAndroidSensorPose()
for the pose of the Android sensor frame. It will differ in both orientation and location.Frame.transformCoordinates2d(Coordinates2d, float[], Coordinates2d, float[])
to convert viewport coordinates to texture coordinates.
getTrackingState()
returns TrackingState.TRACKING
and otherwise should not be used.
public void getProjectionMatrix (float[] dest, int offset, float near, float far)
getProjectionMatrix
public void getProjectionMatrix( float[] dest, int offset, float near, float far )
Returns a projection matrix for rendering virtual content on top of the camera image. Note that the projection matrix reflects the current display geometry and display rotation.
Note: When using Session.Feature.FRONT_CAMERA
, the returned projection matrix will
incorporate a horizontal flip.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
public CameraIntrinsics getTextureIntrinsics ()
getTextureIntrinsics
public CameraIntrinsics getTextureIntrinsics()
Returns the unrotated camera intrinsics for the GPU texture.
public TrackingFailureReason getTrackingFailureReason ()
getTrackingFailureReason
public TrackingFailureReason getTrackingFailureReason()
Returns the reason that getTrackingState()
is TrackingState.PAUSED
.
Returns TrackingFailureReason.NONE
briefly after Session.resume()
, while the
motion tracking is initializing. Always returns TrackingFailureReason.NONE
when getTrackingState()
is TrackingState.TRACKING
.
If multiple potential causes for motion tracking failure are detected, this reports the most actionable failure reason.
Details | |
---|---|
Returns | the reason for motion tracking failure. |
public TrackingState getTrackingState ()
getTrackingState
public TrackingState getTrackingState()
Returns the current motion tracking state of this camera. If this state is anything other than
TrackingState.TRACKING
the pose should not be considered useful. Use getTrackingFailureReason()
to determine the best recommendation to provide to the user to
restore motion tracking.
Note: Starting in ARCore 1.12, changing the active camera config using Session.setCameraConfig(CameraConfig)
may cause the tracking state on certain devices to
become permanently TrackingState.PAUSED
. For consistent behavior across all supported
devices, release any previously created anchors and trackables when setting a new camera
config.
public void getViewMatrix (float[] viewMatrix, int offset)
getViewMatrix
public void getViewMatrix( float[] viewMatrix, int offset )
Returns the view matrix for the camera for this frame. Note that the view matrix incorporates
the display orientation. This is equivalent to: camera.getDisplayOrientedPose().inverse().asMatrix()
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
See Also |
public int hashCode ()
hashCode
public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hash
tables such as those provided by HashMap
.
Details | |
---|---|
Returns | a hash code value for this object. |
See Also |