I am experimenting with Apple's ARKit and have a question regarding camera transformations. Which of the values in the transform matrix represent how far the user has travelled from the point of origin? Calling
self.sceneView.session.currentFrame!.camera.transform.columns.0.x
does not seem to yield the correct X
translation.
Additionally, what would be the correct location for Y
and Z
?
Using the translate feature is as simple as opening up the Camera app and pointing it at the text you want to translate. Tap on the text selection button in the app to select the detected text, and then choose the translate option to get an instant translation.
Point the app camera to any text on photos or documents and tap the button to auto-translate to the target language. The camera can scan large documents in various languages and convert to other languages. The scanning and translating process are done by machine learning trained with big data.
You get camera information from the camera property of each ARFrame ARKit delivers. The general quality of position tracking available when the camera captured a frame. Values for position tracking quality, with possible causes when tracking quality is limited. The position and orientation of the camera in world coordinate space.
The camera can scan large documents in various languages and convert to other languages. The scanning and translating process are done by machine learning trained with big data. Camera Translator - best dictionary app for language learner & traveler: - Supports more than 100 languages. - Recognizes text documents with lots of formats.
The last column of a 4x4 transform matrix -- matrix.columns.3
in this case -- is the translation vector. See this old answer for some background on 4x4 transform matrices and how they work.
The simplest way to get ARCamera
's translation is the following:
func getCameraTransform(for sceneView: ARSCNView) -> MDLTransform {
guard let transform = sceneView.session.currentFrame?.camera.transform else { return }
return MDLTransform(matrix: transform)
}
let position = SCNVector3(cameraTransform.translation.x,
cameraTransform.translation.y,
cameraTransform.translation.z)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With