如何解决在 S21 ultra 中使用 Camera2 或 CameraX 访问长焦镜头
我正在尝试使用 Camera2 和 CameraX API 访问 Samsung S21 ultra 上的长焦镜头。它列出了两个后置摄像头和两个前置摄像头。见附快照。但这些都不是长焦镜头。两个可通过 API 访问的相机是 WIDE 和 UW 镜头,但缺少 Telephoto 和 Periscope Telephoto。
有人可以确认三星 S21 超长焦相机是否已开放用于第三方应用程序并且可以通过 Camera2 API 访问吗?
我还考虑将多个物理摄像头绑定到单个逻辑摄像头,我们可以访问它们,但同时尝试从逻辑摄像头检索物理摄像头 ID。但是在打印这些时我总是得到空值。请参阅下面的代码片段。
fun findDualCameras(manager: CameraManager,facing: Int? = null): Array<DualCamera> {
val dualCameras = ArrayList<DualCamera>()
// Iterate over all the available camera characteristics
manager.cameraIdList.map {
Pair(manager.getCameraCharacteristics(it),it)
}.filter {
// Filter by cameras facing the requested direction
facing == null || it.first.get(CameraCharacteristics.LENS_FACING) == facing
}.filter {
// Filter by logical cameras
it.first.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES)!!.contains(
CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA
)
}.forEach {
// All possible pairs from the list of physical cameras are valid results
// NOTE: There could be N physical cameras as part of a logical camera grouping
val physicalCameras = it.first.physicalCameraIds.toTypedArray()
for (idx1 in physicalCameras.indices) {
for (idx2 in (idx1 + 1) until physicalCameras.size) {
dualCameras.add(
DualCamera(
it.second,physicalCameras[idx1],physicalCameras[idx2]
)
)
}
}
}
return dualCameras.toTypedArray()
}
是否还有其他可能直接在 S21 ultra 中访问 Telescope 相机,或者我们可以在 S21 ultra 中间接从望远镜相机获取流吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。