If enable the face detection and use the Camera2 API on the Tablet.
The rectangle position of face detection isn't correct on the front camera.
I think is the calculateCameraToPreviewMatrix method in the Preview.java doesn't have considered if the app is work on the Tablet.
Usually, the tablet camera orientation is 0 degree and the smartphone camera orientation is 90 or 270 degree.
Yes, it works okay when using the old Camera API.
I had to change code in the Preview.java to let it work okay. It's maybe
can help you.
// Unfortunately the transformation for Android L API isn't
documented, but this seems to work for Nexus 6.
// This is the equivalent code for
android.hardware.Camera.setDisplayOrientation, but we don't actually use
setDisplayOrientation()
// for CameraController2, except testing on Nexus 6 shows that
we shouldn't change "result" for front facing camera.
boolean mirror = (camera_controller.getFacing() ==
CameraController.Facing.FACING_FRONT);
By the way, what device do you have? (My tablets have 90 degree as camera orientation, same as phones, so just want to see if I have something to test on too.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My device camera default orientation is 0 and the same as the device screen orientation.
I use the device is my company developing products. it's not a consumer product. Maybe it isn't happening on tablets on the consumer market.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If enable the face detection and use the Camera2 API on the Tablet.
The rectangle position of face detection isn't correct on the front camera.
I think is the calculateCameraToPreviewMatrix method in the Preview.java doesn't have considered if the app is work on the Tablet.
Usually, the tablet camera orientation is 0 degree and the smartphone camera orientation is 90 or 270 degree.
Just to clarify, does it work okay when using the old Camera API?
Yes, it works okay when using the old Camera API.
I had to change code in the Preview.java to let it work okay. It's maybe
can help you.
documented, but this seems to work for Nexus 6.
// This is the equivalent code for
android.hardware.Camera.setDisplayOrientation, but we don't actually use
setDisplayOrientation()
// for CameraController2, except testing on Nexus 6 shows that
we shouldn't change "result" for front facing camera.
boolean mirror = (camera_controller.getFacing() ==
CameraController.Facing.FACING_FRONT);
camera_controller.getCameraOrientation() == 180)
Best regards,
Aress.
Mark mark-h@users.sourceforge.net 於 2020年7月23日 週四 上午6:50寫道:
Thanks! I'll take a look.
By the way, what device do you have? (My tablets have 90 degree as camera orientation, same as phones, so just want to see if I have something to test on too.)
My device camera default orientation is 0 and the same as the device screen orientation.
I use the device is my company developing products. it's not a consumer product. Maybe it isn't happening on tablets on the consumer market.