Are all API level 21 devices required to expose the camera2 package for all cameras(e.g. front,back) at least in the LEGACY support type?
In other words, is it possible(and does it happen) for a android 5 camera to be more functional under the deprecated android.hardware.Camera interface, than under the new android.hardware.camera2 interface, or even for the camera device to be impossible to find or use as a android.hardware.camera2 device?
It's mandatory that camera devices are exposed through android.hardware.camera2 (API2) as well as the deprecated android.hardware.Camera (API1).
However, at the LEGACY level, some features available in API1 may not be available in API2. Primarily, this affects the available recording resolutions, as LEGACY API2 is limited to the maximum preview size available in API1.
In addition, any OEM extensions to API1 won't be available through API2.
Related
When using Camera2 API or CameraX I get such crashes for
and also
With Camera 2 API you can check the camera hardware level:
val level =
getCameraCharacteristics(
context,
cameraIdx
).get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)
and available levels are :
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_3
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL
The issue happens only for devices INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY, though not for all devices of this level.
The only fix is to use legacy camera API for legacy level
Even CameraX uses Camera2 for all devices and ignores hardware level, so it's useless...
For filtering out devices I found only
The only one I could use is <uses-feature android:name="android.hardware.camera.level.full" android:required="true" /> but in this case it will filter all devices with camera hardware levels like 3, limited, external I guess as well, so not just legacy level
What is the solution? I don't want to implement both APIs (legacy camera + camera2), just the Camera2 and exclude devices with legacy camera hardware level
Extracting intrinsic calibration parameters from an android device's camera using the camera2 API is known to be problematic.
However the guidance has been that if the phone supports the DEPTH_OUTPUT capability, it is guaranteed to also provide camera intrinsics (via LENS_INTRINSIC_CALIBRATION).
This is stated in the following sources:
In this SO answer
In the documentation, where it is stated that:
[The DEPTH_OUTPUT] capability requires the camera device to support the following:
This camera device, and all camera devices with the same android.lens.facing, will list the following calibration metadata entries in both CameraCharacteristics and CaptureResult:
android.lens.intrinsicCalibration
Still, the Huawei P30 Pro claims to support the DEPTH_OUTPUT capability but does not provide any useful intrinsics (all intrinsic parameters are zero).
For what it's worth, the Huawei P30 Pro's support for the camera2 API is INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED, but this should not matter, as neither of the sources cited above give any conditions on the device's camera2 API support level for extracting intrinsics.
Could anyone please help?
I've been working on a customized camera app, it only changes the layout of how the camera is shown but it doesn't change any core feature of the camera.
As I searched, I found these libraries: hardware.camera2 , hardware.camera and cameraX.
And my app should work properly on minSdk 17. so my question is: is camera api deprecated so I can use camera2 on my app?
As I saw in documents you could only use camera2 with cameraManager on API 21 and higher.
Can anyone help me with what library I should use and how I could implement it?
hardware.camera (also known as Camera1) was deprecated in API level 21.
hardware.camera2 (also known as Camera2) was introduced in API level 21.
camerax is part of the Jetpack suite of libraries, and is built on top on Camera2, so is backward compatible to API level 21.
If your app has a minSdk version of 17, you can define a single Camera interface to use in your app, then provide 2 implementations for it using camera1 on API levels below 21, and CameraX/Camera2 on API levels starting at 21. Whether you choose Camera2 or CameraX depends mostly on your camera features. CameraX provides fairly easy to use APIs for preview, image analysis and image capture, and resolves device compatibility issues. You can take a look at its official documentation to see whether it meets your app's requirements, if it does, you can get started on it with this codelab. Camera2 provides a more fine grained control over the camera, but come with more complexity to handle it, you can take a look at what it provides through its official documentation.
Is it possible to access external usb camera using deprecated api android.hardware.Camera? Also is it possible in new Camera2 api? Then how to use since I'm new to camera functionality
The Camera and Camera2 APIs are for interfacing with the built in hardware camera only. Depending on what USB camera you are trying to control, there may already be a library/SDK for you to use but Camera and Camera2 will not work for your use case.
To add to Eric Bachhuber's comment:
On a few Android devices, there's support for external USB cameras through the standard camera APIs, but this is not a standard feature.
Is there a way to check the camera HAL version from a Java application?
This is to verify that the camera2 api and HAL3 api is supported. Slide 38 http://www.slideshare.net/lbk003/an-devcon2013-camera3kaurfinal
You shouldn't need to know the exact HAL version of the device, and instead query the camera's capabilities through the camera API.
For the new camera2 API, look at the CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL and REQUEST_AVAILABLE_CAPABILITIES fields to check whether the device has full-capability support or some lesser set of features.