ARCore : Get Camera's resolution

2019-08-16 00:53发布

问题:

Is there any way to get camera's resolution ? (unless using Android from scratch) I did not found any getter, on a setter on session.setDisplayGeometry() that is not really what I expect.

My goal is to know the camera's picture ratio to cropp it on my display since the screen and the camera do not use the same size.

Thanks.

回答1:

There isn't a way to access the camera's resolution through the ARCore API in the developer preview. I asked about the resolution in comments of a separate question and it looks like the camera resolution in the developer preview will always be 1920x1080.



回答2:

There is a way to get the resolution of the camera:

Frame frame = session.update();
Camera camera = frame.getCamera();
int dim[] = camera.getImageIntrinsics().getImageDimensions();
Log.d("ARCORE","Camera Dimensions: "+dim[0]+" x "+dim[1]);

But it only gives me 640x480, and I don't think there's any way to change it right now, though it may use different values on different hardware. (ARCore 1.3)

I know it's an old question, but the answer seems to have changed since then.