← Unity APP
← Xvisio SDK Documentation Home Page
Apk:Rgbd.unity
This APK shows the RGBD function which based on Xvisio AR glass. We will use the RGB and Tof camera of AR glasses to obtain the corresponding 3D spatial coordinates by using the 2D pixel coordinates on the RGB image, and assign the obtained 3D spatial coordinates to the cube model to display in the scene.
The width and height of RGB image is default to 1920x1080. The upper left corner of the RGB image is the position of (0,0) pixel points. Rgbd demo takes the two-dimensional pixel coordinates of the three points on the RGB image. The pixel coordinates of point1 are (960,540), point2 is (960,810), and point3 is (1440,540). The pixel coordinates of the three points can be used to obtain their coordinate positions in the three-dimensional space. Rgbd demo places a cube model in each of the three three-dimensional coordinate positions, and connect them with green line.
Rgbd demo will automatically calculate the 3D coordinates of the three pixels of the current RGB image per 0.4 seconds, and update the position of the cube model with the line in real time.
Take below as an example.
Step 1:
Create an Unity empty project and enable all the cameras. Drag "XvXRManager" in "XvXR/Prefabs" to the project (note that all the transform and rotation are 0.). Now the 6dof module has been merged into AR glass.
Step 2:
Drag "ThrowScene" in "XvXR/Prefabs" to the project. Now the virtual reality fusion function has been merged into the project.
Step 3:
Create an empty project and name it as "RgbdManager". Mount script "RgbdManager.cs"
Step 4:
Create an empty project and name it as "linePrefab". Mount "LineRenderer" and adjust the width of "line" to appropriate size.
Step 5:
Create an empty and name it as "box". Create three cubes and adjust the size to 0.05.
Step 6:
Drag "rgbrecord" in "ThrowScene" to the Rgbdrecord option box of "RgbdManager". Drag "linePrefab" into the Line option box of "RgbdManager". Drag "box" into the Box option box of "RgbdManager".
Step 5:
It shows as below after packing APK.