I have to print this floatbuffer as array and there is a function for that in the documentation but the function is not working. I cant understand what am I doing wrong?
I have tried using the floatBuffer.toString() but it does print the array that the documentation(ARCore) has described.Thus not proper results.
Camera camera = frame.getCamera();
CameraIntrinsics cameraIntrinsics=camera.getImageIntrinsics();
float[] focal=cameraIntrinsics.getFocalLength();
Log.e("Focals",Arrays.toString(focal));
int [] getDiminsions=cameraIntrinsics.getImageDimensions();
Log.e("Dimensions ", Arrays.toString(getDiminsions));
backgroundRenderer.draw(frame);
PointCloud pointCloud=frame.acquirePointCloud();
FloatBuffer floatBuffer=pointCloud.getPoints();
FloatBuffer readonly=floatBuffer.asReadOnlyBuffer();
//final boolean res=readonly.hasArray();
final float[] points=floatBuffer.array();
//what should I do
As per the documentation(ARCore) every point in the floatBuffer has 4 values:x,y,z coordinates and a confidence value.
Depending on the implementation of FloatBuffer, the
array()method may not be available if the buffer is not backed by an array. You may not need the array if all you are going to do is iterate through the values.But if you do need to use an array, you'll need to call
hasArray()and if it does not, allocate an array and copy the data.